Skip to contentSkip to conversation

Bluetooth: Implement advertising reports cache

RFC Superseded [email protected] 1 participant 1 message Feb 14, 2011

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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.

---
 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
index 5114122..48059a2 100644
@@ -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 4
 struct 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
index 987f5de..0cbc1cf 100644
@@ -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