Bluetooth: Add support for Unconfigured Index Removed events
authorMarcel Holtmann <marcel@holtmann.org>
Wed, 2 Jul 2014 19:30:55 +0000 (21:30 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 3 Jul 2014 15:42:58 +0000 (17:42 +0200)
When a controller in an unconfigured state gets removed, then send
Unconfigured Index Removed events.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
include/net/bluetooth/mgmt.h
net/bluetooth/mgmt.c

index 7da29fd748d8718dcdb79ae40a277d7609a58779..651993213bd92e0be180e1e206e9b3a1c120ec6c 100644 (file)
@@ -642,3 +642,5 @@ struct mgmt_ev_new_conn_param {
 } __packed;
 
 #define MGMT_EV_UNCONF_INDEX_ADDED     0x001d
+
+#define MGMT_EV_UNCONF_INDEX_REMOVED   0x001e
index ab70d5858db9932819afcb9b94ad45783bef907e..1a78d26b00498da685614823719e3431bfb4ba89 100644 (file)
@@ -119,6 +119,7 @@ static const u16 mgmt_events[] = {
        MGMT_EV_DEVICE_REMOVED,
        MGMT_EV_NEW_CONN_PARAM,
        MGMT_EV_UNCONF_INDEX_ADDED,
+       MGMT_EV_UNCONF_INDEX_REMOVED,
 };
 
 #define CACHE_TIMEOUT  msecs_to_jiffies(2 * 1000)
@@ -5395,7 +5396,10 @@ void mgmt_index_removed(struct hci_dev *hdev)
 
        mgmt_pending_foreach(0, hdev, cmd_status_rsp, &status);
 
-       mgmt_event(MGMT_EV_INDEX_REMOVED, hdev, NULL, 0, NULL);
+       if (test_bit(HCI_UNCONFIGURED, &hdev->dev_flags))
+               mgmt_event(MGMT_EV_UNCONF_INDEX_REMOVED, hdev, NULL, 0, NULL);
+       else
+               mgmt_event(MGMT_EV_INDEX_REMOVED, hdev, NULL, 0, NULL);
 }
 
 /* This function requires the caller holds hdev->lock */