Commit e131d74a authored by Marcel Holtmann's avatar Marcel Holtmann

Bluetooth: Add support setup stage internal notification event

Before the vendor specific setup stage is triggered call back into the
core to trigger an internal notification event. That event is used to
send an index update to the monitor interface. With that specific event
it is possible to update userspace with manufacturer information before
any HCI command has been executed. This is useful for early stage
debugging of vendor specific initialization sequences.
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent 18e0afab
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#define HCI_DEV_RESUME 6 #define HCI_DEV_RESUME 6
#define HCI_DEV_OPEN 7 #define HCI_DEV_OPEN 7
#define HCI_DEV_CLOSE 8 #define HCI_DEV_CLOSE 8
#define HCI_DEV_SETUP 9
/* HCI notify events */ /* HCI notify events */
#define HCI_NOTIFY_CONN_ADD 1 #define HCI_NOTIFY_CONN_ADD 1
......
...@@ -1461,6 +1461,8 @@ static int hci_dev_do_open(struct hci_dev *hdev) ...@@ -1461,6 +1461,8 @@ static int hci_dev_do_open(struct hci_dev *hdev)
set_bit(HCI_INIT, &hdev->flags); set_bit(HCI_INIT, &hdev->flags);
if (hci_dev_test_flag(hdev, HCI_SETUP)) { if (hci_dev_test_flag(hdev, HCI_SETUP)) {
hci_sock_dev_event(hdev, HCI_DEV_SETUP);
if (hdev->setup) if (hdev->setup)
ret = hdev->setup(hdev); ret = hdev->setup(hdev);
......
...@@ -335,6 +335,12 @@ static struct sk_buff *create_monitor_event(struct hci_dev *hdev, int event) ...@@ -335,6 +335,12 @@ static struct sk_buff *create_monitor_event(struct hci_dev *hdev, int event)
opcode = cpu_to_le16(HCI_MON_DEL_INDEX); opcode = cpu_to_le16(HCI_MON_DEL_INDEX);
break; break;
case HCI_DEV_SETUP:
if (hdev->manufacturer == 0xffff)
return NULL;
/* fall through */
case HCI_DEV_UP: case HCI_DEV_UP:
skb = bt_skb_alloc(HCI_MON_INDEX_INFO_SIZE, GFP_ATOMIC); skb = bt_skb_alloc(HCI_MON_INDEX_INFO_SIZE, GFP_ATOMIC);
if (!skb) if (!skb)
...@@ -403,15 +409,17 @@ static void send_monitor_replay(struct sock *sk) ...@@ -403,15 +409,17 @@ static void send_monitor_replay(struct sock *sk)
if (sock_queue_rcv_skb(sk, skb)) if (sock_queue_rcv_skb(sk, skb))
kfree_skb(skb); kfree_skb(skb);
if (!test_bit(HCI_UP, &hdev->flags)) if (test_bit(HCI_UP, &hdev->flags))
continue; skb = create_monitor_event(hdev, HCI_DEV_UP);
else if (hci_dev_test_flag(hdev, HCI_SETUP))
skb = create_monitor_event(hdev, HCI_DEV_UP); skb = create_monitor_event(hdev, HCI_DEV_SETUP);
if (!skb) else
continue; skb = NULL;
if (sock_queue_rcv_skb(sk, skb)) if (skb) {
kfree_skb(skb); if (sock_queue_rcv_skb(sk, skb))
kfree_skb(skb);
}
} }
read_unlock(&hci_dev_list_lock); read_unlock(&hci_dev_list_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment