Re: [PATCH v3] Bluetooth: Fix incorrect ssp mode bit for non ssp devices

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

 



Hi Jaganath,

> Some faulty non ssp devices send extended inquiry response

can we either spell out SSP or have it upper case here.

> during device discovery which is a violation of 2.1 specification.
> So for these devices we set ssp bit during acl connection
> initiation thinking that it is an ssp device. But for these
> devices, in remote extended features event ssp supported bit
> will be off. But we are not clearing the ssp bit in that case
> and eventually ssp bit in conn flag will be incorrectly set for
> these devices.
> 
> The software which has caused this issue is MecApp
> http://www.mecel.se/products/bluetooth/downloads/MecApp_download
> 
> This patch does a workaround by clearing the ssp bit if it is
> not supported in remote extended features event

The features page is actually the remote host features.

> 
> hcidump log
> ----------
> 
> < HCI Command: Inquiry (0x01|0x0001) plen 5
>    lap 0x9e8b33 len 4 num 0
>> HCI Event: Command Status (0x0f) plen 4
>    Inquiry (0x01|0x0001) status 0x00 ncmd 1
>> HCI Event: Extended Inquiry Result (0x2f) plen 255
>    bdaddr 00:1B:DC:05:B5:25 mode 1 clkoffset 0x3263 class 0x3c0000 rssi -77
>    Unknown type 0x42 with 8 bytes data
>    Unknown type 0x1e with 2 bytes data
>> HCI Event: Inquiry Complete (0x01) plen 1
>    status 0x00
> 
> < HCI Command: Create Connection (0x01|0x0005) plen 13
>    bdaddr 00:1B:DC:05:B5:25 ptype 0xcc18 rswitch 0x01 clkoffset 0x0000
>    Packet type: DM1 DM3 DM5 DH1 DH3 DH5
>> HCI Event: Command Status (0x0f) plen 4
>    Create Connection (0x01|0x0005) status 0x00 ncmd 1
>> HCI Event: Connect Complete (0x03) plen 11
>    status 0x00 handle 12 bdaddr 00:1B:DC:05:B5:25 type ACL encrypt 0x00
> < HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
>    handle 12
>> HCI Event: Command Status (0x0f) plen 4
>    Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 1
>> HCI Event: Read Remote Supported Features (0x0b) plen 11
>    status 0x00 handle 12
>    Features: 0xff 0xff 0x8f 0x7e 0xd8 0x1f 0x5b 0x87
> < HCI Command: Read Remote Extended Features (0x01|0x001c) plen 3
>    handle 12 page 1
>> HCI Event: Command Status (0x0f) plen 4
>    Read Remote Extended Features (0x01|0x001c) status 0x00 ncmd 1
>> HCI Event: Page Scan Repetition Mode Change (0x20) plen 7
>    bdaddr 00:1B:DC:05:B5:25 mode 1
>> HCI Event: Max Slots Change (0x1b) plen 3
>    handle 12 slots 5
>> HCI Event: Read Remote Extended Features (0x23) plen 13
>    status 0x00 handle 12 page 1 max 0
>    Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
> < HCI Command: Remote Name Request (0x01|0x0019) plen 10
>    bdaddr 00:1B:DC:05:B5:25 mode 2 clkoffset 0x0000
>> HCI Event: Command Status (0x0f) plen 4
>    Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
>> HCI Event: Remote Name Req Complete (0x07) plen 255
>    status 0x00 bdaddr 00:1B:DC:05:B5:25 name 'Bluetooth PTS Radio v4'
> < HCI Command: Authentication Requested (0x01|0x0011) plen 2
>    handle 12
>> HCI Event: Command Status (0x0f) plen 4
>    Authentication Requested (0x01|0x0011) status 0x00 ncmd 1
>> HCI Event: Link Key Request (0x17) plen 6
>    bdaddr 00:1B:DC:05:B5:25
> < HCI Command: Link Key Request Negative Reply (0x01|0x000c) plen 6
>    bdaddr 00:1B:DC:05:B5:25
>> HCI Event: Command Complete (0x0e) plen 10
>    Link Key Request Negative Reply (0x01|0x000c) ncmd 1
>    status 0x00 bdaddr 00:1B:DC:05:B5:25
>> HCI Event: PIN Code Request (0x16) plen 6
>    bdaddr 00:1B:DC:05:B5:25
> 
> Signed-off-by: Jaganath Kanakkassery <jaganath.k@xxxxxxxxxxx>
> ---
> net/bluetooth/hci_event.c |    7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index 0a2b128..838ef5c 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -2933,8 +2933,13 @@ static void hci_remote_ext_features_evt(struct hci_dev *hdev,
> 		if (ie)
> 			ie->data.ssp_mode = (ev->features[0] & LMP_HOST_SSP);
> 
> -		if (ev->features[0] & LMP_HOST_SSP)
> +		if (ev->features[0] & LMP_HOST_SSP) {
> 			set_bit(HCI_CONN_SSP_ENABLED, &conn->flags);
> +		} else {
> +			/* This is a workaround for some devices which send eir
> +			 * which actually does not support ssp */
> +			clear_bit(HCI_CONN_SSP_ENABLED, &conn->flags);

This is actually not phrased correctly.

	/* It is mandatory by the Bluetooth specification that Extended Inquiry
	 * Results are only used when Secure Simple Pairing is enabled, but some
	 * devices violate this.
	 *
	 * To make these devices work, the internal SSP enabled flag needs to be
	 * cleared if the remote host features do not indicate SSP support */

Comments are here to give a clear understanding why things are done. If the comment is even more cryptic, then that is not helpful. So please be descriptive.

Regards

Marcel

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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