Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Bluetooth: Add support for LE PHY Update Complete event

This handles LE PHY Update Complete event and store both tx_phy and
rx_phy into hci_conn.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>

authored by

Luiz Augusto von Dentz and committed by
Marcel Holtmann
1efd927d d841502c

+37
+8
include/net/bluetooth/hci.h
··· 2186 2186 __s8 rssi; 2187 2187 } __packed; 2188 2188 2189 + #define HCI_EV_LE_PHY_UPDATE_COMPLETE 0x0c 2190 + struct hci_ev_le_phy_update_complete { 2191 + __u8 status; 2192 + __u16 handle; 2193 + __u8 tx_phy; 2194 + __u8 rx_phy; 2195 + } __packed; 2196 + 2189 2197 #define HCI_EV_LE_EXT_ADV_REPORT 0x0d 2190 2198 struct hci_ev_le_ext_adv_report { 2191 2199 __le16 evt_type;
+2
include/net/bluetooth/hci_core.h
··· 493 493 __u16 le_supv_timeout; 494 494 __u8 le_adv_data[HCI_MAX_AD_LENGTH]; 495 495 __u8 le_adv_data_len; 496 + __u8 le_tx_phy; 497 + __u8 le_rx_phy; 496 498 __s8 rssi; 497 499 __s8 tx_power; 498 500 __s8 max_tx_power;
+27
net/bluetooth/hci_event.c
··· 5718 5718 hci_dev_unlock(hdev); 5719 5719 } 5720 5720 5721 + static void hci_le_phy_update_evt(struct hci_dev *hdev, struct sk_buff *skb) 5722 + { 5723 + struct hci_ev_le_phy_update_complete *ev = (void *) skb->data; 5724 + struct hci_conn *conn; 5725 + 5726 + BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 5727 + 5728 + if (!ev->status) 5729 + return; 5730 + 5731 + hci_dev_lock(hdev); 5732 + 5733 + conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 5734 + if (!conn) 5735 + goto unlock; 5736 + 5737 + conn->le_tx_phy = ev->tx_phy; 5738 + conn->le_rx_phy = ev->rx_phy; 5739 + 5740 + unlock: 5741 + hci_dev_unlock(hdev); 5742 + } 5743 + 5721 5744 static void hci_le_meta_evt(struct hci_dev *hdev, struct sk_buff *skb) 5722 5745 { 5723 5746 struct hci_ev_le_meta *le_ev = (void *) skb->data; ··· 5774 5751 5775 5752 case HCI_EV_LE_DIRECT_ADV_REPORT: 5776 5753 hci_le_direct_adv_report_evt(hdev, skb); 5754 + break; 5755 + 5756 + case HCI_EV_LE_PHY_UPDATE_COMPLETE: 5757 + hci_le_phy_update_evt(hdev, skb); 5777 5758 break; 5778 5759 5779 5760 case HCI_EV_LE_EXT_ADV_REPORT: