* 3.10-rc: bluetooth disappeared on thinkpad x60 (regression)
@ 2013-06-10 9:29 Pavel Machek
2013-06-10 10:05 ` Johan Hedberg
0 siblings, 1 reply; 13+ messages in thread
From: Pavel Machek @ 2013-06-10 9:29 UTC (permalink / raw)
To: Rafael J. Wysocki, kernel list, marcel, gustavo, johan.hedberg,
linux-bluetooth
Hi!
>From start of 3.10-rc series, bluetooth seems to be gone on thinkpad
x60.
root@amd:~# uname -a
Linux amd 3.10.0-rc5+ #261 SMP Mon Jun 10 02:59:55 CEST 2013 i686
GNU/Linux
pavel@amd:~$ lsusb
Bus 005 Device 003: ID 0483:2016 SGS Thomson Microelectronics
Fingerprint Reader
Bus 005 Device 002: ID 0a5c:2110 Broadcom Corp. Bluetooth Controller
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 007: ID 046d:c05a Logitech, Inc. Optical Mouse M90
Bus 001 Device 006: ID 04f2:0111 Chicony Electronics Co., Ltd KU-9908
Keyboard
Bus 001 Device 003: ID 17ef:1000 Lenovo
Bus 001 Device 002: ID 0421:01c7 Nokia Mobile Phones N900 (Storage
Mode)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@amd:~# hciconfig hci0 up
Can't init device hci0: Operation not supported (95)
root@amd:~# hcitool inq
Inquiring ...
Inquiry failed.: No such device
root@amd:~#
(This is regression from 3.9.)
dmesg does not show much:
thinkpad_acpi: rfkill switch tpacpi_bluetooth_sw: radio is unblocked
thinkpad_acpi: warning: userspace override of important firmware LEDs
is enabled
thinkpad_acpi: Standard ACPI backlight interface available, not
loading native one
thinkpad_acpi: volume: disabled as there is no ALSA support in this
kernel
Bluetooth LED is on (and wifi works), so it is not hardware kill
switch.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: 3.10-rc: bluetooth disappeared on thinkpad x60 (regression) 2013-06-10 9:29 3.10-rc: bluetooth disappeared on thinkpad x60 (regression) Pavel Machek @ 2013-06-10 10:05 ` Johan Hedberg 2013-06-10 11:04 ` Pavel Machek 0 siblings, 1 reply; 13+ messages in thread From: Johan Hedberg @ 2013-06-10 10:05 UTC (permalink / raw) To: Pavel Machek Cc: Rafael J. Wysocki, kernel list, marcel, gustavo, linux-bluetooth Hi Pavel, On Mon, Jun 10, 2013, Pavel Machek wrote: > root@amd:~# hciconfig hci0 up > Can't init device hci0: Operation not supported (95) > root@amd:~# hcitool inq > Inquiring ... > Inquiry failed.: No such device > root@amd:~# Could you take logs of the HCI traffic that happens when you try this. You can use the btmon tool from BlueZ for it. Based on a quick look at the code it seems like this particular error could only come if one of the HCI commands used for device initialization fails. The Bluetooth HCI init sequence is constructed using only commands that should be expected to work assuming the hardware follows the specification, but occasionally we do encounter Bluetooth hardware that is broken in one way or another and needs a work around to the sequence. E.g. recently we added a couple of extra commands to read some new parameters from the hardware, commands that are mandatory for hardware beyond a specific version (something we check for), but could be that the chip on the X60 doesn't support these. Anyway, once we see what exactly is failing in the HCI logs we can make an adjustment to the conditions that the failing commands depend on, which in the worst case will be a device specific quirk based on the USB id of your hardware. Johan ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: 3.10-rc: bluetooth disappeared on thinkpad x60 (regression) 2013-06-10 10:05 ` Johan Hedberg @ 2013-06-10 11:04 ` Pavel Machek 2013-06-10 11:59 ` Johan Hedberg 0 siblings, 1 reply; 13+ messages in thread From: Pavel Machek @ 2013-06-10 11:04 UTC (permalink / raw) To: Rafael J. Wysocki, kernel list, marcel, gustavo, linux-bluetooth Hi! > > root@amd:~# hciconfig hci0 up > > Can't init device hci0: Operation not supported (95) > > root@amd:~# hcitool inq > > Inquiring ... > > Inquiry failed.: No such device > > root@amd:~# > > Could you take logs of the HCI traffic that happens when you try this. > You can use the btmon tool from BlueZ for it. Based on a quick look at > the code it seems like this particular error could only come if one of > the HCI commands used for device initialization fails. Where can I get btmon? I tried root@amd:~# apt-get install bluez-utils but it is not there. (Can I just add printk somewhere?) > The Bluetooth HCI init sequence is constructed using only commands that > should be expected to work assuming the hardware follows the > specification, but occasionally we do encounter Bluetooth hardware that > is broken in one way or another and needs a work around to the sequence. > E.g. recently we added a couple of extra commands to read some new > parameters from the hardware, commands that are mandatory for hardware > beyond a specific version (something we check for), but could be that > the chip on the X60 doesn't support these. I don't expect strace is enough? set_thread_area({entry_number:-1 -> 6, base_addr:0xb7624b20, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0 mprotect(0xb7766000, 8192, PROT_READ) = 0 mprotect(0xb77b2000, 4096, PROT_READ) = 0 munmap(0xb7782000, 76642) = 0 socket(PF_BLUETOOTH, SOCK_RAW, 1) = 3 ioctl(3, 0x800448d3, 0xb77cc420) = 0 ioctl(3, 0x400448c9, 0) = -1 EOPNOTSUPP (Operation not supported) write(2, "Can't init device hci0: Operatio"..., 53Can't init device hci0: Operation not supported (95) ) = 53 exit_group(1) = ? root@amd:~# btmon Thanks, Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: 3.10-rc: bluetooth disappeared on thinkpad x60 (regression) 2013-06-10 11:04 ` Pavel Machek @ 2013-06-10 11:59 ` Johan Hedberg 2013-06-10 13:38 ` Pavel Machek 0 siblings, 1 reply; 13+ messages in thread From: Johan Hedberg @ 2013-06-10 11:59 UTC (permalink / raw) To: Pavel Machek Cc: Rafael J. Wysocki, kernel list, marcel, gustavo, linux-bluetooth Hi Pavel, On Mon, Jun 10, 2013, Pavel Machek wrote: > > > root@amd:~# hciconfig hci0 up > > > Can't init device hci0: Operation not supported (95) > > > root@amd:~# hcitool inq > > > Inquiring ... > > > Inquiry failed.: No such device > > > root@amd:~# > > > > Could you take logs of the HCI traffic that happens when you try this. > > You can use the btmon tool from BlueZ for it. Based on a quick look at > > the code it seems like this particular error could only come if one of > > the HCI commands used for device initialization fails. > > Where can I get btmon? I tried > > root@amd:~# apt-get install bluez-utils > > but it is not there. I can only speak from an upstream perspective (since I'm not familiar with distro-specific packaging conventions), but btmon is what you'll find in the monitor subdirectory of the bluez source tree. > (Can I just add printk somewhere?) If you want, the Bluetooth subsystem does support the dynamic debug feature, so you could enable logs for hci_core.c and hci_event.c. However, this will likely still not be enough and the HCI logs would anyway be needed. One thing to note is that btmon is a quite new tool which may not yet be packaged by your distro (it appeared in BlueZ 5, released 6 months ago). An alternative which should work too is hcidump, probably packed in a bluez-hcidump package on your distro. > > > The Bluetooth HCI init sequence is constructed using only commands that > > should be expected to work assuming the hardware follows the > > specification, but occasionally we do encounter Bluetooth hardware that > > is broken in one way or another and needs a work around to the sequence. > > E.g. recently we added a couple of extra commands to read some new > > parameters from the hardware, commands that are mandatory for hardware > > beyond a specific version (something we check for), but could be that > > the chip on the X60 doesn't support these. > > I don't expect strace is enough? > > set_thread_area({entry_number:-1 -> 6, base_addr:0xb7624b20, > limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, > limit_in_pages:1, seg_not_present:0, useable:1}) = 0 > mprotect(0xb7766000, 8192, PROT_READ) = 0 > mprotect(0xb77b2000, 4096, PROT_READ) = 0 > munmap(0xb7782000, 76642) = 0 > socket(PF_BLUETOOTH, SOCK_RAW, 1) = 3 > ioctl(3, 0x800448d3, 0xb77cc420) = 0 > ioctl(3, 0x400448c9, 0) = -1 EOPNOTSUPP (Operation not > supported) > write(2, "Can't init device hci0: Operatio"..., 53Can't init device > hci0: Operation not supported (95) > ) = 53 > exit_group(1) = ? Nope, that still doesn't show anything new compared to what we already know. The interesting part is what messages the kernel is exchanging with the Bluetooth hardware and the only way the get a full understanding of that is with btmon or hcidump. Johan ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: 3.10-rc: bluetooth disappeared on thinkpad x60 (regression) 2013-06-10 11:59 ` Johan Hedberg @ 2013-06-10 13:38 ` Pavel Machek 2013-06-10 16:07 ` Johan Hedberg 0 siblings, 1 reply; 13+ messages in thread From: Pavel Machek @ 2013-06-10 13:38 UTC (permalink / raw) To: Rafael J. Wysocki, kernel list, marcel, gustavo, linux-bluetooth Hi! > > (Can I just add printk somewhere?) > > If you want, the Bluetooth subsystem does support the dynamic debug > feature, so you could enable logs for hci_core.c and hci_event.c. > However, this will likely still not be enough and the HCI logs would > anyway be needed. One thing to note is that btmon is a quite new tool > which may not yet be packaged by your distro (it appeared in BlueZ 5, > released 6 months ago). An alternative which should work too is hcidump, > probably packed in a bluez-hcidump package on your distro. hcidump. Sounds good, I can do hcidump :-). I ran hcidump, while I did hciconfig hci0 up on other console. root@amd:~# hcidump hci0 HCI sniffer - Bluetooth packet analyzer ver 1.42 device: hci0 snap_len: 1028 filter: 0xffffffff < HCI Command: Reset (0x03|0x0003) plen 0 > HCI Event: Command Complete (0x0e) plen 4 < HCI Command: Read Local Supported Features (0x04|0x0003) plen 0 > HCI Event: Command Complete (0x0e) plen 12 < HCI Command: Read Local Version Information (0x04|0x0001) plen 0 > HCI Event: Command Complete (0x0e) plen 12 < HCI Command: Read BD ADDR (0x04|0x0009) plen 0 > HCI Event: Command Complete (0x0e) plen 10 < HCI Command: Read Buffer Size (0x04|0x0005) plen 0 > HCI Event: Command Complete (0x0e) plen 11 < HCI Command: Read Class of Device (0x03|0x0023) plen 0 > HCI Event: Command Complete (0x0e) plen 7 < HCI Command: Read Local Name (0x03|0x0014) plen 0 > HCI Event: Command Complete (0x0e) plen 252 < HCI Command: Read Voice Setting (0x03|0x0025) plen 0 > HCI Event: Command Complete (0x0e) plen 6 < HCI Command: Set Event Filter (0x03|0x0005) plen 1 > HCI Event: Command Complete (0x0e) plen 4 < HCI Command: Write Connection Accept Timeout (0x03|0x0016) plen 2 > HCI Event: Command Complete (0x0e) plen 4 < HCI Command: Delete Stored Link Key (0x03|0x0012) plen 7 > HCI Event: Command Complete (0x0e) plen 4 Now I turned off the bluetooth via hw switch (it disappeared from lsusb), turned it on, and same procedure: root@amd:~# hcidump hci0 HCI sniffer - Bluetooth packet analyzer ver 1.42 device: hci0 snap_len: 1028 filter: 0xffffffff < HCI Command: Reset (0x03|0x0003) plen 0 > HCI Event: Command Complete (0x0e) plen 4 < HCI Command: Read Local Supported Features (0x04|0x0003) plen 0 > HCI Event: Command Complete (0x0e) plen 12 < HCI Command: Read Local Version Information (0x04|0x0001) plen 0 > HCI Event: Command Complete (0x0e) plen 12 < HCI Command: Read BD ADDR (0x04|0x0009) plen 0 > HCI Event: Command Complete (0x0e) plen 10 < HCI Command: Read Buffer Size (0x04|0x0005) plen 0 > HCI Event: Command Complete (0x0e) plen 11 < HCI Command: Read Class of Device (0x03|0x0023) plen 0 > HCI Event: Command Complete (0x0e) plen 7 < HCI Command: Read Local Name (0x03|0x0014) plen 0 > HCI Event: Command Complete (0x0e) plen 252 < HCI Command: Read Voice Setting (0x03|0x0025) plen 0 > HCI Event: Command Complete (0x0e) plen 6 < HCI Command: Set Event Filter (0x03|0x0005) plen 1 > HCI Event: Command Complete (0x0e) plen 4 < HCI Command: Write Connection Accept Timeout (0x03|0x0016) plen 2 > HCI Event: Command Complete (0x0e) plen 4 < HCI Command: Delete Stored Link Key (0x03|0x0012) plen 7 > HCI Event: Command Complete (0x0e) plen 4 Hope this helps, Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: 3.10-rc: bluetooth disappeared on thinkpad x60 (regression) 2013-06-10 13:38 ` Pavel Machek @ 2013-06-10 16:07 ` Johan Hedberg 2013-06-10 19:37 ` Pavel Machek 0 siblings, 1 reply; 13+ messages in thread From: Johan Hedberg @ 2013-06-10 16:07 UTC (permalink / raw) To: Pavel Machek Cc: Rafael J. Wysocki, kernel list, marcel, gustavo, linux-bluetooth Hi Pavel, On Mon, Jun 10, 2013, Pavel Machek wrote: > I ran hcidump, while I did hciconfig hci0 up on other console. > > root@amd:~# hcidump hci0 > HCI sniffer - Bluetooth packet analyzer ver 1.42 > device: hci0 snap_len: 1028 filter: 0xffffffff > < HCI Command: Reset (0x03|0x0003) plen 0 > > HCI Event: Command Complete (0x0e) plen 4 > < HCI Command: Read Local Supported Features (0x04|0x0003) plen 0 > > HCI Event: Command Complete (0x0e) plen 12 > < HCI Command: Read Local Version Information (0x04|0x0001) plen 0 > > HCI Event: Command Complete (0x0e) plen 12 > < HCI Command: Read BD ADDR (0x04|0x0009) plen 0 > > HCI Event: Command Complete (0x0e) plen 10 > < HCI Command: Read Buffer Size (0x04|0x0005) plen 0 > > HCI Event: Command Complete (0x0e) plen 11 > < HCI Command: Read Class of Device (0x03|0x0023) plen 0 > > HCI Event: Command Complete (0x0e) plen 7 > < HCI Command: Read Local Name (0x03|0x0014) plen 0 > > HCI Event: Command Complete (0x0e) plen 252 > < HCI Command: Read Voice Setting (0x03|0x0025) plen 0 > > HCI Event: Command Complete (0x0e) plen 6 > < HCI Command: Set Event Filter (0x03|0x0005) plen 1 > > HCI Event: Command Complete (0x0e) plen 4 > < HCI Command: Write Connection Accept Timeout (0x03|0x0016) plen 2 > > HCI Event: Command Complete (0x0e) plen 4 > < HCI Command: Delete Stored Link Key (0x03|0x0012) plen 7 > > HCI Event: Command Complete (0x0e) plen 4 > > Hope this helps, It gives a better idea but is still lacking a bit of information since hcidump is by default quite restrictive in what it outputs. Could you try once more, but this time pass the -X and -V command line switches to hcidump. It should make it output the full set of parameters of the HCI commands and events. What I'd also ask is if you could make an additional binary HCI log in the btsnoop format so that we could analyze the log with btmon (which has better decoders than hcidump). You get hcidump to do this by passing "-B -w <filename>" as parameters and can verify that the produced file is correct by running hcidump -r <file>. Johan ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: 3.10-rc: bluetooth disappeared on thinkpad x60 (regression) 2013-06-10 16:07 ` Johan Hedberg @ 2013-06-10 19:37 ` Pavel Machek 2013-06-11 7:22 ` Johan Hedberg 0 siblings, 1 reply; 13+ messages in thread From: Pavel Machek @ 2013-06-10 19:37 UTC (permalink / raw) To: Rafael J. Wysocki, kernel list, marcel, gustavo, linux-bluetooth [-- Attachment #1: Type: text/plain, Size: 4802 bytes --] Hi! > > I ran hcidump, while I did hciconfig hci0 up on other console. > > > > root@amd:~# hcidump hci0 > > HCI sniffer - Bluetooth packet analyzer ver 1.42 > > device: hci0 snap_len: 1028 filter: 0xffffffff > > < HCI Command: Reset (0x03|0x0003) plen 0 > > > HCI Event: Command Complete (0x0e) plen 4 > > < HCI Command: Read Local Supported Features (0x04|0x0003) plen 0 > > > HCI Event: Command Complete (0x0e) plen 12 > > < HCI Command: Read Local Version Information (0x04|0x0001) plen 0 > > > HCI Event: Command Complete (0x0e) plen 12 > > < HCI Command: Read BD ADDR (0x04|0x0009) plen 0 > > > HCI Event: Command Complete (0x0e) plen 10 > > < HCI Command: Read Buffer Size (0x04|0x0005) plen 0 > > > HCI Event: Command Complete (0x0e) plen 11 > > < HCI Command: Read Class of Device (0x03|0x0023) plen 0 > > > HCI Event: Command Complete (0x0e) plen 7 > > < HCI Command: Read Local Name (0x03|0x0014) plen 0 > > > HCI Event: Command Complete (0x0e) plen 252 > > < HCI Command: Read Voice Setting (0x03|0x0025) plen 0 > > > HCI Event: Command Complete (0x0e) plen 6 > > < HCI Command: Set Event Filter (0x03|0x0005) plen 1 > > > HCI Event: Command Complete (0x0e) plen 4 > > < HCI Command: Write Connection Accept Timeout (0x03|0x0016) plen 2 > > > HCI Event: Command Complete (0x0e) plen 4 > > < HCI Command: Delete Stored Link Key (0x03|0x0012) plen 7 > > > HCI Event: Command Complete (0x0e) plen 4 > > > > Hope this helps, > > It gives a better idea but is still lacking a bit of information since > hcidump is by default quite restrictive in what it outputs. Could you > try once more, but this time pass the -X and -V command line switches to > hcidump. It should make it output the full set of parameters of the HCI > commands and events. What I'd also ask is if you could make an > additional binary HCI log in the btsnoop format so that we could analyze > the log with btmon (which has better decoders than hcidump). You get > hcidump to do this by passing "-B -w <filename>" as parameters and can > verify that the produced file is correct by running hcidump -r > <file>. Ok, here's text log: (The keys exchanged are not long-lived, so it is okay to post this publicly.... right?) Binary dump is attached. Let me know if you need something more, Pavel root@amd:~# hcidump hci0 -X -V HCI sniffer - Bluetooth packet analyzer ver 1.42 device: hci0 snap_len: 1028 filter: 0xffffffff < HCI Command: Reset (0x03|0x0003) plen 0 > HCI Event: Command Complete (0x0e) plen 4 Reset (0x03|0x0003) ncmd 1 status 0x00 < HCI Command: Read Local Supported Features (0x04|0x0003) plen 0 > HCI Event: Command Complete (0x0e) plen 12 Read Local Supported Features (0x04|0x0003) ncmd 1 status 0x00 Features: 0xff 0xff 0x8d 0xfe 0x9b 0xf9 0x00 0x80 < HCI Command: Read Local Version Information (0x04|0x0001) plen 0 > HCI Event: Command Complete (0x0e) plen 12 Read Local Version Information (0x04|0x0001) ncmd 1 status 0x00 HCI Version: 2.0 (0x3) HCI Revision: 0x206c LMP Version: 2.0 (0x3) LMP Subversion: 0x4132 Manufacturer: Broadcom Corporation (15) < HCI Command: Read BD ADDR (0x04|0x0009) plen 0 > HCI Event: Command Complete (0x0e) plen 10 Read BD ADDR (0x04|0x0009) ncmd 1 status 0x00 bdaddr 00:16:CE:EC:4D:C2 < HCI Command: Read Buffer Size (0x04|0x0005) plen 0 > HCI Event: Command Complete (0x0e) plen 11 Read Buffer Size (0x04|0x0005) ncmd 1 status 0x00 ACL MTU 1017:8 SCO MTU 64:0 < HCI Command: Read Class of Device (0x03|0x0023) plen 0 > HCI Event: Command Complete (0x0e) plen 7 Read Class of Device (0x03|0x0023) ncmd 1 status 0x00 class 0x000000 < HCI Command: Read Local Name (0x03|0x0014) plen 0 > HCI Event: Command Complete (0x0e) plen 252 Read Local Name (0x03|0x0014) ncmd 1 status 0x00 name 'IBM Callisto' < HCI Command: Read Voice Setting (0x03|0x0025) plen 0 > HCI Event: Command Complete (0x0e) plen 6 Read Voice Setting (0x03|0x0025) ncmd 1 status 0x00 voice setting 0x0060 < HCI Command: Set Event Filter (0x03|0x0005) plen 1 type 0 condition 0 Clear all filters > HCI Event: Command Complete (0x0e) plen 4 Set Event Filter (0x03|0x0005) ncmd 1 status 0x00 < HCI Command: Write Connection Accept Timeout (0x03|0x0016) plen 2 timeout 32000 > HCI Event: Command Complete (0x0e) plen 4 Write Connection Accept Timeout (0x03|0x0016) ncmd 1 status 0x00 < HCI Command: Delete Stored Link Key (0x03|0x0012) plen 7 bdaddr 00:00:00:00:00:00 all 1 > HCI Event: Command Complete (0x0e) plen 4 Delete Stored Link Key (0x03|0x0012) ncmd 1 status 0x11 deleted 0 Error: Unsupported Feature or Parameter Value -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html [-- Attachment #2: delme --] [-- Type: application/octet-stream, Size: 957 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: 3.10-rc: bluetooth disappeared on thinkpad x60 (regression) 2013-06-10 19:37 ` Pavel Machek @ 2013-06-11 7:22 ` Johan Hedberg 2013-06-11 10:20 ` Johan Hedberg 0 siblings, 1 reply; 13+ messages in thread From: Johan Hedberg @ 2013-06-11 7:22 UTC (permalink / raw) To: Pavel Machek Cc: Rafael J. Wysocki, kernel list, marcel, gustavo, linux-bluetooth Hi Pavel, On Mon, Jun 10, 2013, Pavel Machek wrote: > < HCI Command: Delete Stored Link Key (0x03|0x0012) plen 7 > bdaddr 00:00:00:00:00:00 all 1 > > HCI Event: Command Complete (0x0e) plen 4 > Delete Stored Link Key (0x03|0x0012) ncmd 1 > status 0x11 deleted 0 > Error: Unsupported Feature or Parameter Value Here's the cause of your issue. It's not one of the recently added HCI commands but one that's been around for quite some time. I just checked and it's even there in kernel 3.9, so I'm surprised that you're saying this is a regression since that version. Are you completely sure about it? Johan ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: 3.10-rc: bluetooth disappeared on thinkpad x60 (regression) 2013-06-11 7:22 ` Johan Hedberg @ 2013-06-11 10:20 ` Johan Hedberg 2013-06-12 11:23 ` Pavel Machek 0 siblings, 1 reply; 13+ messages in thread From: Johan Hedberg @ 2013-06-11 10:20 UTC (permalink / raw) To: Pavel Machek, Rafael J. Wysocki, kernel list, marcel, gustavo, linux-bluetooth [-- Attachment #1: Type: text/plain, Size: 1052 bytes --] Hi Pavel, On Tue, Jun 11, 2013, Johan Hedberg wrote: > On Mon, Jun 10, 2013, Pavel Machek wrote: > > < HCI Command: Delete Stored Link Key (0x03|0x0012) plen 7 > > bdaddr 00:00:00:00:00:00 all 1 > > > HCI Event: Command Complete (0x0e) plen 4 > > Delete Stored Link Key (0x03|0x0012) ncmd 1 > > status 0x11 deleted 0 > > Error: Unsupported Feature or Parameter Value > > Here's the cause of your issue. It's not one of the recently added HCI > commands but one that's been around for quite some time. I just checked > and it's even there in kernel 3.9, so I'm surprised that you're saying > this is a regression since that version. Are you completely sure about > it? Could you try if the attached patch helps? It modifies the HCI request state tracking to allow flagging certain HCI commands as non-critical and just ignores their failures. If the patch helps, could you still provide a HCI trace (both plain text and btsnoop format) of a successful "hciconfig hci0 up"? It might help create a simpler patch for this issue. Johan [-- Attachment #2: del_link_keys.patch --] [-- Type: text/plain, Size: 3190 bytes --] diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 10eb9b3..2ee2520 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h @@ -265,6 +265,7 @@ typedef void (*hci_req_complete_t)(struct hci_dev *hdev, u8 status); struct hci_req_ctrl { bool start; + bool ignore_status; u8 event; hci_req_complete_t complete; }; diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 7cb6d36..f1d7500 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -1084,7 +1084,7 @@ int hci_req_run(struct hci_request *req, hci_req_complete_t complete); void hci_req_add(struct hci_request *req, u16 opcode, u32 plen, const void *param); void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen, - const void *param, u8 event); + const void *param, u8 event, bool ignore_status); void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status); struct sk_buff *__hci_cmd_sync(struct hci_dev *hdev, u16 opcode, u32 plen, diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index d817c93..c3d5056 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -145,7 +145,7 @@ struct sk_buff *__hci_cmd_sync_ev(struct hci_dev *hdev, u16 opcode, u32 plen, hci_req_init(&req, hdev); - hci_req_add_ev(&req, opcode, plen, param, event); + hci_req_add_ev(&req, opcode, plen, param, event, false); hdev->req_status = HCI_REQ_PEND; @@ -367,7 +367,8 @@ static void bredr_setup(struct hci_request *req) bacpy(&cp.bdaddr, BDADDR_ANY); cp.delete_all = 0x01; - hci_req_add(req, HCI_OP_DELETE_STORED_LINK_KEY, sizeof(cp), &cp); + hci_req_add_ev(req, HCI_OP_DELETE_STORED_LINK_KEY, sizeof(cp), &cp, + 0, true); /* Read page scan parameters */ if (req->hdev->hci_ver > BLUETOOTH_VER_1_1) { @@ -2669,7 +2670,7 @@ int hci_send_cmd(struct hci_dev *hdev, __u16 opcode, __u32 plen, /* Queue a command to an asynchronous HCI request */ void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen, - const void *param, u8 event) + const void *param, u8 event, bool ignore_status) { struct hci_dev *hdev = req->hdev; struct sk_buff *skb; @@ -2694,6 +2695,7 @@ void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen, bt_cb(skb)->req.start = true; bt_cb(skb)->req.event = event; + bt_cb(skb)->req.ignore_status = ignore_status; skb_queue_tail(&req->cmd_q, skb); } @@ -2701,7 +2703,7 @@ void hci_req_add_ev(struct hci_request *req, u16 opcode, u32 plen, void hci_req_add(struct hci_request *req, u16 opcode, u32 plen, const void *param) { - hci_req_add_ev(req, opcode, plen, param, 0); + hci_req_add_ev(req, opcode, plen, param, 0, false); } /* Get data from the previously sent command */ @@ -3425,6 +3427,10 @@ void hci_req_cmd_complete(struct hci_dev *hdev, u16 opcode, u8 status) return; } + /* Check for commands whose failures aren't critical */ + if (bt_cb(hdev->sent_cmd)->req.ignore_status) + status = 0; + /* If the command succeeded and there's still more commands in * this request the request is not yet complete. */ ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: 3.10-rc: bluetooth disappeared on thinkpad x60 (regression) 2013-06-11 10:20 ` Johan Hedberg @ 2013-06-12 11:23 ` Pavel Machek 2013-06-13 7:23 ` Johan Hedberg 0 siblings, 1 reply; 13+ messages in thread From: Pavel Machek @ 2013-06-12 11:23 UTC (permalink / raw) To: Rafael J. Wysocki, kernel list, marcel, gustavo, linux-bluetooth [-- Attachment #1: Type: text/plain, Size: 5520 bytes --] On Tue 2013-06-11 13:20:25, Johan Hedberg wrote: > Hi Pavel, > > On Tue, Jun 11, 2013, Johan Hedberg wrote: > > On Mon, Jun 10, 2013, Pavel Machek wrote: > > > < HCI Command: Delete Stored Link Key (0x03|0x0012) plen 7 > > > bdaddr 00:00:00:00:00:00 all 1 > > > > HCI Event: Command Complete (0x0e) plen 4 > > > Delete Stored Link Key (0x03|0x0012) ncmd 1 > > > status 0x11 deleted 0 > > > Error: Unsupported Feature or Parameter Value > > > > Here's the cause of your issue. It's not one of the recently added HCI > > commands but one that's been around for quite some time. I just checked > > and it's even there in kernel 3.9, so I'm surprised that you're saying > > this is a regression since that version. Are you completely sure about > > it? > > Could you try if the attached patch helps? It modifies the HCI request > state tracking to allow flagging certain HCI commands as non-critical > and just ignores their failures. Yes, it helps. > If the patch helps, could you still provide a HCI trace (both plain text > and btsnoop format) of a successful "hciconfig hci0 up"? It might help > create a simpler patch for this issue. Thanks, Pavel Here you go (binary dump attached): root@amd:~# hcidump hci0 -X -V HCI sniffer - Bluetooth packet analyzer ver 1.42 device: hci0 snap_len: 1028 filter: 0xffffffff < HCI Command: Reset (0x03|0x0003) plen 0 > HCI Event: Command Complete (0x0e) plen 4 Reset (0x03|0x0003) ncmd 1 status 0x00 < HCI Command: Read Local Supported Features (0x04|0x0003) plen 0 > HCI Event: Command Complete (0x0e) plen 12 Read Local Supported Features (0x04|0x0003) ncmd 1 status 0x00 Features: 0xff 0xff 0x8d 0xfe 0x9b 0xf9 0x00 0x80 < HCI Command: Read Local Version Information (0x04|0x0001) plen 0 > HCI Event: Command Complete (0x0e) plen 12 Read Local Version Information (0x04|0x0001) ncmd 1 status 0x00 HCI Version: 2.0 (0x3) HCI Revision: 0x206c LMP Version: 2.0 (0x3) LMP Subversion: 0x4132 Manufacturer: Broadcom Corporation (15) < HCI Command: Read BD ADDR (0x04|0x0009) plen 0 > HCI Event: Command Complete (0x0e) plen 10 Read BD ADDR (0x04|0x0009) ncmd 1 status 0x00 bdaddr 00:16:CE:EC:4D:C2 < HCI Command: Read Buffer Size (0x04|0x0005) plen 0 > HCI Event: Command Complete (0x0e) plen 11 Read Buffer Size (0x04|0x0005) ncmd 1 status 0x00 ACL MTU 1017:8 SCO MTU 64:0 < HCI Command: Read Class of Device (0x03|0x0023) plen 0 > HCI Event: Command Complete (0x0e) plen 7 Read Class of Device (0x03|0x0023) ncmd 1 status 0x00 class 0x000000 < HCI Command: Read Local Name (0x03|0x0014) plen 0 > HCI Event: Command Complete (0x0e) plen 252 Read Local Name (0x03|0x0014) ncmd 1 status 0x00 name 'amd-0' < HCI Command: Read Voice Setting (0x03|0x0025) plen 0 > HCI Event: Command Complete (0x0e) plen 6 Read Voice Setting (0x03|0x0025) ncmd 1 status 0x00 voice setting 0x0060 < HCI Command: Set Event Filter (0x03|0x0005) plen 1 type 0 condition 0 Clear all filters > HCI Event: Command Complete (0x0e) plen 4 Set Event Filter (0x03|0x0005) ncmd 1 status 0x00 < HCI Command: Write Connection Accept Timeout (0x03|0x0016) plen 2 timeout 32000 > HCI Event: Command Complete (0x0e) plen 4 Write Connection Accept Timeout (0x03|0x0016) ncmd 1 status 0x00 < HCI Command: Delete Stored Link Key (0x03|0x0012) plen 7 bdaddr 00:00:00:00:00:00 all 1 > HCI Event: Command Complete (0x0e) plen 4 Delete Stored Link Key (0x03|0x0012) ncmd 1 status 0x11 deleted 0 Error: Unsupported Feature or Parameter Value < HCI Command: Read Page Scan Activity (0x03|0x001b) plen 0 > HCI Event: Command Complete (0x0e) plen 8 Read Page Scan Activity (0x03|0x001b) ncmd 1 status 0x00 interval 2048 window 18 < HCI Command: Read Page Scan Type (0x03|0x0046) plen 0 > HCI Event: Command Complete (0x0e) plen 5 Read Page Scan Type (0x03|0x0046) ncmd 1 0000: 00 01 .. < HCI Command: Set Event Mask (0x03|0x0001) plen 8 Mask: 0xfffffbff07180000 > HCI Event: Command Complete (0x0e) plen 4 Set Event Mask (0x03|0x0001) ncmd 1 status 0x00 < HCI Command: Read Local Supported Commands (0x04|0x0002) plen 0 > HCI Event: Command Complete (0x0e) plen 68 Read Local Supported Commands (0x04|0x0002) ncmd 1 status 0x00 Commands: ffffffffffff1ffffffffffff30fffff3f < HCI Command: Write Inquiry Mode (0x03|0x0045) plen 1 mode 1 > HCI Event: Command Complete (0x0e) plen 4 Write Inquiry Mode (0x03|0x0045) ncmd 1 status 0x00 < HCI Command: Read Local Extended Features (0x04|0x0004) plen 1 page 1 > HCI Event: Command Complete (0x0e) plen 14 Read Local Extended Features (0x04|0x0004) ncmd 1 status 0x00 page 1 max 0 Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 < HCI Command: Write Default Link Policy Settings (0x02|0x000f) plen 2 policy 0x0f Link policy: RSWITCH HOLD SNIFF PARK > HCI Event: Command Complete (0x0e) plen 4 Write Default Link Policy Settings (0x02|0x000f) ncmd 1 status 0x00 < HCI Command: Write Page Timeout (0x03|0x0018) plen 2 timeout 8192 > HCI Event: Command Complete (0x0e) plen 4 Write Page Timeout (0x03|0x0018) ncmd 1 status 0x00 < HCI Command: Write Default Link Policy Settings (0x02|l Name (0x03|0x0014) plen 0 > HCI Event: Command Complete (0x0e) plen 2 -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html [-- Attachment #2: delme --] [-- Type: application/octet-stream, Size: 3074 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: 3.10-rc: bluetooth disappeared on thinkpad x60 (regression) 2013-06-12 11:23 ` Pavel Machek @ 2013-06-13 7:23 ` Johan Hedberg 2013-06-13 8:04 ` Johan Hedberg 0 siblings, 1 reply; 13+ messages in thread From: Johan Hedberg @ 2013-06-13 7:23 UTC (permalink / raw) To: Pavel Machek Cc: Rafael J. Wysocki, kernel list, marcel, gustavo, linux-bluetooth Hi Pavel, On Wed, Jun 12, 2013, Pavel Machek wrote: > < HCI Command: Read Local Supported Commands (0x04|0x0002) plen 0 > > HCI Event: Command Complete (0x0e) plen 68 > Read Local Supported Commands (0x04|0x0002) ncmd 1 > status 0x00 > Commands: ffffffffffff1ffffffffffff30fffff3f As I suspected, even though the Delete Stored Link Key command is mandatory from Bluetooth version 1.1 onwards (this controller supports 2.0) this controller doesn't have it mentioned in its supported commands response (counting from 0 it should be bit 7 of octet 6). Therefore, it might be possible to just move sending of this problematic command to after receiving the supported commands response and making it conditional to having its respective bit set in the mask. I'll be sending another patch proposal soon. Johan ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: 3.10-rc: bluetooth disappeared on thinkpad x60 (regression) 2013-06-13 7:23 ` Johan Hedberg @ 2013-06-13 8:04 ` Johan Hedberg 2013-06-13 8:45 ` Pavel Machek 0 siblings, 1 reply; 13+ messages in thread From: Johan Hedberg @ 2013-06-13 8:04 UTC (permalink / raw) To: Pavel Machek, Rafael J. Wysocki, kernel list, marcel, gustavo, linux-bluetooth [-- Attachment #1: Type: text/plain, Size: 1086 bytes --] Hi Pavel, On Thu, Jun 13, 2013, Johan Hedberg wrote: > On Wed, Jun 12, 2013, Pavel Machek wrote: > > < HCI Command: Read Local Supported Commands (0x04|0x0002) plen 0 > > > HCI Event: Command Complete (0x0e) plen 68 > > Read Local Supported Commands (0x04|0x0002) ncmd 1 > > status 0x00 > > Commands: ffffffffffff1ffffffffffff30fffff3f > > As I suspected, even though the Delete Stored Link Key command is > mandatory from Bluetooth version 1.1 onwards (this controller supports > 2.0) this controller doesn't have it mentioned in its supported commands > response (counting from 0 it should be bit 7 of octet 6). Therefore, it > might be possible to just move sending of this problematic command to > after receiving the supported commands response and making it > conditional to having its respective bit set in the mask. I'll be > sending another patch proposal soon. I just sent a patch to linux-bluetooth for this. It would be nice if you could revert the previous patch, apply this one instead (also attached to this email) and let us know if it works fine. Johan [-- Attachment #2: 0001-Bluetooth-Fix-conditions-for-HCI_Delete_Stored_Link_.patch --] [-- Type: text/plain, Size: 2981 bytes --] >From b7b3eb3d3cf615d1249dc9387a619f2729cf0d84 Mon Sep 17 00:00:00 2001 From: Johan Hedberg <johan.hedberg@intel.com> Date: Thu, 13 Jun 2013 10:53:48 +0300 Subject: [PATCH] Bluetooth: Fix conditions for HCI_Delete_Stored_Link_Key Even though the HCI_Delete_Stored_Link_Key command is mandatory for 1.1 and later controllers some controllers do not seem to support it properly as was witnessed by one Broadcom based controller: < HCI Command: Delete Stored Link Key (0x03|0x0012) plen 7 bdaddr 00:00:00:00:00:00 all 1 > HCI Event: Command Complete (0x0e) plen 4 Delete Stored Link Key (0x03|0x0012) ncmd 1 status 0x11 deleted 0 Error: Unsupported Feature or Parameter Value Luckily this same controller also doesn't list the command in its supported commands bit mask (counting from 0 bit 7 of octet 6): < HCI Command: Read Local Supported Commands (0x04|0x0002) plen 0 > HCI Event: Command Complete (0x0e) plen 68 Read Local Supported Commands (0x04|0x0002) ncmd 1 status 0x00 Commands: ffffffffffff1ffffffffffff30fffff3f Therefore, it makes sense to move sending of HCI_Delete_Stored_Link_Key to after receiving the supported commands response and to only send it if its respective bit in the mask is set. The downside of this is that we no longer send the HCI_Delete_Stored_Link_Key command for Bluetooth 1.1 controllers since HCI_Read_Local_Supported_Command was introduced in version 1.2, but this is an acceptable penalty as the command in question shouldn't affect critical behavior. Reported-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> --- net/bluetooth/hci_core.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index d817c93..d68425c 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -341,7 +341,6 @@ static void hci_init1_req(struct hci_request *req, unsigned long opt) static void bredr_setup(struct hci_request *req) { - struct hci_cp_delete_stored_link_key cp; __le16 param; __u8 flt_type; @@ -365,10 +364,6 @@ static void bredr_setup(struct hci_request *req) param = __constant_cpu_to_le16(0x7d00); hci_req_add(req, HCI_OP_WRITE_CA_TIMEOUT, 2, ¶m); - bacpy(&cp.bdaddr, BDADDR_ANY); - cp.delete_all = 0x01; - hci_req_add(req, HCI_OP_DELETE_STORED_LINK_KEY, sizeof(cp), &cp); - /* Read page scan parameters */ if (req->hdev->hci_ver > BLUETOOTH_VER_1_1) { hci_req_add(req, HCI_OP_READ_PAGE_SCAN_ACTIVITY, 0, NULL); @@ -602,6 +597,15 @@ static void hci_init3_req(struct hci_request *req, unsigned long opt) struct hci_dev *hdev = req->hdev; u8 p; + if (hdev->commands[6] & 0x80) { + struct hci_cp_delete_stored_link_key cp; + + bacpy(&cp.bdaddr, BDADDR_ANY); + cp.delete_all = 0x01; + hci_req_add(req, HCI_OP_DELETE_STORED_LINK_KEY, + sizeof(cp), &cp); + } + if (hdev->commands[5] & 0x10) hci_setup_link_policy(req); -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: 3.10-rc: bluetooth disappeared on thinkpad x60 (regression) 2013-06-13 8:04 ` Johan Hedberg @ 2013-06-13 8:45 ` Pavel Machek 0 siblings, 0 replies; 13+ messages in thread From: Pavel Machek @ 2013-06-13 8:45 UTC (permalink / raw) To: Rafael J. Wysocki, kernel list, marcel, gustavo, linux-bluetooth On Thu 2013-06-13 11:04:42, Johan Hedberg wrote: > Hi Pavel, > > On Thu, Jun 13, 2013, Johan Hedberg wrote: > > On Wed, Jun 12, 2013, Pavel Machek wrote: > > > < HCI Command: Read Local Supported Commands (0x04|0x0002) plen 0 > > > > HCI Event: Command Complete (0x0e) plen 68 > > > Read Local Supported Commands (0x04|0x0002) ncmd 1 > > > status 0x00 > > > Commands: ffffffffffff1ffffffffffff30fffff3f > > > > As I suspected, even though the Delete Stored Link Key command is > > mandatory from Bluetooth version 1.1 onwards (this controller supports > > 2.0) this controller doesn't have it mentioned in its supported commands > > response (counting from 0 it should be bit 7 of octet 6). Therefore, it > > might be possible to just move sending of this problematic command to > > after receiving the supported commands response and making it > > conditional to having its respective bit set in the mask. I'll be > > sending another patch proposal soon. > > I just sent a patch to linux-bluetooth for this. It would be nice if you > could revert the previous patch, apply this one instead (also attached > to this email) and let us know if it works fine. Patch works for me, thanks! -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2013-06-13 8:45 UTC | newest] Thread overview: 13+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-06-10 9:29 3.10-rc: bluetooth disappeared on thinkpad x60 (regression) Pavel Machek 2013-06-10 10:05 ` Johan Hedberg 2013-06-10 11:04 ` Pavel Machek 2013-06-10 11:59 ` Johan Hedberg 2013-06-10 13:38 ` Pavel Machek 2013-06-10 16:07 ` Johan Hedberg 2013-06-10 19:37 ` Pavel Machek 2013-06-11 7:22 ` Johan Hedberg 2013-06-11 10:20 ` Johan Hedberg 2013-06-12 11:23 ` Pavel Machek 2013-06-13 7:23 ` Johan Hedberg 2013-06-13 8:04 ` Johan Hedberg 2013-06-13 8:45 ` Pavel Machek
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).