Bluetooth: Implement advertising reports cache
Subsystems (2)
RFC 2/5 Bluetooth: Implement advertising reports cache
From: Andre Guedes <[email protected]>
This patch implements a list to store the advertising reports and bdaddr types from LE devices.
Signed-off-by Andre Guedes <[email protected]>
--- include/net/bluetooth/hci_core.h | 11 +++++++ net/bluetooth/hci_core.c | 58 ++++++++++++++++++++++++++++++++++++++ net/bluetooth/hci_event.c | 2 + 3 files changed, 71 insertions(+), 0 deletions(-)
include/net/bluetooth/hci_core.h +11 -0
@@ -82,6 +82,12 @@ struct link_key {u8 pin_len; }; +struct adv_entry { +struct list_head list; +bdaddr_t bdaddr; +u8 bdaddr_type; +}; +#define NUM_REASSEMBLY 4struct hci_dev {struct list_head list;
@@ -171,6 +177,8 @@ struct hci_dev {struct list_head link_keys; +struct list_head adv_list; +struct hci_dev_stats stat;struct sk_buff_head driver_init;
@@ -504,6 +512,9 @@ int hci_add_link_key(struct hci_dev *hdev, int new_key, bdaddr_t *bdaddr, u8 *key, u8 type, u8 pin_len);int hci_remove_link_key (struct hci_dev *hdev,bdaddr_t *bdaddr); +struct adv_entry *hci_find_adv_entry (struct hci_dev *hdev,bdaddr_t *bdaddr); +int hci_add_adv_entry (struct hci_dev *hdev,bdaddr_t *bdaddr,u8 bdaddr_type); +void hci_del_off_timer (struct hci_dev *hdev);void hci_event_packet (struct hci_dev *hdev,struct sk_buff *skb);
net/bluetooth/hci_core.c +58 -0
76 lines not on this page · raw message
net/bluetooth/hci_event.c +2 -0
@@ -2507,12 +2507,14 @@ static inline void hci_le_adv_report_evt(struct hci_dev *hdev, num_reports = (u8 ) skb->data[0 ]; ev = (struct hci_ev_le_advertising_info *) (skb->data +1 ); +hci_add_adv_entry (hdev, &ev->bdaddr, ev->bdaddr_type);BT_DBG ("adv from: %s" ,batostr (&ev->bdaddr));for (i =1 ; i < num_reports; i++) { ev = (struct hci_ev_le_advertising_info *) (ev->data + ev->length +1 ); +hci_add_adv_entry (hdev, &ev->bdaddr, ev->bdaddr_type);BT_DBG ("adv from: %s" ,batostr (&ev->bdaddr)); } }
Signature · 1 line
1.7.1