Bluetooth: Management API changes in Bluetooth to update remote Class.

When connection initiated from the remote device the class of device
information is required to be updated to userspace through this
event.

Change-Id: I97d715a0b80e12d414ecf03d099955c8b12c82b4
Signed-off-by: Srinivas Krovvidi <skrovvid@codeaurora.org>
This commit is contained in:
Srinivas Krovvidi
2011-12-20 12:06:34 +05:30
parent ee770a365b
commit 0916aed523
4 changed files with 19 additions and 0 deletions

View File

@@ -1041,6 +1041,7 @@ int mgmt_encrypt_change(u16 index, bdaddr_t *bdaddr, u8 status);
/* LE SMP Management interface */
int le_user_confirm_reply(struct hci_conn *conn, u16 mgmt_op, void *cp);
int mgmt_remote_class(u16 index, bdaddr_t *bdaddr, u8 dev_class[3]);
/* HCI info for socket */
#define hci_pi(sk) ((struct hci_pinfo *) sk)

View File

@@ -342,3 +342,8 @@ struct mgmt_ev_encrypt_change {
} __packed;
#define MGMT_EV_REMOTE_CLASS 0x0017
struct mgmt_ev_remote_class {
bdaddr_t bdaddr;
__u8 dev_class[3];
} __packed;

View File

@@ -1678,6 +1678,8 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk
}
memcpy(conn->dev_class, ev->dev_class, 3);
/* For incoming connection update remote class to userspace */
mgmt_remote_class(hdev->id, &ev->bdaddr, ev->dev_class);
conn->state = BT_CONNECT;
hci_dev_unlock(hdev);

View File

@@ -2905,3 +2905,14 @@ int mgmt_encrypt_change(u16 index, bdaddr_t *bdaddr, u8 status)
NULL);
}
int mgmt_remote_class(u16 index, bdaddr_t *bdaddr, u8 dev_class[3])
{
struct mgmt_ev_remote_class ev;
memset(&ev, 0, sizeof(ev));
bacpy(&ev.bdaddr, bdaddr);
memcpy(ev.dev_class, dev_class, 3);
return mgmt_event(MGMT_EV_REMOTE_CLASS, index, &ev, sizeof(ev), NULL);
}