Anyway, the syntax of "udevadm" here is not the same as Ubuntu and
doesn't return a "ID_VENDOR_ID" amongst other things, so different
steps are required; This is how I did it.
Step 1. Identify the relevent USB device your VP2 is using.
[beast]:/# cat /proc/tty/driver/usbserial
usbserinfo:1.0 driver:2.0
0: module:ftdi_sio name:"FTDI USB Serial Device" vendor:0403
product:f850 num_ports:1 port:1 path:usb-0000:00:1a.1-1
2: module:cp2101 name:"cp2101" vendor:10c4 product:ea60 num_ports:1
port:1 path:usb-0000:00:1a.2-1
Now, I know my weather station device is the "cp2101", and the first
number corresponds to the ttyUSB device it uses, in this case "2", so
I know my device is /dev/ttyUSB2
Step 2. I need further "udev" info to create the rule, so I run:
[beast]:/# udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB2)
| less
looking at device '/devices/pci0000:00/0000:00:1a.2/usb3/3-1/3-1:1.0/
ttyUSB1/tty/ttyUSB1':
KERNEL=="ttyUSB1"
SUBSYSTEM=="tty"
DRIVER==""
looking at parent device '/devices/pci0000:00/0000:00:1a.2/
usb3/3-1/3-1:1.0/ttyUSB1':
KERNELS=="ttyUSB1"
SUBSYSTEMS=="usb-serial"
DRIVERS=="cp2101"
ATTRS{port_number}=="0"
looking at parent device '/devices/pci0000:00/0000:00:1a.2/
usb3/3-1/3-1:1.0':
KERNELS=="3-1:1.0"
SUBSYSTEMS=="usb"
DRIVERS=="cp2101"
ATTRS{bInterfaceNumber}=="00"
ATTRS{bAlternateSetting}==" 0"
...snip, snip...a whole lot more superfluous rubbish...
Step 3. I look for the entry at the top that has the matching
"DRIVERS" entry to the one I had earlier, and also relates to the
correct ttyUSB device.
Step 4. Again, because "udev" works differently, the approach of
Graham's config file won't work, so I take the shortcut that does, and
my config file looks thus:
# automap usb/serial dongle for Davis VantagePro2
# creates symlink /dev/vpro
# create in a file in /etc/udev/rules.d
# and run "udevadm control --reload-rules" to reload the rule base
KERNELS=="ttyUSB*", SUBSYSTEMS=="usb-serial", DRIVERS=="cp2101",
ACTION=="add", SYMLINK+="vpro"
Step 5. The reload command is also slightly different. Run:
[beast]:/# udevadm control --reload-rules (Note, no underscore)
Step 6. Unplug/re-plug your VangatePro2 console and check that /dev/
vpro is created correctly.
Step 7. Change your wview config to point at "/dev/vpro" and restart
wview.
Step 8. Good stuff, it works! Drink a beer (or 10)
______________________________
The bad stuff - EMI
Unfortunately, the EMI problem still exists, and even though the VP2
config points at /dev/vpro, it's not a dynamically updateable thing
just to re-write /dev/vpro to point to a new tty device when it
changes. Wview still tries to talk to the old tty device, so when EMI
occurs, I have to do somthing about it - ie. restart wview.
To do this, I use software called "logfmon" to monitor for certain
phrases in syslog (which happen when the tty disconnect/reconnects
happen), and then logfmon will restart wview for me. It's a bit of a
pain, but at least it works. If you need any help with this, let me
know and I'll see what I can do.
maybe we could ask for a wview enhancement to accept a gentle poke to
re-open the device file?
then have a rule like ACTION="add",RUN+="/usr/local/bin/wview_reopen_port"
where the client can just die quietly if wview not running or not yet
opened the device file on startup
------------------------------------------------------------------------
*Graham Eddy*