History

[Bluetooth] Add support for extended inquiry responses

This patch adds the handling of the extended inquiry responses and inserts them into the inquiry cache.

Marcel Holtmann committed 21 years ago

Commit 21d9e301 parent 862aad52 files · +44 −0Browse files

Unified · Split

2 files
  1. include/net/bluetooth/hci.h +11 −0
  2. net/bluetooth/hci_event.c +33 −0
include/net/bluetooth/hci.h+11−0
@@ -463,6 +463,17 @@ struct inquiry_info_with_rssi_and_pscan_mode { · 462 unmodified lines
463 __s8 rssi;463 __s8 rssi;
464} __attribute__ ((packed));464} __attribute__ ((packed));
465 465
466#define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2F
467struct extended_inquiry_info {
468 bdaddr_t bdaddr;
469 __u8 pscan_rep_mode;
470 __u8 pscan_period_mode;
471 __u8 dev_class[3];
472 __u16 clock_offset;
473 __s8 rssi;
474 __u8 data[240];
475} __attribute__ ((packed));
476
466#define HCI_EV_CONN_COMPLETE 0x03477#define HCI_EV_CONN_COMPLETE 0x03
467struct hci_ev_conn_complete {478struct hci_ev_conn_complete {
468 __u8 status;479 __u8 status;
net/bluetooth/hci_event.c+33−0
@@ -558,6 +558,35 @@ static inline void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, struct · 557 unmodified lines
558 hci_dev_unlock(hdev);558 hci_dev_unlock(hdev);
559}559}
560 560
561/* Extended Inquiry Result */
562static inline void hci_extended_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *skb)
563{
564 struct inquiry_data data;
565 struct extended_inquiry_info *info = (struct extended_inquiry_info *) (skb->data + 1);
566 int num_rsp = *((__u8 *) skb->data);
567
568 BT_DBG("%s num_rsp %d", hdev->name, num_rsp);
569
570 if (!num_rsp)
571 return;
572
573 hci_dev_lock(hdev);
574
575 for (; num_rsp; num_rsp--) {
576 bacpy(&data.bdaddr, &info->bdaddr);
577 data.pscan_rep_mode = info->pscan_rep_mode;
578 data.pscan_period_mode = info->pscan_period_mode;
579 data.pscan_mode = 0x00;
580 memcpy(data.dev_class, info->dev_class, 3);
581 data.clock_offset = info->clock_offset;
582 data.rssi = info->rssi;
583 info++;
584 hci_inquiry_cache_update(hdev, &data);
585 }
586
587 hci_dev_unlock(hdev);
588}
589
561/* Connect Request */590/* Connect Request */
562static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)591static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
563{592{
@@ -940,6 +969,10 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb) · 376 unmodified lines
940 hci_inquiry_result_with_rssi_evt(hdev, skb);969 hci_inquiry_result_with_rssi_evt(hdev, skb);
941 break;970 break;
942 971
972 case HCI_EV_EXTENDED_INQUIRY_RESULT:
973 hci_extended_inquiry_result_evt(hdev, skb);
974 break;
975
943 case HCI_EV_CONN_REQUEST:976 case HCI_EV_CONN_REQUEST:
944 hci_conn_request_evt(hdev, skb);977 hci_conn_request_evt(hdev, skb);
945 break;978 break;