提交 ced85549 编写于 作者: M Marcel Holtmann 提交者: Johan Hedberg

Bluetooth: Add support for extended index management events

This introduces support for using Extended Index Added and Extended
Index Removed events. These events contain the controller type and
also the hardware bus information from the driver.
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
上级 f9207338
...@@ -183,6 +183,7 @@ enum { ...@@ -183,6 +183,7 @@ enum {
enum { enum {
HCI_MGMT_INDEX_EVENTS, HCI_MGMT_INDEX_EVENTS,
HCI_MGMT_UNCONF_INDEX_EVENTS, HCI_MGMT_UNCONF_INDEX_EVENTS,
HCI_MGMT_EXT_INDEX_EVENTS,
}; };
/* /*
......
...@@ -692,3 +692,12 @@ struct mgmt_ev_new_conn_param { ...@@ -692,3 +692,12 @@ struct mgmt_ev_new_conn_param {
#define MGMT_EV_UNCONF_INDEX_REMOVED 0x001e #define MGMT_EV_UNCONF_INDEX_REMOVED 0x001e
#define MGMT_EV_NEW_CONFIG_OPTIONS 0x001f #define MGMT_EV_NEW_CONFIG_OPTIONS 0x001f
struct mgmt_ev_ext_index {
__u8 type;
__u8 bus;
} __packed;
#define MGMT_EV_EXT_INDEX_ADDED 0x0020
#define MGMT_EV_EXT_INDEX_REMOVED 0x0021
...@@ -128,6 +128,8 @@ static const u16 mgmt_events[] = { ...@@ -128,6 +128,8 @@ static const u16 mgmt_events[] = {
MGMT_EV_UNCONF_INDEX_ADDED, MGMT_EV_UNCONF_INDEX_ADDED,
MGMT_EV_UNCONF_INDEX_REMOVED, MGMT_EV_UNCONF_INDEX_REMOVED,
MGMT_EV_NEW_CONFIG_OPTIONS, MGMT_EV_NEW_CONFIG_OPTIONS,
MGMT_EV_EXT_INDEX_ADDED,
MGMT_EV_EXT_INDEX_REMOVED,
}; };
#define CACHE_TIMEOUT msecs_to_jiffies(2 * 1000) #define CACHE_TIMEOUT msecs_to_jiffies(2 * 1000)
...@@ -6370,6 +6372,7 @@ int mgmt_control(struct hci_mgmt_chan *chan, struct sock *sk, ...@@ -6370,6 +6372,7 @@ int mgmt_control(struct hci_mgmt_chan *chan, struct sock *sk,
void mgmt_index_added(struct hci_dev *hdev) void mgmt_index_added(struct hci_dev *hdev)
{ {
struct mgmt_ev_ext_index ev;
if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks))
return; return;
...@@ -6379,16 +6382,29 @@ void mgmt_index_added(struct hci_dev *hdev) ...@@ -6379,16 +6382,29 @@ void mgmt_index_added(struct hci_dev *hdev)
if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) { if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) {
mgmt_index_event(MGMT_EV_UNCONF_INDEX_ADDED, hdev, mgmt_index_event(MGMT_EV_UNCONF_INDEX_ADDED, hdev,
NULL, 0, HCI_MGMT_UNCONF_INDEX_EVENTS); NULL, 0, HCI_MGMT_UNCONF_INDEX_EVENTS);
ev.type = 0x01;
} else { } else {
mgmt_index_event(MGMT_EV_INDEX_ADDED, hdev, NULL, 0, mgmt_index_event(MGMT_EV_INDEX_ADDED, hdev, NULL, 0,
HCI_MGMT_INDEX_EVENTS); HCI_MGMT_INDEX_EVENTS);
ev.type = 0x00;
} }
break; break;
case HCI_AMP:
ev.type = 0x02;
break;
default:
return;
} }
ev.bus = hdev->bus;
mgmt_index_event(MGMT_EV_EXT_INDEX_ADDED, hdev, &ev, sizeof(ev),
HCI_MGMT_EXT_INDEX_EVENTS);
} }
void mgmt_index_removed(struct hci_dev *hdev) void mgmt_index_removed(struct hci_dev *hdev)
{ {
struct mgmt_ev_ext_index ev;
u8 status = MGMT_STATUS_INVALID_INDEX; u8 status = MGMT_STATUS_INVALID_INDEX;
if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks))
...@@ -6401,12 +6417,24 @@ void mgmt_index_removed(struct hci_dev *hdev) ...@@ -6401,12 +6417,24 @@ void mgmt_index_removed(struct hci_dev *hdev)
if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) { if (hci_dev_test_flag(hdev, HCI_UNCONFIGURED)) {
mgmt_index_event(MGMT_EV_UNCONF_INDEX_REMOVED, hdev, mgmt_index_event(MGMT_EV_UNCONF_INDEX_REMOVED, hdev,
NULL, 0, HCI_MGMT_UNCONF_INDEX_EVENTS); NULL, 0, HCI_MGMT_UNCONF_INDEX_EVENTS);
ev.type = 0x01;
} else { } else {
mgmt_index_event(MGMT_EV_INDEX_REMOVED, hdev, NULL, 0, mgmt_index_event(MGMT_EV_INDEX_REMOVED, hdev, NULL, 0,
HCI_MGMT_INDEX_EVENTS); HCI_MGMT_INDEX_EVENTS);
ev.type = 0x00;
} }
break; break;
case HCI_AMP:
ev.type = 0x02;
break;
default:
return;
} }
ev.bus = hdev->bus;
mgmt_index_event(MGMT_EV_EXT_INDEX_REMOVED, hdev, &ev, sizeof(ev),
HCI_MGMT_EXT_INDEX_EVENTS);
} }
/* This function requires the caller holds hdev->lock */ /* This function requires the caller holds hdev->lock */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册