0

Preface

II swallowed the first 3-chapters of the Linux Device Drivers, Edition 3 - PDF, so I know a bit more about it than I did at the start of the week, but still not so much.

System

  • Distribution: Ubuntu 14.04.4 LTS, Trusty Tahr
  • Kernel: 4.4.0-47-Generic

Problem

I am trying to replace the kernel btusb driver with the Bluetopia USB BT driver SS1BTUSB (Driver source and build files from CodeAurora), because I am trying to learn more about the Bluetopia Bluetooth stack implementation, and this is the first step to being able to do that.

I can successfully build the SS1BTUSB Kernel module and install it.

$ sudo insmod SS1BTUSBM.ko

$ lsmod | grep SS1BTUSB
SS1BTUSBM              32768  0

And, following the instructions from the lwn.net article, I can unbind the devices attached to the btusb driver.

$ ls /sys/bus/usb/drivers/btusb
1-1.5:1.0  1-1.5:1.1  bind  module  new_id  remove_id  uevent  unbind
$ sudo -i
# echo "1-1.5:1.0" > /sys/bus/usb/drivers/btusb/unbind
# echo "1-1.5:1.1" > /sys/bus/usb/drivers/btusb/unbind
-bash: echo: write error: No such device
# ls /sys/bus/usb/drivers/btusb
bind  module  new_id  remove_id  uevent  unbind

I am not sure why unbinding the second device causes the error but the result is the devices are unbound from the btusb driver.

However, when I try and bind these devices to the SS1BTUSB1 driver, I get the same error.

# echo "1-1.5:1.1" > /sys/bus/usb/drivers/SS1BTUSB/bind
-bash: echo: write error: No such device
# echo "1-1.5:1.0" > /sys/bus/usb/drivers/SS1BTUSB/bind
-bash: echo: write error: No such device

It seems that the 'No such device' error is fairly generic and could mean any number of things, suggestions on how to debug/diagnose this issue would be greatly appreciated.

Random Notes

(May or may not help diagnose the problem).

The btusb driver is used by other drivers - could be related.

$ lsmod | grep btusb
btusb                  45056  0
btrtl                  16384  1 btusb
btbcm                  16384  1 btusb
btintel                16384  1 btusb
bluetooth             516096  25 bnep,btbcm,btrtl,btusb,rfcomm,btintel

USB info on the Bluetooth USB dongle...

$ lsusb
.
Bus 001 Device 003: ID 0a12:1243 Cambridge Silicon Radio, Ltd
.

It's actually a CSR8675 Headset Development Board configured as a BT dongle (this bit I know about), so it's details look a bit screwy...

$ usb-devices
.
T:  Bus=01 Lev=02 Prnt=02 Port=04 Cnt=01 Dev#=  3 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=0a12 ProdID=1243 Rev=20.32
S:  Product=CSR8675 USB Headset
S:  SerialNumber=ABCDEF0123456789
C:  #Ifs= 3 Cfg#= 1 Atr=80 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
I:  If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
I:  If#= 2 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)
.

But it is a functional Bluetooth HCI device.

0

So, it turns out that the Bluetopia device driver SS1BTUSB is very specific about the Bluetooth devices it supports. A lot more specific than the kernel btusb driver.

From the SS1BTUSB.c BluetoothDeviceIDTable[]...

   /* CSR Module.                                             */
   { USB_DEVICE(0x0A12, 0x0001) },
   { USB_DEVICE(0x0A12, 0x0043) },
   { USB_DEVICE(0x0A12, 0x1000) },

I checked my Developer board... and its idProduct (USB Product ID code) is 0x1234.

$ lsusb -d 0a12:
Bus 001 Device 006: ID 0a12:1234 Cambridge Silicon Radio, Ltd

0x1234 is not in the table, or a even listed for any 'Cambridge Silicon Radio' devices at www.linux-usb.org.

Fortunately, changing the the DevBoards USB Product ID, I can do, so I changed it to 0x0001 - for 'HCI device'.

The result, the device is recognised as a Bluetooth Dongle (HCI mode)

$ lsusb -d 0a12:
Bus 001 Device 007: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

And I can now bind/unbind the devices "1-1.5:1-0" and "1-1.5:1-1" to the SS1BTUSB driver without error.

Lessons Learned

  1. The default kernel btusb driver is a lot more permissive about the USB Bluetooth devices it recognises, perhaps it just knows that all CSR devices are Bluetooth dongles.
  2. Device driver error messages are quite obtuse. Even enabling the SS1BTUSB device driver DEBUG printk output didn't help.
  3. As always, the only real documentation is the source code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.