Skip to content

Commit c7bdd50

Browse files
committed
[Bluetooth] Update class of device value whenever possible
The class of device value can only be retrieved via inquiry or during an incoming connection request. Outgoing connections can't ask for the class of device. To compensate for this the value is stored and copied via the inquiry cache, but currently only updated via inquiry. This update should also happen during an incoming connection request. Signed-off-by: Marcel Holtmann <[email protected]>
1 parent f383f27 commit c7bdd50

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net/bluetooth/hci_event.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,10 +796,14 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk
796796

797797
if (mask & HCI_LM_ACCEPT) {
798798
/* Connection accepted */
799+
struct inquiry_entry *ie;
799800
struct hci_conn *conn;
800801

801802
hci_dev_lock(hdev);
802803

804+
if ((ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr)))
805+
memcpy(ie->data.dev_class, ev->dev_class, 3);
806+
803807
conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr);
804808
if (!conn) {
805809
if (!(conn = hci_conn_add(hdev, ev->link_type, &ev->bdaddr))) {

0 commit comments

Comments
 (0)