This patch adds the handling of the extended inquiry responses and inserts them into the inquiry cache.
Unified · Split
| @@ -463,6 +463,17 @@ struct inquiry_info_with_rssi_and_pscan_mode { · 462 unmodified lines | ||
| 463 | 463 | __s8 rssi; |
| 464 | 464 | } __attribute__ ((packed)); |
| 465 | 465 | |
| 466 | +#define HCI_EV_EXTENDED_INQUIRY_RESULT 0x2F | |
| 467 | +struct 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 | 477 | #define HCI_EV_CONN_COMPLETE 0x03 |
| 467 | 478 | struct hci_ev_conn_complete { |
| 468 | 479 | __u8 status; |
| @@ -558,6 +558,35 @@ static inline void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, struct · 557 unmodified lines | ||
| 558 | 558 | hci_dev_unlock(hdev); |
| 559 | 559 | } |
| 560 | 560 | |
| 561 | +/* Extended Inquiry Result */ | |
| 562 | +static 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 | 590 | /* Connect Request */ |
| 562 | 591 | static 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 | 969 | hci_inquiry_result_with_rssi_evt(hdev, skb); |
| 941 | 970 | break; |
| 942 | 971 | |
| 972 | + case HCI_EV_EXTENDED_INQUIRY_RESULT: | |
| 973 | + hci_extended_inquiry_result_evt(hdev, skb); | |
| 974 | + break; | |
| 975 | + | |
| 943 | 976 | case HCI_EV_CONN_REQUEST: |
| 944 | 977 | hci_conn_request_evt(hdev, skb); |
| 945 | 978 | break; |