Return-Path: Message-id: From: Jaganath Kanakkassery To: Gustavo Padovan , Jaganath Kanakkassery Cc: linux-bluetooth@vger.kernel.org References: <1365487902-3553-1-git-send-email-jaganath.k@samsung.com> <20130411053343.GA19253@joana> In-reply-to: <20130411053343.GA19253@joana> Subject: Re: [PATCH v2] Bluetooth: Fix incorrect ssp mode bit for non ssp devices Date: Mon, 15 Apr 2013 11:03:14 +0530 MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=iso-8859-1; reply-type=original Sender: linux-bluetooth-owner@vger.kernel.org List-ID: Hi Gustavo, -------------------------------------------------- From: "Gustavo Padovan" Sent: Thursday, April 11, 2013 11:03 AM To: "Jaganath Kanakkassery" Cc: Subject: Re: [PATCH v2] Bluetooth: Fix incorrect ssp mode bit for non ssp devices > Hi Jaganath, > > * Jaganath Kanakkassery [2013-04-09 11:41:42 > +0530]: > >> Some faulty non ssp devices send extended inquiry response >> 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 >> >> 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 >> --- >> net/bluetooth/hci_event.c | 4 ++++ >> 1 file changed, 4 insertions(+) >> >> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c >> index 0a2b128..c1af186 100644 >> --- a/net/bluetooth/hci_event.c >> +++ b/net/bluetooth/hci_event.c >> @@ -2935,6 +2935,10 @@ static void hci_remote_ext_features_evt(struct >> hci_dev *hdev, >> >> 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); > > Since you added a comment after the else I would like to see braces both > in > the if and else parts. Makes reading easier. > Ok, I will raise patch. Thanks, Jaganath