* [PATCH v4 8/8] Bluetooth: Add the definition for Slave Page Response Timeout
From: Dohyun Pyun @ 2013-10-02 12:54 UTC (permalink / raw)
To: linux-bluetooth; +Cc: steve.jun, DoHyun Pyun, C S Bhargava
In-Reply-To: <1380718493-4577-1-git-send-email-dh79.pyun@samsung.com>
From: DoHyun Pyun <dh79.pyun@samsung.com>
The Slave Page Response Timeout event indicates to the Host that a
slave page response timeout has occurred in the BR/EDR Controller.
The Core Spec Addendum 4 adds this command in part B Connectionless
Slave Broadcast.
Bluetooth Core Specification Addendum 4 - Page 110
"7.7.72 Slave Page Response Timeout Event [New Section]
...
Note: this event will be generated if the slave BR/EDR Controller
responds to a page but does not receive the master FHS packet
(see Baseband, Section 8.3.3) within pagerespTO.
Event Parameters: NONE"
Signed-off-by: Dohyun Pyun <dh79.pyun@samsung.com>
Signed-off-by: C S Bhargava <cs.bhargava@samsung.com>
---
include/net/bluetooth/hci.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 03f2a91..b90eec5 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -1510,6 +1510,8 @@ struct hci_ev_sync_train_complete {
__u8 status;
} __packed;
+#define HCI_EV_SLAVE_PAGE_RESP_TIMEOUT 0x54
+
/* Low energy meta events */
#define LE_CONN_ROLE_MASTER 0x00
--
1.8.1.2
^ permalink raw reply related
* [PATCH] Bluetooth: Fix advertising data flags with disabled BR/EDR
From: johan.hedberg @ 2013-10-02 13:02 UTC (permalink / raw)
To: linux-bluetooth
From: Johan Hedberg <johan.hedberg@intel.com>
We shouldn't include the simultaneous LE & BR/EDR flags in the LE
advertising data if BR/EDR is disabled on a dual-mode controller. This
patch fixes this issue and ensures that the create_ad function generates
the correct flags when BR/EDR is disabled.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
net/bluetooth/hci_core.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 14df032..82dbdc6 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1108,14 +1108,14 @@ static u8 create_ad(struct hci_dev *hdev, u8 *ptr)
if (test_bit(HCI_LE_PERIPHERAL, &hdev->dev_flags))
flags |= LE_AD_GENERAL;
- if (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags))
+ if (test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags)) {
+ if (lmp_le_br_capable(hdev))
+ flags |= LE_AD_SIM_LE_BREDR_CTRL;
+ if (lmp_host_le_br_capable(hdev))
+ flags |= LE_AD_SIM_LE_BREDR_HOST;
+ } else {
flags |= LE_AD_NO_BREDR;
-
- if (lmp_le_br_capable(hdev))
- flags |= LE_AD_SIM_LE_BREDR_CTRL;
-
- if (lmp_host_le_br_capable(hdev))
- flags |= LE_AD_SIM_LE_BREDR_HOST;
+ }
if (flags) {
BT_DBG("adv flags 0x%02x", flags);
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH] Bluetooth: Fix advertising data flags with disabled BR/EDR
From: Marcel Holtmann @ 2013-10-02 13:19 UTC (permalink / raw)
To: johan.hedberg; +Cc: linux-bluetooth
In-Reply-To: <1380718944-28164-1-git-send-email-johan.hedberg@gmail.com>
Hi Johan,
> We shouldn't include the simultaneous LE & BR/EDR flags in the LE
> advertising data if BR/EDR is disabled on a dual-mode controller. This
> patch fixes this issue and ensures that the create_ad function generates
> the correct flags when BR/EDR is disabled.
>
> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
> ---
> net/bluetooth/hci_core.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH] Bluetooth: Increment management interface revision
From: Johan Hedberg @ 2013-10-02 13:24 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1380716311-19403-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Wed, Oct 02, 2013, Marcel Holtmann wrote:
> This patch increments the management interface revision due to the
> various fixes, improvements and other changes that have gone in
> lately.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/mgmt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied. Thanks.
Johan
^ permalink raw reply
* [PATCH] Bluetooth: Fix memory leak with L2CAP signal channels
From: Marcel Holtmann @ 2013-10-02 15:28 UTC (permalink / raw)
To: linux-bluetooth
The wrong type of L2CAP signalling packets on the wrong type of
either BR/EDR or LE links need to be dropped. When that happens
the packet is dropped, but the memory not freed. So actually
free the memory as well.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/l2cap_core.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 6d42498..814563d 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -5330,7 +5330,7 @@ static inline void l2cap_le_sig_channel(struct l2cap_conn *conn,
l2cap_raw_recv(conn, skb);
if (hcon->type != LE_LINK)
- return;
+ goto drop;
while (len >= L2CAP_CMD_HDR_SIZE) {
u16 cmd_len;
@@ -5363,6 +5363,7 @@ static inline void l2cap_le_sig_channel(struct l2cap_conn *conn,
len -= cmd_len;
}
+drop:
kfree_skb(skb);
}
@@ -5378,7 +5379,7 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn,
l2cap_raw_recv(conn, skb);
if (hcon->type != ACL_LINK)
- return;
+ goto drop;
while (len >= L2CAP_CMD_HDR_SIZE) {
u16 cmd_len;
@@ -5411,6 +5412,7 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn,
len -= cmd_len;
}
+drop:
kfree_skb(skb);
}
--
1.8.3.1
^ permalink raw reply related
* [PATCH bluez v2 1/2] plugin: handle ENOSYS as not-supported
From: David Herrmann @ 2013-10-02 15:57 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Marcel Holtmann, Johan Hedberg, David Herrmann
Allow plugins to return -ENOSYS during registration and handle it as
"not-supported" error. It makes the error messages slightly more useful in
case kernel-support is missing for a particular subsystem.
---
src/plugin.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/plugin.c b/src/plugin.c
index 51c98bc..9c3225e 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -119,6 +119,7 @@ gboolean plugin_init(const char *enable, const char *disable)
const char *file;
char **cli_disabled, **cli_enabled;
unsigned int i;
+ int err;
/* Make a call to BtIO API so its symbols got resolved before the
* plugins are loaded. */
@@ -196,8 +197,14 @@ start:
for (list = plugins; list; list = list->next) {
struct bluetooth_plugin *plugin = list->data;
- if (plugin->desc->init() < 0) {
- error("Failed to init %s plugin", plugin->desc->name);
+ err = plugin->desc->init();
+ if (err < 0) {
+ if (err == -ENOSYS)
+ warn("System does not support %s plugin",
+ plugin->desc->name);
+ else
+ error("Failed to init %s plugin",
+ plugin->desc->name);
continue;
}
--
1.8.4
^ permalink raw reply related
* [PATCH bluez v2 2/2] bnep: improve error-msg if bnep.ko is not loaded
From: David Herrmann @ 2013-10-02 15:57 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Marcel Holtmann, Johan Hedberg, David Herrmann
In-Reply-To: <1380729451-2266-1-git-send-email-dh.herrmann@gmail.com>
bnep.ko, besides others, can be disabled in custom kernels if
network-support is not required. To avoid strange error messages, handle
EPROTONOSUPPORT as a special case and emit a warning that kernel support
is missing.
---
profiles/network/common.c | 7 ++++++-
profiles/network/manager.c | 16 +++++++++++++---
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/profiles/network/common.c b/profiles/network/common.c
index e069892..0b291bd 100644
--- a/profiles/network/common.c
+++ b/profiles/network/common.c
@@ -110,8 +110,13 @@ int bnep_init(void)
if (ctl < 0) {
int err = -errno;
- error("Failed to open control socket: %s (%d)",
+
+ if (err == -EPROTONOSUPPORT)
+ warn("kernel lacks bnep-protocol support");
+ else
+ error("Failed to open control socket: %s (%d)",
strerror(-err), -err);
+
return err;
}
diff --git a/profiles/network/manager.c b/profiles/network/manager.c
index 03b1b3d..6617687 100644
--- a/profiles/network/manager.c
+++ b/profiles/network/manager.c
@@ -25,6 +25,7 @@
#include <config.h>
#endif
+#include <errno.h>
#include <stdbool.h>
#include <bluetooth/bluetooth.h>
@@ -169,11 +170,20 @@ static struct btd_profile nap_profile = {
static int network_init(void)
{
+ int err;
+
read_config(CONFIGDIR "/network.conf");
- if (bnep_init()) {
- error("Can't init bnep module");
- return -1;
+ err = bnep_init();
+ if (err) {
+ if (err == -EPROTONOSUPPORT) {
+ info("bnep module not available, disabling plugin");
+ err = -ENOSYS;
+ } else {
+ error("Can't init bnep module");
+ }
+
+ return err;
}
/*
--
1.8.4
^ permalink raw reply related
* [PATCH] hid2hci: fix regression in /dev format after moving away from libusb
From: Giovanni Campagna @ 2013-10-02 16:00 UTC (permalink / raw)
To: linux-bluetooth
From: Giovanni Campagna <gcampagna@src.gnome.org>
The paths under /dev, in the default udev configuration, are formatted
with two leading zeros, but the number obtained from sysfs don't have
them, so we must convert them to integers and reformat them.
Signed-off-by: Giovanni Campagna <scampa.giovanni@gmail.com>
---
tools/hid2hci.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/tools/hid2hci.c b/tools/hid2hci.c
index bb8a521..76d0b5a 100644
--- a/tools/hid2hci.c
+++ b/tools/hid2hci.c
@@ -221,18 +221,21 @@ static int usb_switch_dell(int fd, enum mode mode)
static int find_device(struct udev_device *udev_dev)
{
char path[PATH_MAX];
- const char *busnum, *devnum;
+ const char *busnum_s, *devnum_s;
+ int busnum, devnum;
int fd;
- busnum = udev_device_get_sysattr_value(udev_dev, "busnum");
- if (!busnum)
+ busnum_s = udev_device_get_sysattr_value(udev_dev, "busnum");
+ if (!busnum_s)
return -1;
+ busnum = strtol(busnum_s, NULL, 10);
- devnum = udev_device_get_sysattr_value(udev_dev, "devnum");
- if (!devnum)
+ devnum_s = udev_device_get_sysattr_value(udev_dev, "devnum");
+ if (!devnum_s)
return -1;
+ devnum = strtol(devnum_s, NULL, 10);
- snprintf(path, sizeof(path), "/dev/bus/usb/%s/%s", busnum, devnum);
+ snprintf(path, sizeof(path), "/dev/bus/usb/%03d/%03d", busnum, devnum);
fd = open(path, O_RDWR, O_CLOEXEC);
if (fd < 0) {
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH v4 0/8] Add CSA 4 commands and events in hci.h
From: Marcel Holtmann @ 2013-10-02 16:57 UTC (permalink / raw)
To: Dohyun Pyun; +Cc: linux-bluetooth, steve.jun
In-Reply-To: <1380718493-4577-1-git-send-email-dh79.pyun@samsung.com>
Hi Dohyun,
> This patchset contains several HCI commands and events addition.
> These HCI commands and events are included in Bluetooth Core
> Specification Addendum 4, and it will be used to implement 3DS
> profile.
>
> Also I'm still implementing 3DS profile's master role in the BR/EDR
> controller. Summit and I'll send the patchsets about 3DS MGMT APIs
> soon.
>
> Regards,
> Pyun
>
> * Rebased the patchsets
> * Modify the subject and commit message
>
> ----------------------------------------------------------------
> DoHyun Pyun (8):
> Bluetooth: Add the definition and structure for Set Reserved LT_ADDR
> Bluetooth: Add the definition and structure for Delete Reserved LT_ADDR
> Bluetooth: Add the definition and structure for Set CSB Data
> Bluetooth: Add the structure for Write Sync Train Parameters
> Bluetooth: Add the definition and structure for Set CSB
> Bluetooth: Add the definition for Start Synchronization Train
> Bluetooth: Add the definition and stcuture for Sync Train Complete
> Bluetooth: Add the definition for Slave Page Response Timeout
>
> include/net/bluetooth/hci.h | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 69 insertions(+)
I applied all 8 patches to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH] Regression fix revert: "Bluetooth: Add missing reset_resume dev_pm_ops"
From: Gustavo Padovan @ 2013-10-02 19:02 UTC (permalink / raw)
To: Hans de Goede
Cc: USB list, linux-bluetooth, Shuah Khan, Gustavo Padovan, stable
In-Reply-To: <1380374739-11581-1-git-send-email-hdegoede@redhat.com>
Hi Hans,
2013-09-28 Hans de Goede <hdegoede@redhat.com>:
> Many btusb devices have 2 modes, a hid mode and a bluetooth hci mode. These
> devices default to hid mode for BIOS use. This means that after having been
> reset they will revert to HID mode, and are no longer usable as a HCI.
>
> Therefor it is a very bad idea to just blindly make reset_resume point to
> the regular resume handler. Note that the btusb driver has no clue how to
> switch these devices from hid to hci mode, this is done in userspace through
> udev rules, so the proper way to deal with this is to not have a reset-resume
> handler and instead let the usb-system re-enumerate the device, and re-run
> the udev rules.
>
> I must also note, that the commit message for the commit causing this
> problem has a very weak motivation for the change:
>
> "Add missing reset_resume dev_pm_ops. Missing reset_resume results in the
> following message after power management device test. This change sets
> reset_resume to btusb_resume().
>
> [ 2506.936134] btusb 1-1.5:1.0: no reset_resume for driver btusb?
> [ 2506.936137] btusb 1-1.5:1.1: no reset_resume for driver btusb?"
>
> Making a change solely to silence a warning while also changing important
> behavior (normal resume handling versus re-enumeration) requires a commit
> message with a proper explanation why it is safe to do so, which clearly lacks
> here, and unsurprisingly it turns out to not be safe to make this change.
>
> Reverting the commit in question fixes bt no longer working on my Dell
> E6430 after a suspend/resume, and I believe it likely also fixes the
> following bugs:
> https://bugzilla.redhat.com/show_bug.cgi?id=988481
> https://bugzilla.redhat.com/show_bug.cgi?id=1010649
> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1213239
>
> This reverts commit 502f769662978a2fe99d0caed5e53e3006107381.
>
> Cc: Shuah Khan <shuah.kh@samsung.com>
> Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> Cc: stable@vger.kernel.org
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> drivers/bluetooth/btusb.c | 1 -
> 1 file changed, 1 deletion(-)
Patch has been applied to bluetooth.git. Thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH] Bluetooth: Fix memory leak with L2CAP signal channels
From: Gustavo Padovan @ 2013-10-02 20:22 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1380727701-44925-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
2013-10-02 Marcel Holtmann <marcel@holtmann.org>:
> The wrong type of L2CAP signalling packets on the wrong type of
> either BR/EDR or LE links need to be dropped. When that happens
> the packet is dropped, but the memory not freed. So actually
> free the memory as well.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/l2cap_core.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Patch has been applied to bluetooth-next. Thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH] hid2hci: fix regression in /dev format after moving away from libusb
From: Marcel Holtmann @ 2013-10-03 3:37 UTC (permalink / raw)
To: Giovanni Campagna; +Cc: linux-bluetooth
In-Reply-To: <1380729616-26519-1-git-send-email-scampa.giovanni@gmail.com>
Hi Giovanni,
> The paths under /dev, in the default udev configuration, are formatted
> with two leading zeros, but the number obtained from sysfs don't have
> them, so we must convert them to integers and reformat them.
>
> Signed-off-by: Giovanni Campagna <scampa.giovanni@gmail.com>
no signed-off for userspace patches. We only do that for kernel patches.
> ---
> tools/hid2hci.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/tools/hid2hci.c b/tools/hid2hci.c
> index bb8a521..76d0b5a 100644
> --- a/tools/hid2hci.c
> +++ b/tools/hid2hci.c
> @@ -221,18 +221,21 @@ static int usb_switch_dell(int fd, enum mode mode)
> static int find_device(struct udev_device *udev_dev)
> {
> char path[PATH_MAX];
> - const char *busnum, *devnum;
> + const char *busnum_s, *devnum_s;
Use the suffix _str to make clear what it is.
> + int busnum, devnum;
> int fd;
>
> - busnum = udev_device_get_sysattr_value(udev_dev, "busnum");
> - if (!busnum)
> + busnum_s = udev_device_get_sysattr_value(udev_dev, "busnum");
> + if (!busnum_s)
> return -1;
> + busnum = strtol(busnum_s, NULL, 10);
>
> - devnum = udev_device_get_sysattr_value(udev_dev, "devnum");
> - if (!devnum)
> + devnum_s = udev_device_get_sysattr_value(udev_dev, "devnum");
> + if (!devnum_s)
> return -1;
> + devnum = strtol(devnum_s, NULL, 10);
>
> - snprintf(path, sizeof(path), "/dev/bus/usb/%s/%s", busnum, devnum);
> + snprintf(path, sizeof(path), "/dev/bus/usb/%03d/%03d", busnum, devnum);
Regards
Marcel
^ permalink raw reply
* Re: [PATCH] Regression fix revert: "Bluetooth: Add missing reset_resume dev_pm_ops"
From: Marcel Holtmann @ 2013-10-03 3:39 UTC (permalink / raw)
To: Gustavo Padovan
Cc: Hans de Goede, USB list, linux-bluetooth, Shuah Khan,
Gustavo Padovan, stable
In-Reply-To: <20131002190248.GB3130@joana>
Hi Gustavo,
>> Many btusb devices have 2 modes, a hid mode and a bluetooth hci mode. These
>> devices default to hid mode for BIOS use. This means that after having been
>> reset they will revert to HID mode, and are no longer usable as a HCI.
>>
>> Therefor it is a very bad idea to just blindly make reset_resume point to
>> the regular resume handler. Note that the btusb driver has no clue how to
>> switch these devices from hid to hci mode, this is done in userspace through
>> udev rules, so the proper way to deal with this is to not have a reset-resume
>> handler and instead let the usb-system re-enumerate the device, and re-run
>> the udev rules.
>>
>> I must also note, that the commit message for the commit causing this
>> problem has a very weak motivation for the change:
>>
>> "Add missing reset_resume dev_pm_ops. Missing reset_resume results in the
>> following message after power management device test. This change sets
>> reset_resume to btusb_resume().
>>
>> [ 2506.936134] btusb 1-1.5:1.0: no reset_resume for driver btusb?
>> [ 2506.936137] btusb 1-1.5:1.1: no reset_resume for driver btusb?"
>>
>> Making a change solely to silence a warning while also changing important
>> behavior (normal resume handling versus re-enumeration) requires a commit
>> message with a proper explanation why it is safe to do so, which clearly lacks
>> here, and unsurprisingly it turns out to not be safe to make this change.
>>
>> Reverting the commit in question fixes bt no longer working on my Dell
>> E6430 after a suspend/resume, and I believe it likely also fixes the
>> following bugs:
>> https://bugzilla.redhat.com/show_bug.cgi?id=988481
>> https://bugzilla.redhat.com/show_bug.cgi?id=1010649
>> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1213239
>>
>> This reverts commit 502f769662978a2fe99d0caed5e53e3006107381.
>>
>> Cc: Shuah Khan <shuah.kh@samsung.com>
>> Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>> drivers/bluetooth/btusb.c | 1 -
>> 1 file changed, 1 deletion(-)
>
> Patch has been applied to bluetooth.git. Thanks.
why? Because we have one broken Dell Bluetooth dongle. Do we actually know how this affects other chips. The dell HID Proxy thing has always been special case and that is Dell's fault. Look at the extra code that we have in hid2hci tool and its udev rules for Dell hardware. Is anybody actually willing to investigate this one properly.
Regards
Marcel
^ permalink raw reply
* [PATCH 1/2] Bluetooth: Restrict loading of link keys to BR/EDR capable controllers
From: Marcel Holtmann @ 2013-10-03 4:16 UTC (permalink / raw)
To: linux-bluetooth
Loading link keys into a LE only controller make no sense. The kernel
would never use any of these keys. So instead of allowing userspace
to waste memory, reject such operation with a not supported error
message.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/mgmt.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 3b3ed05..273ea8f 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1821,6 +1821,12 @@ static int load_link_keys(struct sock *sk, struct hci_dev *hdev, void *data,
u16 key_count, expected_len;
int i;
+ BT_DBG("request for %s", hdev->name);
+
+ if (!lmp_bredr_capable(hdev))
+ return cmd_status(sk, hdev->id, MGMT_OP_LOAD_LINK_KEYS,
+ MGMT_STATUS_NOT_SUPPORTED);
+
key_count = __le16_to_cpu(cp->key_count);
expected_len = sizeof(*cp) + key_count *
--
1.8.3.1
^ permalink raw reply related
* [PATCH 2/2] Bluetooth: Restrict loading of long term keys to LE capable controllers
From: Marcel Holtmann @ 2013-10-03 4:16 UTC (permalink / raw)
To: linux-bluetooth
Loading long term keys into a BR/EDR only controller make no sense.
The kernel would never use any of these keys. So instead of allowing
userspace to waste memory, reject such operation with a not supported
error message.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/mgmt.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 273ea8f..03fca4c 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3551,6 +3551,12 @@ static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev,
u16 key_count, expected_len;
int i, err;
+ BT_DBG("request for %s", hdev->name);
+
+ if (!lmp_le_capable(hdev))
+ return cmd_status(sk, hdev->id, MGMT_OP_LOAD_LONG_TERM_KEYS,
+ MGMT_STATUS_NOT_SUPPORTED);
+
key_count = __le16_to_cpu(cp->key_count);
expected_len = sizeof(*cp) + key_count *
--
1.8.3.1
^ permalink raw reply related
* [PATCH] Bluetooth: Restrict SSP setting changes to BR/EDR enabled controllers
From: Marcel Holtmann @ 2013-10-03 4:29 UTC (permalink / raw)
To: linux-bluetooth
Only when BR/EDR is supported and enabled, allow changing of the SSP
setting. Just checking if the hardware supports SSP is not enough
since it might be the case that BR/EDR is disabled.
In the case that BR/EDR is disabled, but SSP supported by the
controller the not supported error message is now returned.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/mgmt.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 03fca4c..d15a184 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1296,11 +1296,16 @@ static int set_ssp(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
{
struct mgmt_mode *cp = data;
struct pending_cmd *cmd;
- u8 val;
+ u8 val, status;
int err;
BT_DBG("request for %s", hdev->name);
+ status = mgmt_bredr_support(hdev);
+ if (status)
+ return cmd_status(sk, hdev->id, MGMT_OP_SET_SSP,
+ status);
+
if (!lmp_ssp_capable(hdev))
return cmd_status(sk, hdev->id, MGMT_OP_SET_SSP,
MGMT_STATUS_NOT_SUPPORTED);
--
1.8.3.1
^ permalink raw reply related
* [PATCH v2] Bluetooth: Restrict SSP setting changes to BR/EDR enabled controllers
From: Marcel Holtmann @ 2013-10-03 4:31 UTC (permalink / raw)
To: linux-bluetooth
Only when BR/EDR is supported and enabled, allow changing of the SSP
setting. Just checking if the hardware supports SSP is not enough
since it might be the case that BR/EDR is disabled.
In the case that BR/EDR is disabled, but SSP supported by the
controller the not supported error message is now returned.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/mgmt.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 03fca4c..e93d19a 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1296,11 +1296,15 @@ static int set_ssp(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
{
struct mgmt_mode *cp = data;
struct pending_cmd *cmd;
- u8 val;
+ u8 val, status;
int err;
BT_DBG("request for %s", hdev->name);
+ status = mgmt_bredr_support(hdev);
+ if (status)
+ return cmd_status(sk, hdev->id, MGMT_OP_SET_SSP, status);
+
if (!lmp_ssp_capable(hdev))
return cmd_status(sk, hdev->id, MGMT_OP_SET_SSP,
MGMT_STATUS_NOT_SUPPORTED);
--
1.8.3.1
^ permalink raw reply related
* [PATCH] Bluetooth: Reject device class changes when BR/EDR is not available
From: Marcel Holtmann @ 2013-10-03 4:39 UTC (permalink / raw)
To: linux-bluetooth
On LE only controllers or dual mode controllers with BR/EDR disabled,
it makes no sense to allow programming of the minor and major class
values. In these cases, just reject the operation.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/mgmt.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index e93d19a..9dbf185 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1753,13 +1753,14 @@ static int set_dev_class(struct sock *sk, struct hci_dev *hdev, void *data,
struct mgmt_cp_set_dev_class *cp = data;
struct pending_cmd *cmd;
struct hci_request req;
+ u8 status;
int err;
BT_DBG("request for %s", hdev->name);
- if (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags))
- return cmd_status(sk, hdev->id, MGMT_OP_SET_DEV_CLASS,
- MGMT_STATUS_NOT_SUPPORTED);
+ status = mgmt_bredr_support(hdev);
+ if (status)
+ return cmd_status(sk, hdev->id, MGMT_OP_SET_DEV_CLASS, status);
hci_dev_lock(hdev);
--
1.8.3.1
^ permalink raw reply related
* [PATCH] Bluetooth: Clear class of device when BR/EDR is disabled
From: Marcel Holtmann @ 2013-10-03 4:53 UTC (permalink / raw)
To: linux-bluetooth
Since it is possible to disable BR/EDR on dual-mode controllers, some
extra care needs to be taken for the class of device value. When BR/EDR
is disabled, the value should be set to its default. And properly
restored in case BR/EDR get re-enabled later on.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/mgmt.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 9dbf185..5c44e30 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -642,9 +642,15 @@ static void update_class(struct hci_request *req)
if (test_bit(HCI_SERVICE_CACHE, &hdev->dev_flags))
return;
- cod[0] = hdev->minor_class;
- cod[1] = hdev->major_class;
- cod[2] = get_service_classes(hdev);
+ if (test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags)) {
+ cod[0] = hdev->minor_class;
+ cod[1] = hdev->major_class;
+ cod[2] = get_service_classes(hdev);
+ } else {
+ cod[0] = 0x00;
+ cod[1] = 0x00;
+ cod[2] = 0x00;
+ }
if (memcmp(cod, hdev->dev_class, 3) == 0)
return;
@@ -3523,12 +3529,16 @@ static int set_bredr(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
}
/* We need to flip the bit already here so that hci_update_ad
- * generates the correct flags.
+ * generates the correct flags and update_class sets the correct
+ * class of device information.
*/
set_bit(HCI_BREDR_ENABLED, &hdev->dev_flags);
hci_req_init(&req, hdev);
+
+ update_class(&req);
hci_update_ad(&req);
+
err = hci_req_run(&req, set_bredr_complete);
if (err < 0)
mgmt_pending_remove(cmd);
--
1.8.3.1
^ permalink raw reply related
* [PATCH] Bluetooth: Allow setting static address even if LE is disabled
From: Marcel Holtmann @ 2013-10-03 5:10 UTC (permalink / raw)
To: linux-bluetooth
Setting the static address does not depend on LE beeing enabled. It
only depends on a controller with LE support.
When depending on LE enabled this command becomes really complicated
since in case LE gets disabled, it would be required to clear the
static address and also its random address representation inside
the controller. With future support for private addresses such
complex setup should be avoided.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/mgmt.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 5c44e30..a336027 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3293,15 +3293,13 @@ static int set_static_address(struct sock *sk, struct hci_dev *hdev,
void *data, u16 len)
{
struct mgmt_cp_set_static_address *cp = data;
- u8 status;
int err;
BT_DBG("%s", hdev->name);
- status = mgmt_le_support(hdev);
- if (status)
+ if (!lmp_le_capable(hdev))
return cmd_status(sk, hdev->id, MGMT_OP_SET_STATIC_ADDRESS,
- status);
+ MGMT_STATUS_NOT_SUPPORTED);
if (hdev_is_powered(hdev))
return cmd_status(sk, hdev->id, MGMT_OP_SET_STATIC_ADDRESS,
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH 1/2] Bluetooth: Restrict loading of link keys to BR/EDR capable controllers
From: Johan Hedberg @ 2013-10-03 6:34 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1380773768-12958-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Wed, Oct 02, 2013, Marcel Holtmann wrote:
> Loading link keys into a LE only controller make no sense. The kernel
> would never use any of these keys. So instead of allowing userspace
> to waste memory, reject such operation with a not supported error
> message.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/mgmt.c | 6 ++++++
> 1 file changed, 6 insertions(+)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH 2/2] Bluetooth: Restrict loading of long term keys to LE capable controllers
From: Johan Hedberg @ 2013-10-03 6:34 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1380773768-12958-2-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Wed, Oct 02, 2013, Marcel Holtmann wrote:
> Loading long term keys into a BR/EDR only controller make no sense.
> The kernel would never use any of these keys. So instead of allowing
> userspace to waste memory, reject such operation with a not supported
> error message.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/mgmt.c | 6 ++++++
> 1 file changed, 6 insertions(+)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH v2] Bluetooth: Restrict SSP setting changes to BR/EDR enabled controllers
From: Johan Hedberg @ 2013-10-03 6:34 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1380774712-13370-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Wed, Oct 02, 2013, Marcel Holtmann wrote:
> Only when BR/EDR is supported and enabled, allow changing of the SSP
> setting. Just checking if the hardware supports SSP is not enough
> since it might be the case that BR/EDR is disabled.
>
> In the case that BR/EDR is disabled, but SSP supported by the
> controller the not supported error message is now returned.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/mgmt.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH] Bluetooth: Allow setting static address even if LE is disabled
From: Johan Hedberg @ 2013-10-03 6:35 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1380777032-23598-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Wed, Oct 02, 2013, Marcel Holtmann wrote:
> Setting the static address does not depend on LE beeing enabled. It
> only depends on a controller with LE support.
>
> When depending on LE enabled this command becomes really complicated
> since in case LE gets disabled, it would be required to clear the
> static address and also its random address representation inside
> the controller. With future support for private addresses such
> complex setup should be avoided.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/mgmt.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* [PATCH] Bluetooth: Allow changing device class when BR/EDR is disabled
From: Marcel Holtmann @ 2013-10-03 6:37 UTC (permalink / raw)
To: linux-bluetooth
Changing the device class when BR/EDR is disabled has no visible
effect for remote devices. However to simplify the logic allow it
as long as the controller supports BR/EDR operations.
If it is not allowed, then the overall logic becomes rather
complicated since the class of device values would need clearing
or restoring when BR/EDR setting changes.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/mgmt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 4ce0f11..16125ff9 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1757,7 +1757,7 @@ static int set_dev_class(struct sock *sk, struct hci_dev *hdev, void *data,
BT_DBG("request for %s", hdev->name);
- if (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags))
+ if (!lmp_bredr_capable(hdev))
return cmd_status(sk, hdev->id, MGMT_OP_SET_DEV_CLASS,
MGMT_STATUS_NOT_SUPPORTED);
--
1.8.3.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox