gta02 - bluetooth & usb

Andy Green andy at
Mon Apr 21 12:26:35 CEST 2008

Hash: SHA1

Somebody in the thread at some point said:
| On Mon, 21 Apr 2008 10:28:54 +0100 Andy Green <andy at> babbled:
| Somebody in the thread at some point said:
| | quick one guys - where do i very quickly and reliably find out:
| |
| | 1. if bluetooth is up and active (what /proc or /sys magic file do i
| One way is to parse /proc/bus/usb/devices... BT module has power and a
| reset thing, but looking at those states doesn't tell you if it is ready
| for duty.  Or, if the BT device makes a network interface, test for
| presence of that.
|> herein lies the rub. no such thing on my gta02 kernel :
|> ( BUT ... /sus/bus/usb/devices/... is there but it seems to only
cover the usb

You need mount -t usbfs usbfs /proc/bus/usb to get it -- but your sys
one is much better actually as you point out it doesn't depend on platform.

You can fire up BT like this

root@(none):~# echo 1 >
root@(none):~# echo 1 >
root@(none):~# echo 0 >

Then you will find it in /sys/bus/usb/devices too, as "1-1" here.

If you walk the interfaces in subdirs 1-1:* looking at the interface class

# cat /sys/bus/usb/devices/1-1/1-1\:1.0/bInterfaceClass

you can find out what kind of device they are...

(Bluetooth = device class 0xe0)

Dunno if it is the "best" way, I had a look in libusb to see if it had a
better API or something but I didn't find any.  At least it should work
on any Linux platform.

- -Andy

Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora -


More information about the openmoko-kernel mailing list