Bluetooth: mgmt: Fix Set SSP supported check
Subsystems (2)
PATCH 1/2 Bluetooth: mgmt: Fix Set SSP supported check
From: Johan Hedberg <[email protected]>
The test for SSP support needs to be earlier in the set_ssp function so that we return an error when SSP is not supported even when the device is powered off.
--- net/bluetooth/mgmt.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
net/bluetooth/mgmt.c +6 -6
@@ -1141,6 +1141,12 @@ static int set_ssp(struct sock *sk, u16 index, void *data, u16 len)hci_dev_lock (hdev); +if (!(hdev->features[6 ] &LMP_SIMPLE_PAIR )) { + err =cmd_status (sk, index,MGMT_OP_SET_SSP , +MGMT_STATUS_NOT_SUPPORTED ); + goto failed; + } + val = !!cp->val;if (!hdev_is_powered (hdev)) {
@@ -1161,12 +1167,6 @@ static int set_ssp(struct sock *sk, u16 index, void *data, u16 len) goto failed; } -if (!(hdev->features[6 ] &LMP_SIMPLE_PAIR )) { - err =cmd_status (sk, index,MGMT_OP_SET_SSP , -MGMT_STATUS_NOT_SUPPORTED ); - goto failed; - } -if (mgmt_pending_find (MGMT_OP_SET_SSP , hdev)) { err =cmd_status (sk, index,MGMT_OP_SET_SSP ,MGMT_STATUS_BUSY ); goto failed;
Signature · 1 line
1.7.9
PATCH 2/2 Bluetooth: mgmt: Implement Set LE command
From: Johan Hedberg <[email protected]>
This patch implements support for the Set LE mgmt command. Now, in addition to the enable_le module parameter user space needs to send an explicit Enable LE command to enable LE support.
--- include/net/bluetooth/hci.h | 1 + include/net/bluetooth/hci_core.h | 1 + net/bluetooth/hci_event.c | 7 ++- net/bluetooth/mgmt.c | 119 +++++++++++++++++++++++++++++++++++++- 4 files changed, 126 insertions(+), 2 deletions(-)
include/net/bluetooth/hci.h +1 -0
@@ -96,6 +96,7 @@ enum {HCI_LE_SCAN ,HCI_SSP_ENABLED ,HCI_HS_ENABLED , +HCI_LE_ENABLED ,HCI_CONNECTABLE ,HCI_DISCOVERABLE , HCI_LINK_SECURITY,
include/net/bluetooth/hci_core.h +1 -0
@@ -1010,6 +1010,7 @@ int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);int mgmt_set_local_name_complete (struct hci_dev *hdev,u8 *name,u8 status);int mgmt_read_local_oob_data_reply_complete (struct hci_dev *hdev,u8 *hash,u8 *randomizer,u8 status); +int mgmt_le_enable_complete (struct hci_dev *hdev,u8 enable,u8 status);int mgmt_device_found (struct hci_dev *hdev,bdaddr_t *bdaddr,u8 link_type,u8 addr_type,u8 *dev_class,s8 rssi,u8 cfm_name,u8 *eir,u16 eir_len);
net/bluetooth/hci_event.c +6 -1
@@ -539,7 +539,7 @@ static void hci_set_le_support(struct hci_dev *hdev)memset (&cp,0 ,sizeof (cp)); -if (enable_le) { +if (enable_le &&test_bit (HCI_LE_ENABLED , &hdev->dev_flags)) { cp.le =1 ; cp.simul = !!(hdev->features[6 ] &LMP_SIMUL_LE_BR ); }
@@ -1130,10 +1130,15 @@ static inline void hci_cc_write_le_host_supported(struct hci_dev *hdev, struct sk_buff *skb) {struct hci_cp_read_local_ext_features cp; +struct hci_cp_write_le_host_supported *sent;__u8 status = *((__u8 *) skb->data);BT_DBG ("%s status 0x%x" , hdev->name, status); + sent =hci_sent_cmd_data (hdev,HCI_OP_WRITE_LE_HOST_SUPPORTED ); +if (sent &&test_bit (HCI_MGMT , &hdev->dev_flags)) +mgmt_le_enable_complete (hdev, sent->le, status); +if (status)return ;
net/bluetooth/mgmt.c +118 -1
143 lines not on this page · raw message
Signature · 1 line
1.7.9
Re: [PATCH 2/2] Bluetooth: mgmt: Implement Set LE command
Hi Johan,
Quoted 11 lines
This patch implements support for the Set LE mgmt command. Now, in addition to the
enable_lemodule parameter user space needs to send an explicit Enable LE command to enable LE support.Signed-off-by Johan Hedberg <[email protected]>--- include/net/bluetooth/hci.h | 1 + include/net/bluetooth/hci_core.h | 1 + net/bluetooth/hci_event.c | 7 ++- net/bluetooth/mgmt.c | 119 +++++++++++++++++++++++++++++++++++++- 4 files changed, 126 insertions(+), 2 deletions(-)
Regards
Marcel
Hi Johan,
Quoted 8 lines
The test for SSP support needs to be earlier in the
set_sspfunction so that we return an error when SSP is not supported even when the device is powered off.Signed-off-by Johan Hedberg <[email protected]>--- net/bluetooth/mgmt.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
Regards
Marcel