Revert "Bluetooth: Always enable management interface"
Subsystems (2)
PATCH 1/1 Revert "Bluetooth: Always enable management interface"
This reverts commit 4b95a24ce12c4545fd7d2e3075841dc3119d1d71.
My USB bluetooth device does not show up with this patch in place.
---
This patch seems so innocuous, but when added to the kernel, it keeps my USB bluetooth device from appearing to user mode at all. With the mgmt interface enabled:
$ hcitool dev Devices:
With this patch reverted:
$ hcitool dev Devices: hci0 04:0C:CE:DF:7B:C9
I bisected to this revision, and then reverted it on top of version
v3.3-6972-ge22057c e22057c8599373e5caef0bc42bdb95d2a361ab0d
(which is where I'm trying to move drm-intel-fixes to)
I think this is the third consecutive merge window that has broken my bluetooth interface in some way? At least I know enough to check now...
net/bluetooth/hci_sock.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
net/bluetooth/hci_sock.c +6 -1
@@ -50,6 +50,8 @@#include <net/bluetooth/hci_core.h> #include <net/bluetooth/hci_mon.h> +static bool enable_mgmt; +static atomic_t monitor_promisc =ATOMIC_INIT (0 );/* ----- HCI socket interface ----- */
@@ -649,7 +651,7 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_lebreak ;case HCI_CHANNEL_CONTROL : -if (haddr.hci_dev !=HCI_DEV_NONE ) { +if (haddr.hci_dev !=HCI_DEV_NONE || !enable_mgmt) { err = -EINVAL ; goto done; }
@@ -1127,3 +1129,6 @@ void hci_sock_cleanup(void)proto_unregister (&hci_sk_proto); } + +module_param (enable_mgmt, bool,0644 ); +MODULE_PARM_DESC (enable_mgmt,"Enable Management interface" );
Signature · 1 line
1.7.9
From: Keith Packard <[email protected]>
Date: Wed, 28 Mar 2012 18:19:18 -0700
Quoted 5 lines
This reverts commit
4b95a24ce12c4545fd7d2e3075841dc3119d1d71.My USB bluetooth device does not show up with this patch in place.
Signed-off-by Keith Packard <[email protected]>
Bluetooth folks please look over this, thanks.
Marcel Holtmann
maintainerHi Keith,
Quoted 11 lines
This reverts commit
4b95a24ce12c4545fd7d2e3075841dc3119d1d71.My USB bluetooth device does not show up with this patch in place.
Signed-off-by Keith Packard <[email protected]>---
This patch seems so innocuous, but when added to the kernel, it keeps my USB bluetooth device from appearing to user mode at all. With the mgmt interface enabled:
Quoted 8 lines
$ hcitool dev Devices:With this patch reverted:
$ hcitool dev Devices: hci0 04:0C:CE:DF:7B:C9
so this is seriously strange and I don't have an explanation for it right now. Something breaking on this level means that Bluetooth devices are not even registered. And that would be an obvious bug to detect.
Can you check with hciconfig -a if the device is actually there, but might have some weird flags set.
Quoted 27 lines
I bisected to this revision, and then reverted it on top of version
v3.3-6972-ge22057c e22057c8599373e5caef0bc42bdb95d2a361ab0d(which is where I'm trying to move drm-intel-fixes to)
I think this is the third consecutive merge window that has broken my bluetooth interface in some way? At least I know enough to check now...
net/bluetooth/hci_sock.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)net/bluetooth/hci_sock.c +2
-0@@ -50,6 +50,8 @@#include <net/bluetooth/hci_core.h> #include <net/bluetooth/hci_mon.h> +static bool enable_mgmt; +static atomic_t monitor_promisc =ATOMIC_INIT (0 );/* ----- HCI socket interface ----- */
net/bluetooth/hci_sock.c static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_le · line 657
Quoted 8 lines
net/bluetooth/hci_sock.c +1
-1@@ -649,7 +651,7 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_lebreak ;case HCI_CHANNEL_CONTROL : -if (haddr.hci_dev !=HCI_DEV_NONE ) { +if (haddr.hci_dev !=HCI_DEV_NONE || !enable_mgmt) { err = -EINVAL ; goto done; }
I have no idea on how this can break anything for you. Since tools like hcitool and hciconfig use HCI_CHANNEL_RAW. This must be a nasty side effect somewhere if this is really fix it for you.
Can you start your bluetoothd with -P mgmtops to check if this might be causing some side effects.
Regards
Marcel
Hi Keith,
Quoted 10 lines · Keith Packard
This reverts commit
4b95a24ce12c4545fd7d2e3075841dc3119d1d71.My USB bluetooth device does not show up with this patch in place.
Signed-off-by Keith Packard <[email protected]>---
This patch seems so innocuous, but when added to the kernel, it keeps my USB bluetooth device from appearing to user mode at all. With the mgmt interface enabled:
It is because it changes the way the userspace <-> kernel interface. We added a new interface and that flag was preventing the code to use it by default, but now that we finished to implement the new interface it will be enabled by default.
A consequence is that you'll need to use newer version of bluez, at least 4.99. Or call the bluetooth daemon (from a pre 4.99 version) with a parameter to disable the new interface:
$ bluetoothd -P mgmtops
Then your bluetooth will be back.
Gustavo
<#part sign=pgpmime>
Quoted 3 lines · Gustavo Padovan
A consequence is that you'll need to use newer version of bluez, at least 4.99. Or call the bluetooth daemon (from a pre 4.99 version) with a parameter to disable the new interface:
That's not OK -- you're breaking user space with this kernel change. I know I get bashed every time I suggest that we 'fix' the kernel and require new user space X bits...
Signature · 1 line
[email protected]
Marcel Holtmann
maintainerHi Keith,
Quoted 7 lines
Quoted 3 lines
A consequence is that you'll need to use newer version of bluez, at least 4.99. Or call the bluetooth daemon (from a pre 4.99 version) with a parameter to disable the new interface:
That's not OK -- you're breaking user space with this kernel change. I know I get bashed every time I suggest that we 'fix' the kernel and require new user space X bits...
I think we actually have a broken user space in this case. I do have a hunch on what went wrong. It is not the kernel's fault here.
If I am anywhere right, then bluetoothd fails to bring up the device. That is why you don't see anything with "hcitool dev", but the device should be present. Check "hciconfig -a".
Check your bluetoothd startup line and add "-P mgmtops". That will disable the broken plugin.
Regards
Marcel
<#part sign=pgpmime>
Quoted 3 lines · Gustavo Padovan
$ bluetoothd -P mgmtopsThen your bluetooth will be back.
Indeed. Please fix the kernel so that existing user space works again.
Signature · 1 line
[email protected]
From: Marcel Holtmann <[email protected]>
Date: Thu, 29 Mar 2012 05:33:42 +0200
Quoted 2 lines
I think we actually have a broken user space in this case. I do have a hunch on what went wrong. It is not the kernel's fault here.
I call bullshit.
It doesn't matter what userspace is doing, "broken" or however you want to call it. The bluez on everyone's computer broke because of the kernel change.
Therefore you must revert the kernel change or modify it so that existing userland continues to work properly.
There is no other proper course of action.
And to think, I gave you bluetooth guys shit because of coding style problems, that appears to have been just the tip of the iceberg.
From: Keith Packard <[email protected]>
Date: Wed, 28 Mar 2012 19:35:44 -0700
Quoted 8 lines
<#part sign=pgpmime>
Quoted 3 lines · Gustavo Padovan
A consequence is that you'll need to use newer version of bluez, at least 4.99. Or call the bluetooth daemon (from a pre 4.99 version) with a parameter to disable the new interface:
That's not OK -- you're breaking user space with this kernel change.
+1
From: Gustavo Padovan <[email protected]>
Date: Wed, 28 Mar 2012 23:28:39 -0300
Quoted 2 lines
A consequence is that you'll need to use newer version of bluez, at least 4.99.
That's complete bullshit and you know it.
Existing userspace worked, you guys broke it with a kernel change.
Therefore the kernel change needs to be reverted.
Hi Keith,
Quoted 10 lines · Keith Packard
<#part sign=pgpmime>
Quoted 3 lines · Gustavo Padovan
A consequence is that you'll need to use newer version of bluez, at least 4.99. Or call the bluetooth daemon (from a pre 4.99 version) with a parameter to disable the new interface:
That's not OK -- you're breaking user space with this kernel change. I know I get bashed every time I suggest that we 'fix' the kernel and require new user space X bits...
Can you try the following patch? It should fix the compatibility problem you had.
Gustavo
--
commit d21c1177b9cf067809ccee2746633cfea3a8b062
Author: Gustavo Padovan <[email protected]> Date: Thu Mar 29 09:47:53 2012 -0300
Bluetooth: Fix userspace compatibility issue with mgmt interface
To ensure that old user space versions do not accidentally pick up and try to use the management channel, use a different channel number.
include/net/bluetooth/hci.h +1 -1
@@ -1327,8 +1327,8 @@ struct sockaddr_hci {#define HCI_DEV_NONE 0xffff#define HCI_CHANNEL_RAW 0 -#define HCI_CHANNEL_CONTROL 1#define HCI_CHANNEL_MONITOR 2 +#define HCI_CHANNEL_CONTROL 3struct hci_filter {unsigned long type_mask;
Hi Keith,
Quoted 11 lines · Gustavo Padovan
Hi Keith,
Quoted 7 lines · Keith Packard
<#part sign=pgpmime>
Quoted 3 lines · Gustavo Padovan
A consequence is that you'll need to use newer version of bluez, at least 4.99. Or call the bluetooth daemon (from a pre 4.99 version) with a parameter to disable the new interface:
Quoted 5 lines
Quoted 3 lines
That's not OK -- you're breaking user space with this kernel change. I know I get bashed every time I suggest that we 'fix' the kernel and require new user space X bits...
Can you try the following patch? It should fix the compatibility problem you had.
Did you had chance to test this patch?
Gustavo
Quoted 29 lines
commit
d21c1177b9cf067809ccee2746633cfea3a8b062Author: Gustavo Padovan <[email protected]> Date: Thu Mar 29 09:47:53 2012 -0300Bluetooth: Fix userspace compatibility issue with mgmt interface
To ensure that old user space versions do not accidentally pick up and try to use the management channel, use a different channel number.
Reported-by Keith Packard <[email protected]>Acked-by Johan Hedberg <[email protected]>Acked-by Marcel Holtmann <[email protected]>Signed-off-by Gustavo Padovan <[email protected]>include/net/bluetooth/hci.h +1
-1@@ -1327,8 +1327,8 @@ struct sockaddr_hci {#define HCI_DEV_NONE 0xffff#define HCI_CHANNEL_RAW 0 -#define HCI_CHANNEL_CONTROL 1#define HCI_CHANNEL_MONITOR 2 +#define HCI_CHANNEL_CONTROL 3struct hci_filter {unsigned long type_mask;
<#part sign=pgpmime>
Quoted 2 lines · Gustavo Padovan
Can you try the following patch? It should fix the compatibility problem you had.
Yes, the kernel with that patch (without the revert) works now.
Signature · 1 line
[email protected]
Hi Keith,
Quoted 7 lines · Keith Packard
<#part sign=pgpmime>
Quoted 2 lines · Gustavo Padovan
Can you try the following patch? It should fix the compatibility problem you had.
Yes, the kernel with that patch (without the revert) works now.
Thanks for testing, I will push this to mainline ASAP.
Gustavo