HAL, FUSE, and serial port GPSs
twpayne at gmail.com
Mon Jan 26 06:38:57 PST 2009
Just a quick ping, can anyone tell me if what I'm trying to achieve
with HAL is possible? See details below...
2009/1/17 Tom Payne <twpayne at gmail.com>:
> I'm trying to use HAL to automount a fuse filesystem when I plug my
> GPS in. It's a bit weird and I don't know if HAL can handle it.
> I have a GPS (actually a combined GPS/variometer/altimeter for
> paraglider and hang glider pilots) with a USB Serial interface. I've
> written a fuse interface to this device that allows you browse and
> edit the tracklogs, waypoints, routes, etc. stored on the device,
> automatically uploading them to and downloading them from the device
> as appropriate. I'd now like to have this userspace filesystem
> automount when the device is plugged in. The sequence of events is
> fairly convoluted:
> 1. The device has a built-in USB-to-serial converter so when the
> device is initially inserted it appears as a standard Prolific PL-2303
> USB-to-serial converter. HAL's Device Manager signals DeviceAdded when
> it is inserted.
> 2. You must communicate with the device over the serial port to
> determine whether it is indeed a GPS (rather than, say, anything else
> that has a serial interface). This detection can take some time
> (several minutes) because the user must press a button on the GPS
> before it will respond on the serial port. Assuming it can be
> identified as a GPS then you determine the make, model, serial number
> and owner's name.
> 3. Now you have enough information to choose a nice mountpoint (e.g.
> including the owner's name) and can call fuse to mount the device.
> My current "solution" is to use a daemon that communicates with HAL's
> Device Manager via DBUS listening for DeviceAdded signals. When a
> serial device is inserted I test it to see if it is a GPS and if it is
> I launch fuse. However, this solution feels ugly and I'm sure that
> it's possible to achieve the automounting behaviour entirely within
> HAL with a carefully crafted FDI file.
> I'd be very grateful for an indication as to whether this is possible
> in HAL or if I'm trying to do something that should be handled by
> something other than HAL. Troublesome aspects are:
> - GPS appears as a standard USB-to-serial converter
> - the device is a serial device but ends up acting more like a storage device
> - the device must be interrogated to detect whether it is a GPS, this
> can take several minutes
> - the mount command is unusual (e.g. "flytecfs -o device=/dev/ttyUSB0
> - the mountpoint is a function of parameters read from the device
> - the unmount command is unusual (i.e. "fusermount -u mountpoint")
> - unmount should be called when the device is unplugged
> If you're interested, the code itself, written in Python is here:
> Many thanks for any help,
More information about the hal