gta02 - bluetooth & usb

Carsten Haitzler (The Rasterman) raster at openmoko.org
Mon Apr 21 12:49:21 CEST 2008


On Mon, 21 Apr 2008 11:26:35 +0100 Andy Green <andy at openmoko.com> babbled:

> -----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.

aaah there it is! grrr. still in the s3c2440 dir. just ... is... so... device..
specific! my engineering bones insist on finding a more generic way - like a
generic kerel "hey - all bluetooth devices go here" thing.... no matter what
baseboard it is or how they are wired up - the class of device has controls
etc. there

> 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

AHA! the good 'ol e0!

> you can find out what kind of device they are...
> 
> http://www.comvcon.com/SelectUSBSDCs.html
> 
> (Bluetooth = device class 0xe0)

AHA!!! SCORE! just what i wanted.

> 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.

yup. that's what i hoped - s with gta04 it will just work with no changes - it
will find any bt device we have and "just work". i hate re-doing work. :)


perfrect. i now have my bt device up - a 1-1 is there. i can now scan subdirs
and look at bInterfaceClass and be happy. werd up to my homies. :)

> - -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-----
> 


-- 
Carsten Haitzler (The Rasterman) <raster at openmoko.org>




More information about the openmoko-kernel mailing list