Hi,
to answer my own question (well, partially):
On 11-dec-2006, at 11:18, Bas Schulte wrote:
> well, got USB running fine on 2.6.18, now my next question: how can
> I make sure my Garmin gps ends up at a predefined device? As it is,
> it'll appear on /dev/ttyUSB?.
>
> I assume I need to do something with the usb device and interface
> (being 091e:0003 for my particular gps), and tell hotplug to
> associate this one with, say, /dev/gps.
>
> How do I go about that?
Some more digging around made this clearer. See below for the recipe.
This sort of works, however, there is a difference in the device
specification that hotplug passes on to my garmin_gps script. From
syslog, I see that the device is hooked up to, say, /dev/ttyUSB1.
However, the $DEVICE environment variable that is set when my script
is called holds "/proc/bus/usb/001/002". Apparently, that makes gpsd
choke and spit out a lot of this:
gpsd: PrintPacket() gpsd: Packet: Type 18 1 272, ID: 65535, Sz:
-1209856476
gpsd: GetPacket()
So, why does my script get /proc/bus/usb/001/002 while I really want
"/dev/ttyUSB1"? If I start gpsd by hand and specify /dev/ttyUSB1, it
works just fine.
Cheers,
Bas.
Hotplugging Garmin GPS
----------------------------------
1) Create file: /etc/hotplug/usb/garmin_gps.usermap
Function: maps device id = 0x091e and interface 0x0003 to
"garmin_gps". To find out device id/interface id, do a "lsusb":
bak:/home/bas# lsusb
Bus 001 Device 003: ID 0403:6001 Future Technology Devices
International, Ltd 8-bit FIFO
Bus 001 Device 002: ID 091e:0003 Garmin International GPSmap (various
models)
Bus 001 Device 001: ID 0000:0000
First column are bits added together: 3 = 1 + 2, only take field 1
(device id) and field 2 (interface id) into account
garmin_gps 0x0003 0x091e 0x0003 0x0 0x0 0x0 0x0 0x0 0x0 0x0
0x0 0x0
This will result in execution of /etc/hotplug/usb/garmin_gps whenever
this device is plugged in.
2) Create file: /etc/hotplug/usb/garmin_gps
This gets executed when the device is plugged in.
Contents:
#!/bin/sh
case $ACTION in
add)
echo "Executing gpsd -T g -p $DEVICE -s -s 9600 -S
10000 -P /var/run/garmin_gps.pid"
gpsd -T g -p $DEVICE -S 10000 -n -P /var/run/
garmin_gps.pid
;;
remove)
echo "Stopping gpsd with pid `cat /var/run/
garmin_gps.pid`"
kill `cat /var/run/garmin_gps.pid`
unlink /var/run/garmin_gps.pid
;;
*)
echo "Unsupported action: $ACTION"
;;
esac
exit 0
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users