From 94a43cc9fdca76c1d7c58d7bdbe5e86ab3ba74e6 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 6 Dec 2004 11:18:04 +0100 Subject: [Bluetooth] Use separate inquiry data structure The inquiry results can return different fields and so create one data structure that has place for every of these. Missing fields are filled with default values. Signed-off-by: Marcel Holtmann --- include/net/bluetooth/hci_core.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 16dec2fe1762..470ba0b2595d 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -38,10 +38,20 @@ extern struct proc_dir_entry *proc_bt_hci; /* HCI Core structures */ +struct inquiry_data { + bdaddr_t bdaddr; + __u8 pscan_rep_mode; + __u8 pscan_period_mode; + __u8 pscan_mode; + __u8 dev_class[3]; + __u16 clock_offset; + __s8 rssi; +}; + struct inquiry_entry { struct inquiry_entry *next; __u32 timestamp; - struct inquiry_info info; + struct inquiry_data data; }; struct inquiry_cache { @@ -199,7 +209,7 @@ static inline long inquiry_entry_age(struct inquiry_entry *e) } struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); -void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_info *info); +void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data); /* ----- HCI Connections ----- */ enum { -- cgit v1.2.3 From a967892c4cc53e8cae58004c62372799b4dd40f3 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Mon, 6 Dec 2004 12:39:53 +0100 Subject: [Bluetooth] Track the class of device value The class of device is only available from an inquiry response or from the connection request. In the case of an incoming connection the value can be taken from the request and stored in the hci_conn structure. For an outgoing connection the value from the inquiry cache is used or it is set to zero. Signed-off-by: Marcel Holtmann --- include/net/bluetooth/hci_core.h | 1 + net/bluetooth/hci_conn.c | 1 + net/bluetooth/hci_event.c | 1 + 3 files changed, 3 insertions(+) (limited to 'include') diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 470ba0b2595d..fe5cc98511ba 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -152,6 +152,7 @@ struct hci_conn { __u16 state; __u8 type; __u8 out; + __u8 dev_class[3]; __u32 link_mode; unsigned long pend; diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 2c45681f5b4d..bacc386111b2 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -74,6 +74,7 @@ void hci_acl_connect(struct hci_conn *conn) cp.pscan_rep_mode = ie->data.pscan_rep_mode; cp.pscan_mode = ie->data.pscan_mode; cp.clock_offset = ie->data.clock_offset | __cpu_to_le16(0x8000); + memcpy(conn->dev_class, ie->data.dev_class, 3); } cp.pkt_type = __cpu_to_le16(hdev->pkt_type & ACL_PTYPE_MASK); diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 31dd788db0b0..e88d18da3b4f 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -555,6 +555,7 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk return; } } + memcpy(conn->dev_class, ev->dev_class, 3); conn->state = BT_CONNECT; hci_dev_unlock(hdev); -- cgit v1.2.3