gta02 - bluetooth & usb

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


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Somebody in the thread at some point said:
| On Mon, 21 Apr 2008 10:28:54 +0100 Andy Green <andy at openmoko.com> 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
need)
|
| 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 >
/sys/bus/platform/drivers/neo1973-pm-bt/neo1973-pm-bt.0/power_on
root@(none):~# echo 1 >
/sys/bus/platform/drivers/neo1973-pm-bt/neo1973-pm-bt.0/reset
root@(none):~# echo 0 >
/sys/bus/platform/drivers/neo1973-pm-bt/neo1973-pm-bt.0/reset

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
e0

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

http://www.comvcon.com/SelectUSBSDCs.html

(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


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkgMa9MACgkQOjLpvpq7dMqfQACfYbrYv4vPhg4//AWRxIzEZRtm
w5QAoJDeZBcx+IO6uhgYaZbIwTq6hquf
=eyA7
-----END PGP SIGNATURE-----




More information about the openmoko-kernel mailing list