Skip to contentSkip to conversation

Bluetooth: Fix request completion for command status events

PATCH In review [email protected] 3 participants 6 messages Nov 21, 2011 – Dec 2, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Bluetooth: Fix request completion for command status events

From: Johan Hedberg <[email protected]>

If a HCI command triggered by hci_request() fails at the command status phase we need to properly inform the request tracking code of the completion of the request.

---
 net/bluetooth/hci_event.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
net/bluetooth/hci_event.c +2 -0
index dfe6fbc..af24b3d 100644
@@ -2115,6 +2115,8 @@ static inline void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb)
 
 	default:
 		BT_DBG("%s opcode 0x%x", hdev->name, opcode);
+		if (ev->status)
+			hci_req_complete(hdev, opcode, ev->status);
 		break;
 	}
 
Signature · 1 line
1.7.7.3
#1 lore raw

PATCH 2/2 Bluetooth: Ignore HCI_Read_Local_Commands failures

From: Johan Hedberg <[email protected]>

Some 1.2 controllers will fail the HCI_Read_Local_Commands HCI command even though (according to the specification) they should support it. Since this HCI command is part of the controller init sequence controllers broken in this manner would be unusable. Since not having the list of supported commands is not critical for these controllers it is better to just ignore failures in this case (additionally, this is also how older kernels used to behave).

---
 net/bluetooth/hci_event.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
net/bluetooth/hci_event.c +16 -0
index af24b3d..e950865 100644
@@ -1400,6 +1400,18 @@ static void hci_cs_le_start_enc(struct hci_dev *hdev, u8 status)
 	BT_DBG("%s status 0x%x", hdev->name, status);
 }
 
+static void hci_cs_read_local_commands(struct hci_dev *hdev, u8 status)
+{
+	if (!status)
+		return;
+
+	/* Some 1.2 controllers report failure for HCI_Read_Local_Commands
+	 * even though they should support it. Since it's not a critical
+	 * issue not to have a proper result from them just ignore a
+	 * failure status (i.e. consider it a success) */
+	hci_req_complete(hdev, HCI_OP_READ_LOCAL_COMMANDS, 0);
+}
+
 static inline void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
 {
 	__u8 status = *((__u8 *) skb->data);
@@ -2113,6 +2125,10 @@ static inline void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb)
 		hci_cs_le_start_enc(hdev, ev->status);
 		break;
 
+	case HCI_OP_READ_LOCAL_COMMANDS:
+		hci_cs_read_local_commands(hdev, ev->status);
+		break;
+
 	default:
 		BT_DBG("%s opcode 0x%x", hdev->name, opcode);
 		if (ev->status)
Signature · 1 line
1.7.7.3
#2 lore raw

Re: [PATCH 2/2] Bluetooth: Ignore HCI_Read_Local_Commands failures

Hi Johan,

Quoted 10 lines · * [email protected] <[email protected]> [2011-11-21 20:01:24 +0200]:

From: Johan Hedberg <[email protected]>

Some 1.2 controllers will fail the HCI_Read_Local_Commands HCI command even though (according to the specification) they should support it. Since this HCI command is part of the controller init sequence controllers broken in this manner would be unusable. Since not having the list of supported commands is not critical for these controllers it is better to just ignore failures in this case (additionally, this is also how older kernels used to behave).

Quoted 4 lines
---
 net/bluetooth/hci_event.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

Both patches have been applied, thanks.

Gustavo

maintainer
#3 lore raw

Re: [PATCH 2/2] Bluetooth: Ignore HCI_Read_Local_Commands failures

Hi Gustavo,

Quoted 8 lines
Quoted 8 lines

Some 1.2 controllers will fail the HCI_Read_Local_Commands HCI command even though (according to the specification) they should support it. Since this HCI command is part of the controller init sequence controllers broken in this manner would be unusable. Since not having the list of supported commands is not critical for these controllers it is better to just ignore failures in this case (additionally, this is also how older kernels used to behave).

Quoted 6 lines
Quoted 4 lines
---
 net/bluetooth/hci_event.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

Both patches have been applied, thanks.

I would have preferred you didn't. Since now I have to get this all fixed up as well.

Regards

Marcel

#4 lore raw

Re: [PATCH 2/2] Bluetooth: Ignore HCI_Read_Local_Commands failures

Hi Marcel,

Quoted 15 lines · Marcel Holtmann

Hi Gustavo,

Quoted 13 lines
Quoted 12 lines

Some 1.2 controllers will fail the HCI_Read_Local_Commands HCI command even though (according to the specification) they should support it. Since this HCI command is part of the controller init sequence controllers broken in this manner would be unusable. Since not having the list of supported commands is not critical for these controllers it is better to just ignore failures in this case (additionally, this is also how older kernels used to behave).

---
 net/bluetooth/hci_event.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
Quoted 4 lines
Quoted 1 line

Both patches have been applied, thanks.

I would have preferred you didn't. Since now I have to get this all fixed up as well.

Is this for both of them?

Gustavo

maintainer
#5 lore raw

Re: [PATCH 2/2] Bluetooth: Ignore HCI_Read_Local_Commands failures

Hi Gustavo,

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines

Some 1.2 controllers will fail the HCI_Read_Local_Commands HCI command even though (according to the specification) they should support it. Since this HCI command is part of the controller init sequence controllers broken in this manner would be unusable. Since not having the list of supported commands is not critical for these controllers it is better to just ignore failures in this case (additionally, this is also how older kernels used to behave).

---
 net/bluetooth/hci_event.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Both patches have been applied, thanks.

I would have preferred you didn't. Since now I have to get this all fixed up as well.

Is this for both of them?

yes, we need to stop hacking around here and once and for all solve this properly.

Regards

Marcel