UDEV Rules for USB0/1 Ports

147 views
Skip to first unread message

philip....@gmail.com

unread,
Jul 7, 2024, 6:38:23 AM7/7/24
to weewx-user
Im using weewx V5.02 and Im using https://github.com/weewx/weewx/wiki/weewx-multi to connect 2 vantage pro consoles.  All is working as expected.

However when I moved the raspberry pi and connected the power back on the /dev/ttyUSB 0 and 1 had switched over.

In the wiki I found a document on UDEV rules for USB ports and using

sudo udevadm info -a -n /dev/ttyUSB0

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/platform/axi/1000120000.pcie/1f00200000.usb/xhci->
    KERNEL=="ttyUSB0"
    SUBSYSTEM=="tty"
    DRIVER==""
    ATTR{power/control}=="auto"
    ATTR{power/runtime_active_time}=="0"
    ATTR{power/runtime_status}=="unsupported"
    ATTR{power/runtime_suspended_time}=="0"

  looking at parent device '/devices/platform/axi/1000120000.pcie/1f00200000.us>
    KERNELS=="ttyUSB0"
    SUBSYSTEMS=="usb-serial"
    DRIVERS=="cp210x"

sudo udevadm info -a -n /dev/ttyUSB1

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/platform/axi/1000120000.pcie/1f00300000.usb/xhci->
    KERNEL=="ttyUSB1"
    SUBSYSTEM=="tty"
    DRIVER==""
    ATTR{power/control}=="auto"
    ATTR{power/runtime_active_time}=="0"
    ATTR{power/runtime_status}=="unsupported"
    ATTR{power/runtime_suspended_time}=="0"

  looking at parent device '/devices/platform/axi/1000120000.pcie/1f00300000.us>
    KERNELS=="ttyUSB1"
    SUBSYSTEMS=="usb-serial"
    DRIVERS=="cp210x"

They look identical to me so Im wondering if this will work and if they will work what do you put in
# FTDI usb-serial converter for device A ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="XXXXXXXX", SYMLINK+="deviceA" # FTDI usb-serial converter for device B ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="YYYYYYYY", SYMLINK+="deviceB"

Thanks for help
Phil


matthew wall

unread,
Jul 7, 2024, 7:09:06 AM7/7/24
to weewx-user
On Sunday, July 7, 2024 at 6:38:23 AM UTC-4 philip....@gmail.com wrote:
They look identical to me so Im wondering if this will work and if they will work what do you put in
# FTDI usb-serial converter for device A ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="XXXXXXXX", SYMLINK+="deviceA" # FTDI usb-serial converter for device B ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{serial}=="YYYYYYYY", SYMLINK+="devic

these rules will work only if there is a serial attribute available for each device.  check the rest of the udevadm output for a 'serial' attribute.

note that not every usb-to-serial adapter has a serial number.  most authentic FTDI devices do, but there are *many* fakes out there that present as FTDI but that do not have serial numbers.

m

philip....@gmail.com

unread,
Jul 7, 2024, 1:56:47 PM7/7/24
to weewx-user
Thanks Matthew
Cant find anything different for the 2 dataloggers so it looks like each datalogger has to be on its own raspi

Graham Eddy

unread,
Jul 7, 2024, 10:16:56 PM7/7/24
to WeeWX User
there will be something different, even if you have to go down to the actual physical address on the usb bus - look beyond the simple attributes
⊣GE⊢

philip....@gmail.com

unread,
Jul 8, 2024, 9:08:25 AM7/8/24
to weewx-user
Thanks Graham and Matthew.  Never thought to go that far down. Have found  the bus info so will have a go at that
Reply all
Reply to author
Forward
0 new messages