Hi Sonny, > Could you take another look at my last proposal based on your > suggestion? If we are to move the logic inside hci_cc_inquiry_cancel, > we will need a way to update the status to the caller, for example by > having hci_cc_inquiry_cancel return a value, or accept a pointer for > the updated status value. Let me know which way you prefer. maybe something like this (missing comment of course): --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -42,14 +42,20 @@ /* Handle HCI Event packets */ -static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb) +static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb, + u8 *new_status) { __u8 status = *((__u8 *) skb->data); BT_DBG("%s status 0x%2.2x", hdev->name, status); - if (status) + if (status) { + if (!test_bit(HCI_INQUIRY, &hdev->flags) && status == 0x0c) { + BT_DBG("Ignoring error of HCI Inquiry Cancel command"); + *new_status = 0x00; + } return; + } clear_bit(HCI_INQUIRY, &hdev->flags); smp_mb__after_atomic(); /* wake_up_bit advises about this barrier */ @@ -3233,7 +3239,7 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb, switch (*opcode) { case HCI_OP_INQUIRY_CANCEL: - hci_cc_inquiry_cancel(hdev, skb); + hci_cc_inquiry_cancel(hdev, skb, status); break; case HCI_OP_PERIODIC_INQ: Regards Marcel