linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Fels <simon.fels@canonical.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] bluetooth: ask for MWS transport config only if controller supports 4.1
Date: Tue, 15 Sep 2015 12:10:40 +0200	[thread overview]
Message-ID: <55F7EEA0.7030504@canonical.com> (raw)
In-Reply-To: <6C5C6E24-A663-4A52-B38E-3AA2E8742779@holtmann.org>

On 15.09.2015 11:32, Marcel Holtmann wrote:
> Hi Simon,
>
>> Some controllers doesn't seem to clear the bitfield to indicate which
>> HCI commands are supported correctly. This leads to wrong conclusions
>> which HCI commands we can send at initialization time. In this case
>> the problem appeared with the command to retrieve the MWS transport
>> configuration which is only available since version 4.1
>
> provide btmon of the failing case and information about the controller that has this bug.
>
>> Signed-off-by: Simon Fels <simon.fels@canonical.com>
>> ---
>> include/net/bluetooth/bluetooth.h | 2 +-
>> net/bluetooth/hci_core.c          | 9 +++++++--
>> 2 files changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
>> index fcf2ae7..0861477 100644
>> --- a/include/net/bluetooth/bluetooth.h
>> +++ b/include/net/bluetooth/bluetooth.h
>> @@ -37,7 +37,7 @@
>> /* Bluetooth versions */
>> #define BLUETOOTH_VER_1_1	1
>> #define BLUETOOTH_VER_1_2	2
>> -#define BLUETOOTH_VER_2_0	3
>> +#define BLUETOOTH_VER_4_1	7
>>
>> /* Reserv for core and drivers use */
>> #define BT_SKB_RESERVE	8
>> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
>> index a7cdd99..f376ab6 100644
>> --- a/net/bluetooth/hci_core.c
>> +++ b/net/bluetooth/hci_core.c
>> @@ -824,8 +824,13 @@ static void hci_init4_req(struct hci_request *req, unsigned long opt)
>> 	if (hdev->commands[29] & 0x20)
>> 		hci_req_add(req, HCI_OP_READ_LOCAL_CODECS, 0, NULL);
>>
>> -	/* Get MWS transport configuration if the HCI command is supported */
>> -	if (hdev->commands[30] & 0x08)
>> +	/* Get MWS transport configuration if the HCI command is supported
>> +	 * but only when reported HCI version is at minimum 4.1. Some
>> +	 * controllers doesn't seem to clear the bit field they transmit
>> +	 * correctly so all resevered fields are invalid and let to
>> +	 * failing commands */
>> +	if (hdev->hci_ver >= BLUETOOTH_VER_4_1 &&
>> +		hdev->commands[30] & 0x08)
>> 		hci_req_add(req, HCI_OP_GET_MWS_TRANSPORT_CONFIG, 0, NULL);
>
> We are not doing it this way. The version checks we have in the core are for really old controllers and times when the Bluetooth Core specification was unclear in certain behaviors.
>
> Any new broken behavior of a controller will not be hidden behind a version check. It will be hidden behind a quirk and we will call out the manufacturer for not doing this right in the driver by setting needed quirks.

That is fine for me. Was just sending this out to get the discussion 
started and a bit unsure which patterns you use for such things.

btmon log is at http://paste.ubuntu.com/12416578/

The failure case is simply that the HCI is never getting up. It fails 
during a

$ hciconfig hci0 up

within the kernel side initialization phase.

regards,
Simon

  reply	other threads:[~2015-09-15 10:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-15  9:24 [PATCH] bluetooth: ask for MWS transport config only if controller supports 4.1 Simon Fels
2015-09-15  9:32 ` Marcel Holtmann
2015-09-15 10:10   ` Simon Fels [this message]
2015-09-16  2:36     ` Marcel Holtmann
2015-09-16  5:25       ` Simon Fels
2015-09-16  9:01         ` Marcel Holtmann
2015-09-16  9:50           ` Simon Fels

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55F7EEA0.7030504@canonical.com \
    --to=simon.fels@canonical.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).