Announcement

Collapse
No announcement yet.

On gpsd, obdgpslogger, and udev hotplug

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • On gpsd, obdgpslogger, and udev hotplug

    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:
    Code:
    baudrate=38400
    The obdgpslogger half is covered in a bit more detail in doc/auto_launch in your svn checkout

    Gary (-;
    OBDGPSLogger, for logging OBDII and/or GPS data
    OBDSim, an OBDII/ELM327 software simulator
    mp3car forums: obdgpslogger, obdsim

  • #2
    great job. I'll do this inside LinuxICE to make things easier.

    will obdgpslogger automatically create the path to the db?
    Former author of LinuxICE, nghost, nobdy.
    Current author of Automotive Message Broker (AMB).
    Works on Tizen IVI. Does not represent anyone or anything but himself.

    Comment


    • #3
      Oops, forgot to add a thing about gpsd permissions. Fixed.

      Gary (-;
      OBDGPSLogger, for logging OBDII and/or GPS data
      OBDSim, an OBDII/ELM327 software simulator
      mp3car forums: obdgpslogger, obdsim

      Comment


      • #4
        OBDGPSLogger doesn't automatically create a path to the db. The default is "./obdgpslogger.db". If you want it set to something else, that's what the config file /etc/obdgpslogger is for.

        Gary (-;
        OBDGPSLogger, for logging OBDII and/or GPS data
        OBDSim, an OBDII/ELM327 software simulator
        mp3car forums: obdgpslogger, obdsim

        Comment


        • #5
          Oh. And if gpsd.hotplug.wrapper doesn't exist on your system at all, try this one:
          Code:
          #! /bin/bash
          # $Id: gpsd.hotplug.wrapper 4669 2008-01-21 15:07:00Z esr $
          
          #debian addition:
          [ ! -r /etc/default/gpsd ] || . /etc/default/gpsd
          [ "$START_DAEMON" = "true" ] || exit 0
          [ "$USBAUTO" = "true" ] || exit 0
          
          
          if [ "$ACTION" == "remove" ] ; then
            if [ $(echo $DEVLINKS | grep -q /dev/gps) ] ; then
              exec /lib/udev/gpsd.hotplug "$ACTION" "$DEVNAME"
            fi
            exit 0
          fi
          
          # . /lib/udev/hotplug.functions
          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
          }
          
          # wait for /usr & /var to be mounted
          wait_for_file /usr/bin/python && \
          wait_for_file /var/run && \
            exec /lib/udev/gpsd.hotplug "$ACTION" "$DEVNAME"
          Gary (-;
          OBDGPSLogger, for logging OBDII and/or GPS data
          OBDSim, an OBDII/ELM327 software simulator
          mp3car forums: obdgpslogger, obdsim

          Comment


          • #6
            Configured everything except for the obdgpslogger part. I don't have /etc/obdgpslogger in my directory (step 2b).

            What does that mean? I've never run obdgpslogger before?
            Originally posted by ghettocruzer
            I was gung ho on building a PC [until] just recently. However, between my new phone having internet and GPS and all...and this kit...Im starting to have trouble justfiying it haha.
            Want to:
            -Find out about the new iBug iPad install?
            -Find out about carPC's in just 5 minutes? View the Car PC 101 video

            Comment


            • #7
              It doesn't create /etc/obdgpslogger by default, just create one yourself. [Added that to the top post]

              Gary (-;
              OBDGPSLogger, for logging OBDII and/or GPS data
              OBDSim, an OBDII/ELM327 software simulator
              mp3car forums: obdgpslogger, obdsim

              Comment

              Working...
              X