All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Sonny Sasaka <sonnysasaka@chromium.org>
Cc: BlueZ <linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH] Bluetooth: Handle Inquiry Cancel error after Inquiry Complete
Date: Wed, 6 May 2020 01:42:11 +0200	[thread overview]
Message-ID: <89566A98-F0CE-4E70-A344-915E81FB0C14@holtmann.org> (raw)
In-Reply-To: <CAOxioN=1dP9W=WZ2TM+3RLbVmxBYkcrG0s4HiExihAXQ=0pJJg@mail.gmail.com>

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


  reply	other threads:[~2020-05-05 23:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28  5:11 Sonny Sasaka
2020-04-28  9:47 ` Marcel Holtmann
2020-04-28 17:25   ` Sonny Sasaka
2020-04-30 17:11     ` Sonny Sasaka
2020-05-05 23:42       ` Marcel Holtmann [this message]
2020-05-06 19:55         ` Sonny Sasaka
2020-05-13  7:34           ` Marcel Holtmann
2020-05-13 18:51             ` Sonny Sasaka
2020-05-06 19:57         ` Sonny Sasaka
2020-05-12 19:34           ` Sonny Sasaka

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=89566A98-F0CE-4E70-A344-915E81FB0C14@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=sonnysasaka@chromium.org \
    --subject='Re: [PATCH] Bluetooth: Handle Inquiry Cancel error after Inquiry Complete' \
    /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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.