From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 17:19:00 +0200 Message-Id: <1321888740-15598-2-git-send-email-johan.hedberg@gmail.com> In-Reply-To: <1321888740-15598-1-git-send-email-johan.hedberg@gmail.com> References: <1321888740-15598-1-git-send-email-johan.hedberg@gmail.com> Sender: linux-bluetooth-owner@vger.kernel.org List-ID: From: Johan Hedberg 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 --- net/bluetooth/hci_core.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 9218888..1719257 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -106,6 +106,13 @@ void hci_req_complete(struct hci_dev *hdev, __u16 cmd, int result) if (test_bit(HCI_INIT, &hdev->flags) && hdev->init_last_cmd != cmd) 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 */ + if (cmd == HCI_OP_READ_LOCAL_COMMANDS && result != 0) + result = 0; + if (hdev->req_status == HCI_REQ_PEND) { hdev->req_result = result; hdev->req_status = HCI_REQ_DONE; -- 1.7.7.3