Skip to content

Commit

Permalink
[Bluetooth] Add support for extended inquiry responses
Browse files Browse the repository at this point in the history
This patch adds the handling of the extended inquiry responses and
inserts them into the inquiry cache.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Marcel Holtmann committed Sep 12, 2005
1 parent 862aad5 commit 21d9e30
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
11 changes: 11 additions & 0 deletions include/net/bluetooth/hci.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,17 @@ struct inquiry_info_with_rssi_and_pscan_mode {
__s8 rssi;
} __attribute__ ((packed));

#define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2F
struct extended_inquiry_info {
bdaddr_t bdaddr;
__u8 pscan_rep_mode;
__u8 pscan_period_mode;
__u8 dev_class[3];
__u16 clock_offset;
__s8 rssi;
__u8 data[240];
} __attribute__ ((packed));

#define HCI_EV_CONN_COMPLETE 0x03
struct hci_ev_conn_complete {
__u8 status;
Expand Down
33 changes: 33 additions & 0 deletions net/bluetooth/hci_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,35 @@ static inline void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, struct
hci_dev_unlock(hdev);
}

/* Extended Inquiry Result */
static inline void hci_extended_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *skb)
{
struct inquiry_data data;
struct extended_inquiry_info *info = (struct extended_inquiry_info *) (skb->data + 1);
int num_rsp = *((__u8 *) skb->data);

BT_DBG("%s num_rsp %d", hdev->name, num_rsp);

if (!num_rsp)
return;

hci_dev_lock(hdev);

for (; num_rsp; num_rsp--) {
bacpy(&data.bdaddr, &info->bdaddr);
data.pscan_rep_mode = info->pscan_rep_mode;
data.pscan_period_mode = info->pscan_period_mode;
data.pscan_mode = 0x00;
memcpy(data.dev_class, info->dev_class, 3);
data.clock_offset = info->clock_offset;
data.rssi = info->rssi;
info++;
hci_inquiry_cache_update(hdev, &data);
}

hci_dev_unlock(hdev);
}

/* Connect Request */
static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
{
Expand Down Expand Up @@ -940,6 +969,10 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
hci_inquiry_result_with_rssi_evt(hdev, skb);
break;

case HCI_EV_EXTENDED_INQUIRY_RESULT:
hci_extended_inquiry_result_evt(hdev, skb);
break;

case HCI_EV_CONN_REQUEST:
hci_conn_request_evt(hdev, skb);
break;
Expand Down

0 comments on commit 21d9e30

Please sign in to comment.