So, finally I have obdgpslogger and gpsd both working with udev hotplug, on ubuntu 9.04
My USB OBDII devices are FTDI.
My USB GPS device is pl2303.
1) Making gpsd work
a) Copy /lib/udev/rules.d/40-gpsd.rules to /etc/udev/rules.d/40-gpsd.rules
b) Edit /etc/udev/rules.d/40-gpsd.rules. Comment out the line for idVendor 0403 and idProduct 6001, and modify the two pl2303 lines so that the permissions will let gpsd access it:
Code:
# Prolific Technology, Inc. PL2303 Serial Port
SYSFS{idVendor}=="067b", SYSFS{idProduct}=="2303", SYMLINK="gps%n", MODE:="0666", RUN+="/lib/udev/gpsd.hotplug.wrapper"
# ATEN International Co., Ltd UC-232A Serial Port [pl2303]
SYSFS{idVendor}=="0557", SYSFS{idProduct}=="2008", SYMLINK="gps%n", MODE:="0666", RUN+="/lib/udev/gpsd.hotplug.wrapper"
c) Edit /lib/udev/gpsd.hotplug.wrapper
Take out the line
Code:
. /lib/udev/hotplug.functions
and put this there instead:
Code:
wait_for_file() {
[ -e "$1" ] && return 0
local count=0
while sleep 1; do
let count=count+1
[ -e "$1" ] && return 0
if [ $count -gt 60 ]; then
return 1
fi
done
}
d) sudo dpkg-reconfigure gpsd
Launch on boot - yes
Leave the automatic device list empty
Should gpsd handle devices automatically - yes
Options to gpsd: "-F /var/run/gpsd.sock"
2) Make obdgpslogger hotplug work
a) Put this in /etc/udev/rules.d/40-ftdi.rules
Code:
SUBSYSTEM!="tty", GOTO="ftdi_rules_end"
ACTION=="add", SYSFS{idVendor}=="0403", SYSFS{idProduct}=="6001", RUN+="/usr/local/bin/obdgpslogger -ms /dev/%k"
LABEL="ftdi_rules_end"
b) Configure obdgpslogger to do what you want
Edit /etc/obdgpslogger [if it doesn't exist, just create it]. Set it to put the logfile in the right place:
Code:
log_file=/media/usbthumb/carlog.db
If you have a device that defaults to 38400 instead of 9600 [eg, an OBDLink], then you also need to put that in the config file:
The obdgpslogger half is covered in a bit more detail in
doc/auto_launch in your svn checkout
Gary (-;