* [PATCH 2/9] Bluetooth: mgmt: Fix set_local_name and set_dev_class powered checks
2012-02-21 15:59 [PATCH 1/9] Bluetooth: mgmt: Fix powered checks for commands johan.hedberg
@ 2012-02-21 15:59 ` johan.hedberg
2012-02-21 16:09 ` Marcel Holtmann
2012-02-21 15:59 ` [PATCH 3/9] Bluetooth: mgmt: Allow connectable/discoverable changes in off state johan.hedberg
` (7 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: johan.hedberg @ 2012-02-21 15:59 UTC (permalink / raw)
To: linux-bluetooth
From: Johan Hedberg <johan.hedberg@intel.com>
Both the Set Local Name and the Set Device Class commands should fail if
the adapter is not powered on.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
net/bluetooth/mgmt.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index c27481c..03a1384 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1272,6 +1272,12 @@ static int set_dev_class(struct sock *sk, u16 index, void *data, u16 len)
hci_dev_lock(hdev);
+ if (!hdev_is_powered(hdev)) {
+ err = cmd_status(sk, index, MGMT_OP_SET_DEV_CLASS,
+ MGMT_STATUS_NOT_POWERED);
+ goto unlock;
+ }
+
hdev->major_class = cp->major;
hdev->minor_class = cp->minor;
@@ -1288,6 +1294,7 @@ static int set_dev_class(struct sock *sk, u16 index, void *data, u16 len)
err = cmd_complete(sk, index, MGMT_OP_SET_DEV_CLASS, 0,
NULL, 0);
+unlock:
hci_dev_unlock(hdev);
hci_dev_put(hdev);
@@ -2076,6 +2083,12 @@ static int set_local_name(struct sock *sk, u16 index, void *data,
hci_dev_lock(hdev);
+ if (!hdev_is_powered(hdev)) {
+ err = cmd_status(sk, index, MGMT_OP_SET_LOCAL_NAME,
+ MGMT_STATUS_NOT_POWERED);
+ goto failed;
+ }
+
cmd = mgmt_pending_add(sk, MGMT_OP_SET_LOCAL_NAME, hdev, data,
len);
if (!cmd) {
--
1.7.9
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 3/9] Bluetooth: mgmt: Allow connectable/discoverable changes in off state
2012-02-21 15:59 [PATCH 1/9] Bluetooth: mgmt: Fix powered checks for commands johan.hedberg
2012-02-21 15:59 ` [PATCH 2/9] Bluetooth: mgmt: Fix set_local_name and set_dev_class powered checks johan.hedberg
@ 2012-02-21 15:59 ` johan.hedberg
2012-02-21 16:14 ` Marcel Holtmann
2012-02-21 16:00 ` [PATCH 4/9] Bluetooth: mgmt: Fix current settings values when powered off johan.hedberg
` (6 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: johan.hedberg @ 2012-02-21 15:59 UTC (permalink / raw)
To: linux-bluetooth
From: Johan Hedberg <johan.hedberg@intel.com>
This patch makes it possible to toggle the connectable & discoverable
settings when powered off. Two new hdev->dev_flags flags are added to
track what the scan mode should be when the device is finally powered
on.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
include/net/bluetooth/hci.h | 2 +
net/bluetooth/hci_core.c | 1 +
net/bluetooth/mgmt.c | 86 ++++++++++++++++++++++++++++++++++---------
3 files changed, 71 insertions(+), 18 deletions(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index ec37049..169d2f8 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -96,6 +96,8 @@ enum {
HCI_LE_SCAN,
HCI_SSP_ENABLED,
HCI_HS_ENABLED,
+ HCI_CONNECTABLE,
+ HCI_DISCOVERABLE,
};
/* HCI ioctl defines */
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index a787c9c..9d19949 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -737,6 +737,7 @@ static int hci_dev_do_close(struct hci_dev *hdev)
if (hdev->discov_timeout > 0) {
cancel_delayed_work(&hdev->discov_off);
hdev->discov_timeout = 0;
+ clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
}
if (test_and_clear_bit(HCI_SERVICE_CACHE, &hdev->dev_flags))
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 03a1384..54df0c0 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -398,10 +398,10 @@ static u32 get_current_settings(struct hci_dev *hdev)
if (!test_bit(HCI_AUTO_OFF, &hdev->dev_flags))
settings |= MGMT_SETTING_POWERED;
- if (test_bit(HCI_PSCAN, &hdev->flags))
+ if (test_bit(HCI_CONNECTABLE, &hdev->dev_flags))
settings |= MGMT_SETTING_CONNECTABLE;
- if (test_bit(HCI_ISCAN, &hdev->flags))
+ if (test_bit(HCI_DISCOVERABLE, &hdev->dev_flags))
settings |= MGMT_SETTING_DISCOVERABLE;
if (test_bit(HCI_PAIRABLE, &hdev->dev_flags))
@@ -796,6 +796,7 @@ static int set_discoverable(struct sock *sk, u16 index, void *data, u16 len)
struct mgmt_cp_set_discoverable *cp = data;
struct hci_dev *hdev;
struct pending_cmd *cmd;
+ u16 timeout;
u8 scan;
int err;
@@ -810,9 +811,11 @@ static int set_discoverable(struct sock *sk, u16 index, void *data, u16 len)
return cmd_status(sk, index, MGMT_OP_SET_DISCOVERABLE,
MGMT_STATUS_INVALID_PARAMS);
+ timeout = get_unaligned_le16(&cp->timeout);
+
hci_dev_lock(hdev);
- if (!hdev_is_powered(hdev)) {
+ if (!hdev_is_powered(hdev) && timeout > 0) {
err = cmd_status(sk, index, MGMT_OP_SET_DISCOVERABLE,
MGMT_STATUS_NOT_POWERED);
goto failed;
@@ -825,8 +828,17 @@ static int set_discoverable(struct sock *sk, u16 index, void *data, u16 len)
goto failed;
}
- if (cp->val == test_bit(HCI_ISCAN, &hdev->flags) &&
- test_bit(HCI_PSCAN, &hdev->flags)) {
+ if (!hdev_is_powered(hdev)) {
+ if (cp->val) {
+ set_bit(HCI_CONNECTABLE, &hdev->dev_flags);
+ set_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
+ } else
+ clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
+ err = send_settings_rsp(sk, MGMT_OP_SET_DISCOVERABLE, hdev);
+ goto failed;
+ }
+
+ if (!!cp->val == test_bit(HCI_DISCOVERABLE, &hdev->dev_flags)) {
err = send_settings_rsp(sk, MGMT_OP_SET_DISCOVERABLE, hdev);
goto failed;
}
@@ -849,7 +861,7 @@ static int set_discoverable(struct sock *sk, u16 index, void *data, u16 len)
mgmt_pending_remove(cmd);
if (cp->val)
- hdev->discov_timeout = get_unaligned_le16(&cp->timeout);
+ hdev->discov_timeout = timeout;
failed:
hci_dev_unlock(hdev);
@@ -880,8 +892,13 @@ static int set_connectable(struct sock *sk, u16 index, void *data, u16 len)
hci_dev_lock(hdev);
if (!hdev_is_powered(hdev)) {
- err = cmd_status(sk, index, MGMT_OP_SET_CONNECTABLE,
- MGMT_STATUS_NOT_POWERED);
+ if (cp->val)
+ set_bit(HCI_CONNECTABLE, &hdev->dev_flags);
+ else {
+ clear_bit(HCI_CONNECTABLE, &hdev->dev_flags);
+ clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
+ }
+ err = send_settings_rsp(sk, MGMT_OP_SET_CONNECTABLE, hdev);
goto failed;
}
@@ -892,7 +909,7 @@ static int set_connectable(struct sock *sk, u16 index, void *data, u16 len)
goto failed;
}
- if (cp->val == test_bit(HCI_PSCAN, &hdev->flags)) {
+ if (!!cp->val == test_bit(HCI_PSCAN, &hdev->flags)) {
err = send_settings_rsp(sk, MGMT_OP_SET_CONNECTABLE, hdev);
goto failed;
}
@@ -2866,9 +2883,22 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered)
__le32 ev;
int err;
+ if (!test_bit(HCI_MGMT, &hdev->dev_flags))
+ return 0;
+
mgmt_pending_foreach(MGMT_OP_SET_POWERED, hdev, settings_rsp, &match);
- if (!powered) {
+ if (powered) {
+ u8 scan = 0;
+
+ if (test_bit(HCI_CONNECTABLE, &hdev->dev_flags))
+ scan |= SCAN_PAGE;
+ if (test_bit(HCI_DISCOVERABLE, &hdev->dev_flags))
+ scan |= SCAN_INQUIRY;
+
+ if (scan)
+ hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan);
+ } else {
u8 status = ENETDOWN;
mgmt_pending_foreach(0, hdev, cmd_status_rsp, &status);
}
@@ -2887,15 +2917,25 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered)
int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable)
{
struct cmd_lookup match = { NULL, hdev };
- __le32 ev;
- int err;
+ bool changed = false;
+ int err = 0;
mgmt_pending_foreach(MGMT_OP_SET_DISCOVERABLE, hdev, settings_rsp, &match);
- ev = cpu_to_le32(get_current_settings(hdev));
+ if (discoverable) {
+ if (!test_and_set_bit(HCI_DISCOVERABLE, &hdev->dev_flags))
+ changed = true;
+ } else {
+ if (test_and_clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags))
+ changed = true;
+ }
- err = mgmt_event(MGMT_EV_NEW_SETTINGS, hdev, &ev, sizeof(ev),
+ if (changed) {
+ __le32 ev = cpu_to_le32(get_current_settings(hdev));
+ err = mgmt_event(MGMT_EV_NEW_SETTINGS, hdev, &ev, sizeof(ev),
match.sk);
+ }
+
if (match.sk)
sock_put(match.sk);
@@ -2904,16 +2944,26 @@ int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable)
int mgmt_connectable(struct hci_dev *hdev, u8 connectable)
{
- __le32 ev;
struct cmd_lookup match = { NULL, hdev };
- int err;
+ bool changed = false;
+ int err = 0;
mgmt_pending_foreach(MGMT_OP_SET_CONNECTABLE, hdev, settings_rsp,
&match);
- ev = cpu_to_le32(get_current_settings(hdev));
+ if (connectable) {
+ if (!test_and_set_bit(HCI_CONNECTABLE, &hdev->dev_flags))
+ changed = true;
+ } else {
+ if (test_and_clear_bit(HCI_CONNECTABLE, &hdev->dev_flags))
+ changed = true;
+ }
- err = mgmt_event(MGMT_EV_NEW_SETTINGS, hdev, &ev, sizeof(ev), match.sk);
+ if (changed) {
+ __le32 ev = cpu_to_le32(get_current_settings(hdev));
+ err = mgmt_event(MGMT_EV_NEW_SETTINGS, hdev, &ev, sizeof(ev),
+ match.sk);
+ }
if (match.sk)
sock_put(match.sk);
--
1.7.9
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH 3/9] Bluetooth: mgmt: Allow connectable/discoverable changes in off state
2012-02-21 15:59 ` [PATCH 3/9] Bluetooth: mgmt: Allow connectable/discoverable changes in off state johan.hedberg
@ 2012-02-21 16:14 ` Marcel Holtmann
0 siblings, 0 replies; 19+ messages in thread
From: Marcel Holtmann @ 2012-02-21 16:14 UTC (permalink / raw)
To: johan.hedberg; +Cc: linux-bluetooth
Hi Johan,
> This patch makes it possible to toggle the connectable & discoverable
> settings when powered off. Two new hdev->dev_flags flags are added to
> track what the scan mode should be when the device is finally powered
> on.
>
> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
> ---
> include/net/bluetooth/hci.h | 2 +
> net/bluetooth/hci_core.c | 1 +
> net/bluetooth/mgmt.c | 86 ++++++++++++++++++++++++++++++++++---------
> 3 files changed, 71 insertions(+), 18 deletions(-)
>
> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> index ec37049..169d2f8 100644
> --- a/include/net/bluetooth/hci.h
> +++ b/include/net/bluetooth/hci.h
> @@ -96,6 +96,8 @@ enum {
> HCI_LE_SCAN,
> HCI_SSP_ENABLED,
> HCI_HS_ENABLED,
> + HCI_CONNECTABLE,
> + HCI_DISCOVERABLE,
> };
>
> /* HCI ioctl defines */
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index a787c9c..9d19949 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -737,6 +737,7 @@ static int hci_dev_do_close(struct hci_dev *hdev)
> if (hdev->discov_timeout > 0) {
> cancel_delayed_work(&hdev->discov_off);
> hdev->discov_timeout = 0;
> + clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
> }
>
> if (test_and_clear_bit(HCI_SERVICE_CACHE, &hdev->dev_flags))
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index 03a1384..54df0c0 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -398,10 +398,10 @@ static u32 get_current_settings(struct hci_dev *hdev)
> if (!test_bit(HCI_AUTO_OFF, &hdev->dev_flags))
> settings |= MGMT_SETTING_POWERED;
>
> - if (test_bit(HCI_PSCAN, &hdev->flags))
> + if (test_bit(HCI_CONNECTABLE, &hdev->dev_flags))
> settings |= MGMT_SETTING_CONNECTABLE;
>
> - if (test_bit(HCI_ISCAN, &hdev->flags))
> + if (test_bit(HCI_DISCOVERABLE, &hdev->dev_flags))
> settings |= MGMT_SETTING_DISCOVERABLE;
>
> if (test_bit(HCI_PAIRABLE, &hdev->dev_flags))
> @@ -796,6 +796,7 @@ static int set_discoverable(struct sock *sk, u16 index, void *data, u16 len)
> struct mgmt_cp_set_discoverable *cp = data;
> struct hci_dev *hdev;
> struct pending_cmd *cmd;
> + u16 timeout;
> u8 scan;
> int err;
>
> @@ -810,9 +811,11 @@ static int set_discoverable(struct sock *sk, u16 index, void *data, u16 len)
> return cmd_status(sk, index, MGMT_OP_SET_DISCOVERABLE,
> MGMT_STATUS_INVALID_PARAMS);
>
> + timeout = get_unaligned_le16(&cp->timeout);
> +
> hci_dev_lock(hdev);
>
> - if (!hdev_is_powered(hdev)) {
> + if (!hdev_is_powered(hdev) && timeout > 0) {
> err = cmd_status(sk, index, MGMT_OP_SET_DISCOVERABLE,
> MGMT_STATUS_NOT_POWERED);
> goto failed;
> @@ -825,8 +828,17 @@ static int set_discoverable(struct sock *sk, u16 index, void *data, u16 len)
> goto failed;
> }
>
> - if (cp->val == test_bit(HCI_ISCAN, &hdev->flags) &&
> - test_bit(HCI_PSCAN, &hdev->flags)) {
> + if (!hdev_is_powered(hdev)) {
> + if (cp->val) {
> + set_bit(HCI_CONNECTABLE, &hdev->dev_flags);
> + set_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
I think this is wrong. Even when powered off, we should only allow
setting DISCOVERABLE when CONNECTABLE has been set previously.
No need to automatically enable CONNECTABLE. Just fail here.
> + } else
> + clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
> + err = send_settings_rsp(sk, MGMT_OP_SET_DISCOVERABLE, hdev);
> + goto failed;
> + }
> +
> + if (!!cp->val == test_bit(HCI_DISCOVERABLE, &hdev->dev_flags)) {
> err = send_settings_rsp(sk, MGMT_OP_SET_DISCOVERABLE, hdev);
> goto failed;
> }
> @@ -849,7 +861,7 @@ static int set_discoverable(struct sock *sk, u16 index, void *data, u16 len)
> mgmt_pending_remove(cmd);
>
> if (cp->val)
> - hdev->discov_timeout = get_unaligned_le16(&cp->timeout);
> + hdev->discov_timeout = timeout;
>
> failed:
> hci_dev_unlock(hdev);
> @@ -880,8 +892,13 @@ static int set_connectable(struct sock *sk, u16 index, void *data, u16 len)
> hci_dev_lock(hdev);
>
> if (!hdev_is_powered(hdev)) {
> - err = cmd_status(sk, index, MGMT_OP_SET_CONNECTABLE,
> - MGMT_STATUS_NOT_POWERED);
> + if (cp->val)
> + set_bit(HCI_CONNECTABLE, &hdev->dev_flags);
> + else {
> + clear_bit(HCI_CONNECTABLE, &hdev->dev_flags);
> + clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
> + }
> + err = send_settings_rsp(sk, MGMT_OP_SET_CONNECTABLE, hdev);
> goto failed;
This looks fine here.
However we need to handle an eventual discovery timeout.
> }
>
> @@ -892,7 +909,7 @@ static int set_connectable(struct sock *sk, u16 index, void *data, u16 len)
> goto failed;
> }
>
> - if (cp->val == test_bit(HCI_PSCAN, &hdev->flags)) {
> + if (!!cp->val == test_bit(HCI_PSCAN, &hdev->flags)) {
> err = send_settings_rsp(sk, MGMT_OP_SET_CONNECTABLE, hdev);
> goto failed;
> }
> @@ -2866,9 +2883,22 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered)
> __le32 ev;
> int err;
>
> + if (!test_bit(HCI_MGMT, &hdev->dev_flags))
> + return 0;
> +
> mgmt_pending_foreach(MGMT_OP_SET_POWERED, hdev, settings_rsp, &match);
>
> - if (!powered) {
> + if (powered) {
> + u8 scan = 0;
> +
> + if (test_bit(HCI_CONNECTABLE, &hdev->dev_flags))
> + scan |= SCAN_PAGE;
> + if (test_bit(HCI_DISCOVERABLE, &hdev->dev_flags))
> + scan |= SCAN_INQUIRY;
> +
> + if (scan)
> + hci_send_cmd(hdev, HCI_OP_WRITE_SCAN_ENABLE, 1, &scan);
> + } else {
> u8 status = ENETDOWN;
> mgmt_pending_foreach(0, hdev, cmd_status_rsp, &status);
> }
> @@ -2887,15 +2917,25 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered)
> int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable)
> {
> struct cmd_lookup match = { NULL, hdev };
> - __le32 ev;
> - int err;
> + bool changed = false;
> + int err = 0;
>
> mgmt_pending_foreach(MGMT_OP_SET_DISCOVERABLE, hdev, settings_rsp, &match);
>
> - ev = cpu_to_le32(get_current_settings(hdev));
> + if (discoverable) {
> + if (!test_and_set_bit(HCI_DISCOVERABLE, &hdev->dev_flags))
> + changed = true;
> + } else {
> + if (test_and_clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags))
> + changed = true;
> + }
>
> - err = mgmt_event(MGMT_EV_NEW_SETTINGS, hdev, &ev, sizeof(ev),
> + if (changed) {
> + __le32 ev = cpu_to_le32(get_current_settings(hdev));
> + err = mgmt_event(MGMT_EV_NEW_SETTINGS, hdev, &ev, sizeof(ev),
> match.sk);
> + }
> +
> if (match.sk)
> sock_put(match.sk);
>
> @@ -2904,16 +2944,26 @@ int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable)
>
> int mgmt_connectable(struct hci_dev *hdev, u8 connectable)
> {
> - __le32 ev;
> struct cmd_lookup match = { NULL, hdev };
> - int err;
> + bool changed = false;
> + int err = 0;
>
> mgmt_pending_foreach(MGMT_OP_SET_CONNECTABLE, hdev, settings_rsp,
> &match);
>
> - ev = cpu_to_le32(get_current_settings(hdev));
> + if (connectable) {
> + if (!test_and_set_bit(HCI_CONNECTABLE, &hdev->dev_flags))
> + changed = true;
> + } else {
> + if (test_and_clear_bit(HCI_CONNECTABLE, &hdev->dev_flags))
> + changed = true;
> + }
>
> - err = mgmt_event(MGMT_EV_NEW_SETTINGS, hdev, &ev, sizeof(ev), match.sk);
> + if (changed) {
> + __le32 ev = cpu_to_le32(get_current_settings(hdev));
> + err = mgmt_event(MGMT_EV_NEW_SETTINGS, hdev, &ev, sizeof(ev),
> + match.sk);
> + }
>
> if (match.sk)
> sock_put(match.sk);
Regards
Marcel
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 4/9] Bluetooth: mgmt: Fix current settings values when powered off
2012-02-21 15:59 [PATCH 1/9] Bluetooth: mgmt: Fix powered checks for commands johan.hedberg
2012-02-21 15:59 ` [PATCH 2/9] Bluetooth: mgmt: Fix set_local_name and set_dev_class powered checks johan.hedberg
2012-02-21 15:59 ` [PATCH 3/9] Bluetooth: mgmt: Allow connectable/discoverable changes in off state johan.hedberg
@ 2012-02-21 16:00 ` johan.hedberg
2012-02-21 16:15 ` Marcel Holtmann
2012-02-21 16:00 ` [PATCH 5/9] Bluetooth: mgmt: Add convenience function for sending New Settings johan.hedberg
` (5 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: johan.hedberg @ 2012-02-21 16:00 UTC (permalink / raw)
To: linux-bluetooth
From: Johan Hedberg <johan.hedberg@intel.com>
We should not stop iterating through the various settings if powered off
since most may still be set even then.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
net/bluetooth/mgmt.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 54df0c0..629bed1 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -392,10 +392,7 @@ static u32 get_current_settings(struct hci_dev *hdev)
{
u32 settings = 0;
- if (!test_bit(HCI_UP, &hdev->flags))
- return settings;
-
- if (!test_bit(HCI_AUTO_OFF, &hdev->dev_flags))
+ if (hdev_is_powered(hdev))
settings |= MGMT_SETTING_POWERED;
if (test_bit(HCI_CONNECTABLE, &hdev->dev_flags))
--
1.7.9
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 5/9] Bluetooth: mgmt: Add convenience function for sending New Settings
2012-02-21 15:59 [PATCH 1/9] Bluetooth: mgmt: Fix powered checks for commands johan.hedberg
` (2 preceding siblings ...)
2012-02-21 16:00 ` [PATCH 4/9] Bluetooth: mgmt: Fix current settings values when powered off johan.hedberg
@ 2012-02-21 16:00 ` johan.hedberg
2012-02-21 16:15 ` Marcel Holtmann
2012-02-21 16:00 ` [PATCH 6/9] Bluetooth: mgmt: Fix New Settings event for connectable/discoverable johan.hedberg
` (4 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: johan.hedberg @ 2012-02-21 16:00 UTC (permalink / raw)
To: linux-bluetooth
From: Johan Hedberg <johan.hedberg@intel.com>
The New Settings event needs to be sent from quite many places so it
makes sense to have a convenience function for it to simplify the code.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
net/bluetooth/mgmt.c | 96 +++++++++++++++++++++++---------------------------
1 files changed, 44 insertions(+), 52 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 629bed1..74b6db1 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -788,6 +788,42 @@ failed:
return err;
}
+static int mgmt_event(u16 event, struct hci_dev *hdev, void *data,
+ u16 data_len, struct sock *skip_sk)
+{
+ struct sk_buff *skb;
+ struct mgmt_hdr *hdr;
+
+ skb = alloc_skb(sizeof(*hdr) + data_len, GFP_ATOMIC);
+ if (!skb)
+ return -ENOMEM;
+
+ hdr = (void *) skb_put(skb, sizeof(*hdr));
+ hdr->opcode = cpu_to_le16(event);
+ if (hdev)
+ hdr->index = cpu_to_le16(hdev->id);
+ else
+ hdr->index = cpu_to_le16(MGMT_INDEX_NONE);
+ hdr->len = cpu_to_le16(data_len);
+
+ if (data)
+ memcpy(skb_put(skb, data_len), data, data_len);
+
+ hci_send_to_control(skb, skip_sk);
+ kfree_skb(skb);
+
+ return 0;
+}
+
+static int new_settings(struct hci_dev *hdev, struct sock *skip)
+{
+ __le32 ev;
+
+ ev = cpu_to_le32(get_current_settings(hdev));
+
+ return mgmt_event(MGMT_EV_NEW_SETTINGS, hdev, &ev, sizeof(ev), skip);
+}
+
static int set_discoverable(struct sock *sk, u16 index, void *data, u16 len)
{
struct mgmt_cp_set_discoverable *cp = data;
@@ -933,38 +969,10 @@ failed:
return err;
}
-static int mgmt_event(u16 event, struct hci_dev *hdev, void *data,
- u16 data_len, struct sock *skip_sk)
-{
- struct sk_buff *skb;
- struct mgmt_hdr *hdr;
-
- skb = alloc_skb(sizeof(*hdr) + data_len, GFP_ATOMIC);
- if (!skb)
- return -ENOMEM;
-
- hdr = (void *) skb_put(skb, sizeof(*hdr));
- hdr->opcode = cpu_to_le16(event);
- if (hdev)
- hdr->index = cpu_to_le16(hdev->id);
- else
- hdr->index = cpu_to_le16(MGMT_INDEX_NONE);
- hdr->len = cpu_to_le16(data_len);
-
- if (data)
- memcpy(skb_put(skb, data_len), data, data_len);
-
- hci_send_to_control(skb, skip_sk);
- kfree_skb(skb);
-
- return 0;
-}
-
static int set_pairable(struct sock *sk, u16 index, void *data, u16 len)
{
struct mgmt_mode *cp = data;
struct hci_dev *hdev;
- __le32 ev;
int err;
BT_DBG("request for hci%u", index);
@@ -989,9 +997,7 @@ static int set_pairable(struct sock *sk, u16 index, void *data, u16 len)
if (err < 0)
goto failed;
- ev = cpu_to_le32(get_current_settings(hdev));
-
- err = mgmt_event(MGMT_EV_NEW_SETTINGS, hdev, &ev, sizeof(ev), sk);
+ err = new_settings(hdev, sk);
failed:
hci_dev_unlock(hdev);
@@ -2877,7 +2883,6 @@ static void settings_rsp(struct pending_cmd *cmd, void *data)
int mgmt_powered(struct hci_dev *hdev, u8 powered)
{
struct cmd_lookup match = { NULL, hdev };
- __le32 ev;
int err;
if (!test_bit(HCI_MGMT, &hdev->dev_flags))
@@ -2900,10 +2905,7 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered)
mgmt_pending_foreach(0, hdev, cmd_status_rsp, &status);
}
- ev = cpu_to_le32(get_current_settings(hdev));
-
- err = mgmt_event(MGMT_EV_NEW_SETTINGS, hdev, &ev, sizeof(ev),
- match.sk);
+ err = new_settings(hdev, match.sk);
if (match.sk)
sock_put(match.sk);
@@ -2927,11 +2929,8 @@ int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable)
changed = true;
}
- if (changed) {
- __le32 ev = cpu_to_le32(get_current_settings(hdev));
- err = mgmt_event(MGMT_EV_NEW_SETTINGS, hdev, &ev, sizeof(ev),
- match.sk);
- }
+ if (changed)
+ err = new_settings(hdev, match.sk);
if (match.sk)
sock_put(match.sk);
@@ -2956,11 +2955,8 @@ int mgmt_connectable(struct hci_dev *hdev, u8 connectable)
changed = true;
}
- if (changed) {
- __le32 ev = cpu_to_le32(get_current_settings(hdev));
- err = mgmt_event(MGMT_EV_NEW_SETTINGS, hdev, &ev, sizeof(ev),
- match.sk);
- }
+ if (changed)
+ err = new_settings(hdev, match.sk);
if (match.sk)
sock_put(match.sk);
@@ -3295,7 +3291,6 @@ int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
int mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status)
{
struct cmd_lookup match = { NULL, hdev };
- __le32 ev;
int err;
if (status) {
@@ -3308,8 +3303,7 @@ int mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status)
mgmt_pending_foreach(MGMT_OP_SET_LINK_SECURITY, hdev, settings_rsp,
&match);
- ev = cpu_to_le32(get_current_settings(hdev));
- err = mgmt_event(MGMT_EV_NEW_SETTINGS, hdev, &ev, sizeof(ev), match.sk);
+ err = new_settings(hdev, match.sk);
if (match.sk)
sock_put(match.sk);
@@ -3332,7 +3326,6 @@ static int clear_eir(struct hci_dev *hdev)
int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 status)
{
struct cmd_lookup match = { NULL, hdev };
- __le32 ev;
int err;
if (status) {
@@ -3344,8 +3337,7 @@ int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 status)
mgmt_pending_foreach(MGMT_OP_SET_SSP, hdev, settings_rsp, &match);
- ev = cpu_to_le32(get_current_settings(hdev));
- err = mgmt_event(MGMT_EV_NEW_SETTINGS, hdev, &ev, sizeof(ev), match.sk);
+ err = new_settings(hdev, match.sk);
if (match.sk) {
sock_put(match.sk);
--
1.7.9
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 6/9] Bluetooth: mgmt: Fix New Settings event for connectable/discoverable
2012-02-21 15:59 [PATCH 1/9] Bluetooth: mgmt: Fix powered checks for commands johan.hedberg
` (3 preceding siblings ...)
2012-02-21 16:00 ` [PATCH 5/9] Bluetooth: mgmt: Add convenience function for sending New Settings johan.hedberg
@ 2012-02-21 16:00 ` johan.hedberg
2012-02-21 16:21 ` Marcel Holtmann
2012-02-21 16:00 ` [PATCH 7/9] Bluetooth: mgmt: Fix set_fast_connectable error return johan.hedberg
` (3 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: johan.hedberg @ 2012-02-21 16:00 UTC (permalink / raw)
To: linux-bluetooth
From: Johan Hedberg <johan.hedberg@intel.com>
When powered off and doing changes to the Connectable or Discoverable
setting we should also send an appropriate New Settings event in
addition to the command response.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
net/bluetooth/mgmt.c | 41 ++++++++++++++++++++++++++++++++++-------
1 files changed, 34 insertions(+), 7 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 74b6db1..96386ff 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -862,12 +862,26 @@ static int set_discoverable(struct sock *sk, u16 index, void *data, u16 len)
}
if (!hdev_is_powered(hdev)) {
+ bool changed = false;
+
if (cp->val) {
+ if (!test_and_set_bit(HCI_DISCOVERABLE,
+ &hdev->dev_flags))
+ changed = true;
set_bit(HCI_CONNECTABLE, &hdev->dev_flags);
- set_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
- } else
- clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
+ } else {
+ if (test_and_clear_bit(HCI_DISCOVERABLE,
+ &hdev->dev_flags))
+ changed = true;
+ }
+
err = send_settings_rsp(sk, MGMT_OP_SET_DISCOVERABLE, hdev);
+ if (err < 0)
+ goto failed;
+
+ if (changed)
+ err = new_settings(hdev, sk);
+
goto failed;
}
@@ -925,13 +939,26 @@ static int set_connectable(struct sock *sk, u16 index, void *data, u16 len)
hci_dev_lock(hdev);
if (!hdev_is_powered(hdev)) {
- if (cp->val)
- set_bit(HCI_CONNECTABLE, &hdev->dev_flags);
- else {
- clear_bit(HCI_CONNECTABLE, &hdev->dev_flags);
+ bool changed = false;
+
+ if (cp->val) {
+ if (!test_and_set_bit(HCI_CONNECTABLE,
+ &hdev->dev_flags))
+ changed = true;
+ } else {
+ if (test_and_clear_bit(HCI_CONNECTABLE,
+ &hdev->dev_flags))
+ changed = true;
clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
}
+
err = send_settings_rsp(sk, MGMT_OP_SET_CONNECTABLE, hdev);
+ if (err < 0)
+ goto failed;
+
+ if (changed)
+ err = new_settings(hdev, sk);
+
goto failed;
}
--
1.7.9
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH 6/9] Bluetooth: mgmt: Fix New Settings event for connectable/discoverable
2012-02-21 16:00 ` [PATCH 6/9] Bluetooth: mgmt: Fix New Settings event for connectable/discoverable johan.hedberg
@ 2012-02-21 16:21 ` Marcel Holtmann
2012-02-21 17:46 ` Johan Hedberg
0 siblings, 1 reply; 19+ messages in thread
From: Marcel Holtmann @ 2012-02-21 16:21 UTC (permalink / raw)
To: johan.hedberg; +Cc: linux-bluetooth
Hi Johan,
> When powered off and doing changes to the Connectable or Discoverable
> setting we should also send an appropriate New Settings event in
> addition to the command response.
>
> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
> ---
> net/bluetooth/mgmt.c | 41 ++++++++++++++++++++++++++++++++++-------
> 1 files changed, 34 insertions(+), 7 deletions(-)
>
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index 74b6db1..96386ff 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -862,12 +862,26 @@ static int set_discoverable(struct sock *sk, u16 index, void *data, u16 len)
> }
>
> if (!hdev_is_powered(hdev)) {
> + bool changed = false;
> +
> if (cp->val) {
> + if (!test_and_set_bit(HCI_DISCOVERABLE,
> + &hdev->dev_flags))
> + changed = true;
> set_bit(HCI_CONNECTABLE, &hdev->dev_flags);
> - set_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
> - } else
> - clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
> + } else {
> + if (test_and_clear_bit(HCI_DISCOVERABLE,
> + &hdev->dev_flags))
> + changed = true;
> + }
> +
does it really need to be this complicated? If we remove the set_bit for
CONNECTABLE, then we can just send this one out. Since we know that
something changed.
> err = send_settings_rsp(sk, MGMT_OP_SET_DISCOVERABLE, hdev);
> + if (err < 0)
> + goto failed;
> +
> + if (changed)
> + err = new_settings(hdev, sk);
> +
> goto failed;
> }
>
> @@ -925,13 +939,26 @@ static int set_connectable(struct sock *sk, u16 index, void *data, u16 len)
> hci_dev_lock(hdev);
>
> if (!hdev_is_powered(hdev)) {
> - if (cp->val)
> - set_bit(HCI_CONNECTABLE, &hdev->dev_flags);
> - else {
> - clear_bit(HCI_CONNECTABLE, &hdev->dev_flags);
> + bool changed = false;
> +
> + if (cp->val) {
> + if (!test_and_set_bit(HCI_CONNECTABLE,
> + &hdev->dev_flags))
> + changed = true;
> + } else {
> + if (test_and_clear_bit(HCI_CONNECTABLE,
> + &hdev->dev_flags))
> + changed = true;
> clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
> }
> +
Same here. Even with the clearing of DISCOVERABLE, we should just send
the new settings. event.
> err = send_settings_rsp(sk, MGMT_OP_SET_CONNECTABLE, hdev);
> + if (err < 0)
> + goto failed;
> +
> + if (changed)
> + err = new_settings(hdev, sk);
> +
> goto failed;
> }
>
Regards
Marcel
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH 6/9] Bluetooth: mgmt: Fix New Settings event for connectable/discoverable
2012-02-21 16:21 ` Marcel Holtmann
@ 2012-02-21 17:46 ` Johan Hedberg
0 siblings, 0 replies; 19+ messages in thread
From: Johan Hedberg @ 2012-02-21 17:46 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
Hi Marcel,
On Tue, Feb 21, 2012, Marcel Holtmann wrote:
> > if (!hdev_is_powered(hdev)) {
> > + bool changed = false;
> > +
> > if (cp->val) {
> > + if (!test_and_set_bit(HCI_DISCOVERABLE,
> > + &hdev->dev_flags))
> > + changed = true;
> > set_bit(HCI_CONNECTABLE, &hdev->dev_flags);
> > - set_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
> > - } else
> > - clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
> > + } else {
> > + if (test_and_clear_bit(HCI_DISCOVERABLE,
> > + &hdev->dev_flags))
> > + changed = true;
> > + }
> > +
>
> does it really need to be this complicated? If we remove the set_bit for
> CONNECTABLE, then we can just send this one out. Since we know that
> something changed.
Since we don't treat trying to change a setting to a value it already
has as an error it's not guaranteed that there will always be a change
in settings. Therefore, we do always need to send the cmd_complete but
not always the new_settings event. In the new set of patches I sent I've
simplified this logic a bit but the check is still there.
Johan
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 7/9] Bluetooth: mgmt: Fix set_fast_connectable error return
2012-02-21 15:59 [PATCH 1/9] Bluetooth: mgmt: Fix powered checks for commands johan.hedberg
` (4 preceding siblings ...)
2012-02-21 16:00 ` [PATCH 6/9] Bluetooth: mgmt: Fix New Settings event for connectable/discoverable johan.hedberg
@ 2012-02-21 16:00 ` johan.hedberg
2012-02-21 16:16 ` Marcel Holtmann
2012-02-21 16:00 ` [PATCH 8/9] Bluetooth: mgmt: Fix pairable setting upon initialization johan.hedberg
` (2 subsequent siblings)
8 siblings, 1 reply; 19+ messages in thread
From: johan.hedberg @ 2012-02-21 16:00 UTC (permalink / raw)
To: linux-bluetooth
From: Johan Hedberg <johan.hedberg@intel.com>
This patch ensures that Set Fast Connectable fails apropriately if we
are not already in a connectable state (which is a pre-requisite for
fast connectable).
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
net/bluetooth/mgmt.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 96386ff..abad38c 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2607,6 +2607,13 @@ static int set_fast_connectable(struct sock *sk, u16 index,
if (!hdev)
return cmd_status(sk, index, MGMT_OP_SET_FAST_CONNECTABLE,
MGMT_STATUS_INVALID_PARAMS);
+ if (!hdev_is_powered(hdev))
+ return cmd_status(sk, index, MGMT_OP_SET_FAST_CONNECTABLE,
+ MGMT_STATUS_NOT_POWERED);
+
+ if (!test_bit(HCI_CONNECTABLE, &hdev->dev_flags))
+ return cmd_status(sk, index, MGMT_OP_SET_FAST_CONNECTABLE,
+ MGMT_STATUS_REJECTED);
hci_dev_lock(hdev);
--
1.7.9
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 8/9] Bluetooth: mgmt: Fix pairable setting upon initialization
2012-02-21 15:59 [PATCH 1/9] Bluetooth: mgmt: Fix powered checks for commands johan.hedberg
` (5 preceding siblings ...)
2012-02-21 16:00 ` [PATCH 7/9] Bluetooth: mgmt: Fix set_fast_connectable error return johan.hedberg
@ 2012-02-21 16:00 ` johan.hedberg
2012-02-21 16:17 ` Marcel Holtmann
2012-02-21 16:00 ` [PATCH 9/9] Bluetooth: Fix clearing of persistent dev_flags johan.hedberg
2012-02-21 16:09 ` [PATCH 1/9] Bluetooth: mgmt: Fix powered checks for commands Marcel Holtmann
8 siblings, 1 reply; 19+ messages in thread
From: johan.hedberg @ 2012-02-21 16:00 UTC (permalink / raw)
To: linux-bluetooth
From: Johan Hedberg <johan.hedberg@intel.com>
When mgmt is not in use the HCI_PAIRABLE flag will get implicitly set so
that pairing still works with old user space versions. However, as soon
as mgmt comes into play we should clear this flag so that it can be
properly set through the set_pairable command by user space.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
net/bluetooth/mgmt.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index abad38c..ac6dcff 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -601,9 +601,17 @@ static void service_cache_off(struct work_struct *work)
static void mgmt_init_hdev(struct hci_dev *hdev)
{
- if (!test_and_set_bit(HCI_MGMT, &hdev->dev_flags))
+ if (!test_and_set_bit(HCI_MGMT, &hdev->dev_flags)) {
INIT_DELAYED_WORK(&hdev->service_cache, service_cache_off);
+ /* Non-mgmt controlled devices get this bit set
+ * implicitly so that pairing works for them, however
+ * for mgmt we require user-space to explicitly enable
+ * it
+ */
+ clear_bit(HCI_PAIRABLE, &hdev->dev_flags);
+ }
+
if (!test_and_set_bit(HCI_SERVICE_CACHE, &hdev->dev_flags))
schedule_delayed_work(&hdev->service_cache,
msecs_to_jiffies(SERVICE_CACHE_TIMEOUT));
--
1.7.9
^ permalink raw reply related [flat|nested] 19+ messages in thread* [PATCH 9/9] Bluetooth: Fix clearing of persistent dev_flags
2012-02-21 15:59 [PATCH 1/9] Bluetooth: mgmt: Fix powered checks for commands johan.hedberg
` (6 preceding siblings ...)
2012-02-21 16:00 ` [PATCH 8/9] Bluetooth: mgmt: Fix pairable setting upon initialization johan.hedberg
@ 2012-02-21 16:00 ` johan.hedberg
2012-02-21 16:18 ` Marcel Holtmann
2012-02-21 16:09 ` [PATCH 1/9] Bluetooth: mgmt: Fix powered checks for commands Marcel Holtmann
8 siblings, 1 reply; 19+ messages in thread
From: johan.hedberg @ 2012-02-21 16:00 UTC (permalink / raw)
To: linux-bluetooth
From: Johan Hedberg <johan.hedberg@intel.com>
Now that most flags are persistent, only the LE_SCAN flag should be
cleared after a reset.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
net/bluetooth/hci_event.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 5d0f92a..2a5d05c 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -192,9 +192,8 @@ static void hci_cc_reset(struct hci_dev *hdev, struct sk_buff *skb)
hci_req_complete(hdev, HCI_OP_RESET, status);
- /* Reset all flags, except persistent ones */
- hdev->dev_flags &= BIT(HCI_MGMT) | BIT(HCI_SETUP) | BIT(HCI_AUTO_OFF) |
- BIT(HCI_LINK_KEYS) | BIT(HCI_DEBUG_KEYS);
+ /* Reset all non-persistent flags */
+ hdev->dev_flags &= ~(BIT(HCI_LE_SCAN));
}
static void hci_cc_write_local_name(struct hci_dev *hdev, struct sk_buff *skb)
--
1.7.9
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH 1/9] Bluetooth: mgmt: Fix powered checks for commands
2012-02-21 15:59 [PATCH 1/9] Bluetooth: mgmt: Fix powered checks for commands johan.hedberg
` (7 preceding siblings ...)
2012-02-21 16:00 ` [PATCH 9/9] Bluetooth: Fix clearing of persistent dev_flags johan.hedberg
@ 2012-02-21 16:09 ` Marcel Holtmann
8 siblings, 0 replies; 19+ messages in thread
From: Marcel Holtmann @ 2012-02-21 16:09 UTC (permalink / raw)
To: johan.hedberg; +Cc: linux-bluetooth
Hi Johan,
> Having the HCI_AUTO_OFF flag set means that from a mgmt interface
> perspective we're still not powered, so all tests for HCI_UP should also
> include a test for HCI_AUTO_OFF. This patch adds a convenience macro for
> it.
>
> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
> ---
> net/bluetooth/mgmt.c | 26 ++++++++++++++------------
> 1 files changed, 14 insertions(+), 12 deletions(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply [flat|nested] 19+ messages in thread