Jonathan,
I was playing around with srial driver further and I found a way to hook hotplug/unplug events. Put the following scripts and chmod 755 them.
/etc/hotplug/usb/pl2303
#!/bin/sh
. /etc/hotplug/hotplug.functions
if [ ! -L /var/run/usb/%proc%bus%usb%* ]; then
# echo $PRODUCT > /home/zaurus/product.txt
# Pharos(Microsoft) GPS-360
if [ $PRODUCT = "67b/aaa0/300" ]; then
ln -s /etc/hotplug/usb/usb-gps.off $REMOVER
mesg make REMOVER in $REMOVER
chmod 666 /dev/ttyUSB0
mesg make serial port available to usr
fi
# put your if...fi clause here
# ...
# ...
fi
/etc/hotplug/usb/usb-gps.off
#!/bin/sh
. /etc/hotplug/hotplug.functions
mesg kill gps processes
#killall qpegps
killall gpsd
# these may not be necessary
rmmod pl2303
rmmod usbserial
Here is how those scripts work.
C3000 USB agent calls 'module nama' script in /etc/hotplug/usb if it exists. So, in this case, /etc/hotplug/usb/pl2303
There may be multiple devices you want to use that are all rely on pl2303 module, so I look at PRODUCT environment variable to do device specific hot-plug/hot-unplug actions. PRODUCT environment variable contains VenderId, ProductId and bcdDevice, but better to make sure by uncomment the 'echo' line to see what the exact string is. In the 2nd if clause, I also register REMOVER program which is invoked at unplugging event. C3000 kernel will create symbolic link to this REMOVER iunder /var/run/usb, so make sure if your REMOVER is successfully registered by looking at that path.
In my GPS case, simply 'chmod 666 /dev/ttyUSB0' allowed me to run qpegps/gpsd as usr level, and also C3000 doesn't hang up at cable unplug even if gpsd is running. So, rc.local method was good enough for my own purpose. Still, if qpegps is running at cable unplug time, C3000 hangs. I will figure out more graceful and perfect way.
Hope this helps.