diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2015-03-18 19:15:07 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2015-03-20 08:05:27 -0400 |
commit | e7844ee599c3eb944c3bd0092d715ca86e76a1f3 (patch) | |
tree | d0412bef54c2f6f38ec7e561871304afd4423280 /net/bluetooth | |
parent | ea6edfbcefec1fcfdb826a1d5a054f402dfbfb24 (diff) |
Bluetooth: Gracefully response to enabling LE on LE only devices
Currently the enabling of LE on LE only devices causes an error. This
is a bit difference from other commands where trying to set the same
existing settings causes a positive response. Fix this behavior for
this single corner case.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/mgmt.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index f3a957905193..cee9bc9735af 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -2209,10 +2209,22 @@ static int set_le(struct sock *sk, struct hci_dev *hdev, void *data, u16 len) | |||
2209 | return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LE, | 2209 | return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LE, |
2210 | MGMT_STATUS_INVALID_PARAMS); | 2210 | MGMT_STATUS_INVALID_PARAMS); |
2211 | 2211 | ||
2212 | /* LE-only devices do not allow toggling LE on/off */ | 2212 | /* Bluetooth single mode LE only controllers or dual-mode |
2213 | if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) | 2213 | * controllers configured as LE only devices, do not allow |
2214 | * switching LE off. These have either LE enabled explicitly | ||
2215 | * or BR/EDR has been previously switched off. | ||
2216 | * | ||
2217 | * When trying to enable an already enabled LE, then gracefully | ||
2218 | * send a positive response. Trying to disable it however will | ||
2219 | * result into rejection. | ||
2220 | */ | ||
2221 | if (!hci_dev_test_flag(hdev, HCI_BREDR_ENABLED)) { | ||
2222 | if (cp->val == 0x01) | ||
2223 | return send_settings_rsp(sk, MGMT_OP_SET_LE, hdev); | ||
2224 | |||
2214 | return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LE, | 2225 | return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_LE, |
2215 | MGMT_STATUS_REJECTED); | 2226 | MGMT_STATUS_REJECTED); |
2227 | } | ||
2216 | 2228 | ||
2217 | hci_dev_lock(hdev); | 2229 | hci_dev_lock(hdev); |
2218 | 2230 | ||