From 932f5ff5e32bf520eb9287b050c926faa6e76bcf Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 22 Feb 2012 22:11:32 +0200 Subject: Bluetooth: mgmt: Allow class of device changes while powered off This patch makes it possible to set the class when powered off. When powering on the right class of device value will be automatically writen to the controller. Signed-off-by: Johan Hedberg Acked-by: Marcel Holtmann --- net/bluetooth/mgmt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'net/bluetooth/mgmt.c') diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 3a2066504ffe..a45c2b70dfdb 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -1456,15 +1456,15 @@ static int set_dev_class(struct sock *sk, u16 index, void *data, u16 len) hci_dev_lock(hdev); + hdev->major_class = cp->major; + hdev->minor_class = cp->minor; + if (!hdev_is_powered(hdev)) { - err = cmd_status(sk, index, MGMT_OP_SET_DEV_CLASS, - MGMT_STATUS_NOT_POWERED); + err = cmd_complete(sk, index, MGMT_OP_SET_DEV_CLASS, 0, + hdev->dev_class, 3); goto unlock; } - hdev->major_class = cp->major; - hdev->minor_class = cp->minor; - if (test_and_clear_bit(HCI_SERVICE_CACHE, &hdev->dev_flags)) { hci_dev_unlock(hdev); cancel_delayed_work_sync(&hdev->service_cache); -- cgit v1.2.3