From: johan.hedberg@gmail.com
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 2/2] Bluetooth: Ignore HCI_Read_Local_Commands failures
Date: Mon, 21 Nov 2011 20:01:24 +0200 [thread overview]
Message-ID: <1321898484-17952-2-git-send-email-johan.hedberg@gmail.com> (raw)
In-Reply-To: <1321898484-17952-1-git-send-email-johan.hedberg@gmail.com>
From: Johan Hedberg <johan.hedberg@intel.com>
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).
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
net/bluetooth/hci_event.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index af24b3d..e950865 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -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)
--
1.7.7.3
next prev parent reply other threads:[~2011-11-21 18:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-21 18:01 [PATCH 1/2] Bluetooth: Fix request completion for command status events johan.hedberg
2011-11-21 18:01 ` johan.hedberg [this message]
2011-12-01 12:40 ` [PATCH 2/2] Bluetooth: Ignore HCI_Read_Local_Commands failures Gustavo Padovan
2011-12-01 13:09 ` Marcel Holtmann
2011-12-02 0:02 ` Gustavo Padovan
2011-12-02 15:26 ` Marcel Holtmann
-- strict thread matches above, loose matches on Subject: below --
2011-11-21 15:18 [PATCH 1/2] Bluetooth: Fix request completion for command status events johan.hedberg
2011-11-21 15:19 ` [PATCH 2/2] Bluetooth: Ignore HCI_Read_Local_Commands failures johan.hedberg
2011-11-21 16:44 ` Marcel Holtmann
2011-11-21 18:04 ` Johan Hedberg
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=1321898484-17952-2-git-send-email-johan.hedberg@gmail.com \
--to=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.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).