Re: [PATCHv2] Bluetooth: quirk disabling LE Read Transmit Power

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 06 Nov 2021 08:47:39 +1100
"Luiz Augusto von Dentz" <luiz.dentz@xxxxxxxxx> wrote:
> Nowadays it is possible to treat errors such like this on a per
> command basis (assuming it is not essential for the init sequence):
> 
> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> index 979da5179ff4..f244f42cc609 100644
> --- a/include/net/bluetooth/hci.h
> +++ b/include/net/bluetooth/hci.h
> @@ -551,6 +551,7 @@ enum {
>  #define HCI_LK_AUTH_COMBINATION_P256   0x08
> 
>  /* ---- HCI Error Codes ---- */
> +#define HCI_ERROR_UNKNOWN_CMD          0x01
>  #define HCI_ERROR_UNKNOWN_CONN_ID      0x02
>  #define HCI_ERROR_AUTH_FAILURE         0x05
>  #define HCI_ERROR_PIN_OR_KEY_MISSING   0x06
> diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
> index bb88d31d2212..9c697e058974 100644
> --- a/net/bluetooth/hci_sync.c
> +++ b/net/bluetooth/hci_sync.c
> @@ -3325,11 +3325,18 @@ static int
> hci_le_read_adv_tx_power_sync(struct hci_dev *hdev)
>  /* Read LE Min/Max Tx Power*/
>  static int hci_le_read_tx_power_sync(struct hci_dev *hdev)
>  {
> +       int status;
> +
>         if (!(hdev->commands[38] & 0x80))
>                 return 0;
> 
> -       return __hci_cmd_sync_status(hdev,
> HCI_OP_LE_READ_TRANSMIT_POWER,
> -                                    0, NULL, HCI_CMD_TIMEOUT);
> +       status = __hci_cmd_sync_status(hdev,
> HCI_OP_LE_READ_TRANSMIT_POWER,
> +                                      0, NULL, HCI_CMD_TIMEOUT);
> +       /* Ignore if command is not really supported */
> +       if (status == HCI_ERROR_UNKNOWN_CMD)
> +               return 0;
> +
> +       return status;
>  }
> 
>  /* Read LE Accept List Size */

I've tried this patch, and status seems to be -56, not 0x01, but if I
change
+	if (status == HCI_ERROR_UNKNOWN_CMD)
to
+	if (status == -56)
It ignores the error and continues.

I seem to have an unrelated problem where although I can connect to my
Logitech MX Anywhere 2S mouse (I haven't tried any other devices yet),
it doesn't move the cursor or register clicks. I've also noticed that
bluetoothctl pair isn't asking for a "yes" when I pair a device, which
it was doing on 5.15 (with the patch I sent to get bluetooth working at
all). I've put dmesg and btsnoop for both 5.15 and bluetooth-next into
a gist here:
https://gist.github.com/Redecorating/5620b758d8191418cf19879d09672cf4
but I think this is a separate issue.

> 
> Anyway, it would probably be worth pointing out to the vendor they
> have a broken firmware if they do mark the command as supported but
> return such error.

Do you know if it'd be better to contact Broadcom or Apple for this?

> --
> Luiz Augusto von Dentz

-- 





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux