Commit e6348be6 authored by Marcel Holtmann's avatar Marcel Holtmann

[Bluetooth] Support inquiry results with RSSI

The Bluetooth 1.2 specification defines a new event for returning
inquiry results. This patch converts this event into the standard
event and add its information to the inquiry cache.
parent 8a0de5ab
...@@ -408,6 +408,16 @@ struct inquiry_info { ...@@ -408,6 +408,16 @@ struct inquiry_info {
__u16 clock_offset; __u16 clock_offset;
} __attribute__ ((packed)); } __attribute__ ((packed));
#define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22
struct inquiry_info_with_rssi {
bdaddr_t bdaddr;
__u8 pscan_rep_mode;
__u8 pscan_period_mode;
__u8 dev_class[3];
__u16 clock_offset;
__u8 rssi;
} __attribute__ ((packed));
#define HCI_EV_CONN_COMPLETE 0x03 #define HCI_EV_CONN_COMPLETE 0x03
struct hci_ev_conn_complete { struct hci_ev_conn_complete {
__u8 status; __u8 status;
......
...@@ -452,6 +452,29 @@ static inline void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff * ...@@ -452,6 +452,29 @@ static inline void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *
hci_dev_unlock(hdev); hci_dev_unlock(hdev);
} }
/* Inquiry Result With RSSI */
static inline void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, struct sk_buff *skb)
{
struct inquiry_info_with_rssi *info = (struct inquiry_info_with_rssi *) (skb->data + 1);
int num_rsp = *((__u8 *) skb->data);
BT_DBG("%s num_rsp %d", hdev->name, num_rsp);
hci_dev_lock(hdev);
for (; num_rsp; num_rsp--) {
struct inquiry_info tmp;
bacpy(&tmp.bdaddr, &info->bdaddr);
tmp.pscan_rep_mode = info->pscan_rep_mode;
tmp.pscan_period_mode = info->pscan_period_mode;
tmp.pscan_mode = 0x00;
memcpy(tmp.dev_class, &info->dev_class, 3);
tmp.clock_offset = info->clock_offset;
info++;
inquiry_cache_update(hdev, &tmp);
}
hci_dev_unlock(hdev);
}
/* Connect Request */ /* Connect Request */
static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb) static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
{ {
...@@ -744,6 +767,10 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb) ...@@ -744,6 +767,10 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
hci_inquiry_result_evt(hdev, skb); hci_inquiry_result_evt(hdev, skb);
break; break;
case HCI_EV_INQUIRY_RESULT_WITH_RSSI:
hci_inquiry_result_with_rssi_evt(hdev, skb);
break;
case HCI_EV_CONN_REQUEST: case HCI_EV_CONN_REQUEST:
hci_conn_request_evt(hdev, skb); hci_conn_request_evt(hdev, skb);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment