aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_event.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-02-22 14:06:55 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-23 06:07:00 -0500
commit28cc7bde5978cbc58c9026123fa5f33b62ad66b3 (patch)
treeb50261ffeb89292456e02c817c2af8c07a351fa9 /net/bluetooth/hci_event.c
parentdb99b5fc77e6cec47d80703b471f1efe04527d2f (diff)
Bluetooth: mgmt: Allow local name changes while powered off
This patch makes it possible to set the local name before powering on the device. The name will be applied using the hci_write_local_name command once the device gets powered on. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r--net/bluetooth/hci_event.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 9917fe3d1d18..9b30587c0de6 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -209,11 +209,10 @@ static void hci_cc_write_local_name(struct hci_dev *hdev, struct sk_buff *skb)
209 209
210 hci_dev_lock(hdev); 210 hci_dev_lock(hdev);
211 211
212 if (status == 0)
213 memcpy(hdev->dev_name, sent, HCI_MAX_NAME_LENGTH);
214
215 if (test_bit(HCI_MGMT, &hdev->dev_flags)) 212 if (test_bit(HCI_MGMT, &hdev->dev_flags))
216 mgmt_set_local_name_complete(hdev, sent, status); 213 mgmt_set_local_name_complete(hdev, sent, status);
214 else if (!status)
215 memcpy(hdev->dev_name, sent, HCI_MAX_NAME_LENGTH);
217 216
218 hci_dev_unlock(hdev); 217 hci_dev_unlock(hdev);
219} 218}
@@ -563,6 +562,14 @@ static void hci_setup(struct hci_dev *hdev)
563 if (hdev->hci_ver > BLUETOOTH_VER_1_1) 562 if (hdev->hci_ver > BLUETOOTH_VER_1_1)
564 hci_send_cmd(hdev, HCI_OP_READ_LOCAL_COMMANDS, 0, NULL); 563 hci_send_cmd(hdev, HCI_OP_READ_LOCAL_COMMANDS, 0, NULL);
565 564
565 if (!test_bit(HCI_SETUP, &hdev->dev_flags) &&
566 test_bit(HCI_MGMT, &hdev->dev_flags)) {
567 struct hci_cp_write_local_name cp;
568
569 memcpy(cp.name, hdev->dev_name, sizeof(cp.name));
570 hci_send_cmd(hdev, HCI_OP_WRITE_LOCAL_NAME, sizeof(cp), &cp);
571 }
572
566 if (hdev->features[6] & LMP_SIMPLE_PAIR) { 573 if (hdev->features[6] & LMP_SIMPLE_PAIR) {
567 if (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags)) { 574 if (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags)) {
568 u8 mode = 0x01; 575 u8 mode = 0x01;