]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Bluetooth: Add HCI_PERIODIC_INQ to dev_flags
authorAndre Guedes <aguedespe@gmail.com>
Wed, 21 Mar 2012 03:03:36 +0000 (00:03 -0300)
committerGustavo Padovan <gustavo@padovan.org>
Wed, 28 Mar 2012 15:28:52 +0000 (12:28 -0300)
This patch adds the HCI_PERIODIC_INQ flag to dev_flags. This flag
tracks if periodic inquiry is enabled or not.

Signed-off-by: Andre Guedes <aguedespe@gmail.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
include/net/bluetooth/hci.h
net/bluetooth/hci_event.c

index d74645edbcd6a45525eb5872132a1e6bb1cd31e4..38ac0e6185f187cda3f7442f6d83480cba0343ed 100644 (file)
@@ -102,6 +102,7 @@ enum {
        HCI_DISCOVERABLE,
        HCI_LINK_SECURITY,
        HCI_PENDING_CLASS,
+       HCI_PERIODIC_INQ,
 };
 
 /* HCI ioctl defines */
index af0c5a29e995e99ff402d55a6fab6b901ded7114..bffb0c342bd190aa78e008484a499c9e4831ec03 100644 (file)
@@ -75,6 +75,11 @@ static void hci_cc_periodic_inq(struct hci_dev *hdev, struct sk_buff *skb)
        __u8 status = *((__u8 *) skb->data);
 
        BT_DBG("%s status 0x%x", hdev->name, status);
+
+       if (status)
+               return;
+
+       set_bit(HCI_PERIODIC_INQ, &hdev->dev_flags);
 }
 
 static void hci_cc_exit_periodic_inq(struct hci_dev *hdev, struct sk_buff *skb)
@@ -86,6 +91,8 @@ static void hci_cc_exit_periodic_inq(struct hci_dev *hdev, struct sk_buff *skb)
        if (status)
                return;
 
+       clear_bit(HCI_PERIODIC_INQ, &hdev->dev_flags);
+
        hci_conn_check_pending(hdev);
 }
 
@@ -200,7 +207,8 @@ static void hci_cc_reset(struct hci_dev *hdev, struct sk_buff *skb)
        hci_req_complete(hdev, HCI_OP_RESET, status);
 
        /* Reset all non-persistent flags */
-       hdev->dev_flags &= ~(BIT(HCI_LE_SCAN) | BIT(HCI_PENDING_CLASS));
+       hdev->dev_flags &= ~(BIT(HCI_LE_SCAN) | BIT(HCI_PENDING_CLASS) |
+                                                       BIT(HCI_PERIODIC_INQ));
 
        hdev->discovery.state = DISCOVERY_STOPPED;
 }