aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2012-02-22 12:38:01 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-23 06:07:00 -0500
commit7f9a903c57bb42b9f7ad8fb7867859d3252229ab (patch)
treecea86dd5bd33b78387a0b888a4ed789346824002
parent955638ecec9431788e291fc99f34c42124071abe (diff)
Bluetooth: Send management event for class of device changes
Currently there are no events to other management sockets if the class of device got changed. So make sure they are sent. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
-rw-r--r--include/net/bluetooth/hci_core.h2
-rw-r--r--net/bluetooth/hci_event.c13
-rw-r--r--net/bluetooth/mgmt.c10
3 files changed, 21 insertions, 4 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index abdaa7900edb..24dd770d442b 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -1007,6 +1007,8 @@ int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1007 u8 addr_type, u8 status); 1007 u8 addr_type, u8 status);
1008int mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status); 1008int mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status);
1009int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); 1009int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
1010int mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class,
1011 u8 status);
1010int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); 1012int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status);
1011int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash, 1013int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash,
1012 u8 *randomizer, u8 status); 1014 u8 *randomizer, u8 status);
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index e44e3fd68628..c79ffb955554 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -350,14 +350,19 @@ static void hci_cc_write_class_of_dev(struct hci_dev *hdev, struct sk_buff *skb)
350 350
351 BT_DBG("%s status 0x%x", hdev->name, status); 351 BT_DBG("%s status 0x%x", hdev->name, status);
352 352
353 if (status)
354 return;
355
356 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_CLASS_OF_DEV); 353 sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_CLASS_OF_DEV);
357 if (!sent) 354 if (!sent)
358 return; 355 return;
359 356
360 memcpy(hdev->dev_class, sent, 3); 357 hci_dev_lock(hdev);
358
359 if (status == 0)
360 memcpy(hdev->dev_class, sent, 3);
361
362 if (test_bit(HCI_MGMT, &hdev->dev_flags))
363 mgmt_set_class_of_dev_complete(hdev, sent, status);
364
365 hci_dev_unlock(hdev);
361} 366}
362 367
363static void hci_cc_read_voice_setting(struct hci_dev *hdev, struct sk_buff *skb) 368static void hci_cc_read_voice_setting(struct hci_dev *hdev, struct sk_buff *skb)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index f7e111f30434..16bddd22713f 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3546,6 +3546,16 @@ int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status)
3546 return err; 3546 return err;
3547} 3547}
3548 3548
3549int mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class,
3550 u8 status)
3551{
3552 int err;
3553
3554 err = mgmt_event(MGMT_EV_CLASS_OF_DEV_CHANGED, hdev, dev_class, 3, NULL);
3555
3556 return err;
3557}
3558
3549int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status) 3559int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status)
3550{ 3560{
3551 struct pending_cmd *cmd; 3561 struct pending_cmd *cmd;