Fix: Bluez keeps crashing

I had the problem that my BlueZ was continuously crashing. Even when I was just using a few commands of for example hcitool or scanned for advertising BLE devices (as example). 

Set scan parameters failed: Input/output error.

I than checked dmesg to find out more:

Bluetooth: hci0 command tx timeout.

At the beginning i tried to shut it down and up again.

hciconfig hci0 down 
hciconfig hci0 up


service bluetooth restart
service dbus restart

And it worked – sometimes :-/ Even better was removing the Bluetooth Stick and plug it in again. But that was annoying. So i figured out how to reset a usb device from command line tool. First use lsusb to find the vendorId and use grep to search for it.

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. 
Bus 001 Device 004: ID 0a5c:21e8 Broadcom Corp. 

cd /sys/bus/usb/devices/

grep -i -s -r 0a5c *

cd 1-1.2

echo 0 > authorized
echo 1 > authorized

So my usb device was in /sys/bus/usb/devices/1-1.2/. In the moment when you set the value in authorized to 0 the usb bluetooth device is not longer allowed to communicate with your computer (this is what I guess). And after setting it to 1 it is forced to re-init. Awesome. This is a solid solution.


Anyway I was looking for a solution that totally fixes the problem permanently. 
First I updated the kernel to the latest version. Since I was using an raspberry pi this can easily be done be using this commands:

cat /proc/version
sudo rpi-update
sudo reboot

Than i change the content of my /boot/cmdline.txt to:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline dwc_otg.microframe_schedule=1 dwc_otg.speed=1 rootwait

And after rebooting my problem was fixed. 🙂 Change to your cmdline.txt may cause problem with others USB devices. So to change it back later. Backup it first.


Posted on April 17, 2014, in Uncategorized and tagged , , , , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: