phmadeira
Posts: 8
Joined: Sat Jul 11, 2015 11:11 am

USB udev rules does it really work ?

Mon Jul 20, 2015 10:52 am

Hello
my usb port alway change on my pi 2
i have tried everything even add a powered usb hub to check

so here what i have tried
get the info with this:
sudo udevadm info --query=all --name=ttyUSB0
sudo lsusb -v | more udevadm info -a -n /dev/ttyUSB0

then keep the right info and make a news rule

sudo nano /etc/udev/rules.d/usb.rules
with for exemple :

i do have tried so much configuration that i an tired, must work only with few of then but nothing work

SUBSYSTEM=="tty",SUBSYSTEMS=="usb",ATTRS{serial}=="A9UX53JV",ATTRS{idProduct}=="6001",ATTRS{idVendor}=="0403",ENV{ID_VENDOR}=="FTDI",ENV{ID_MODEL}=="FT232R_USB_UART",ENV{ID_PATH}=="platform-bcm2708_usb-usb-0:1.3.3:1.0-port0",SYMLINK+="ttyUSB29"

SUBSYSTEM=="tty",ATTRS{serial}=="A9UX53JV",ATTRS{idProduct}=="6001",ATTRS{idVendor}=="0403",SYMLINK+="ttyUSB29"


SO Is somedoby did succes to make this hapend on his own pi , can you try before posting ?????

sudo udevadm info --query=all --name=ttyUSB0

P: /devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.3/1-1.3.3:1.0/ttyUSB0/tty/ttyUSB0
N: ttyUSB0
S: gps0
S: serial/by-id/usb-FTDI_FT232R_USB_UART_A9UX53JV-if00-port0
S: serial/by-path/platform-bcm2708_usb-usb-0:1.3.3:1.0-port0
S: ttyUSBsensor3
E: DEVLINKS=/dev/gps0 /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A9UX53JV-if00-port0 /dev/serial/by-path/platform-bcm2708_usb-usb-0:1.3.3:1.0-
port0 /dev/ttyUSBsensor3
E: DEVNAME=/dev/ttyUSB0
E: DEVPATH=/devices/platform/bcm2708_usb/usb1/1-1/1-1.3/1-1.3.3/1-1.3.3:1.0/ttyUSB0/tty/ttyUSB0
E: ID_BUS=usb
E: ID_MODEL=FT232R_USB_UART
E: ID_MODEL_ENC=FT232R\x20USB\x20UART
E: ID_MODEL_FROM_DATABASE=FT232 USB-Serial (UART) IC
E: ID_MODEL_ID=6001
E: ID_PATH=platform-bcm2708_usb-usb-0:1.3.3:1.0
E: ID_PATH_TAG=platform-bcm2708_usb-usb-0_1_3_3_1_0
E: ID_REVISION=0600
E: ID_SERIAL=FTDI_FT232R_USB_UART_A9UX53JV
E: ID_SERIAL_SHORT=A9UX53JV
E: ID_TYPE=generic
E: ID_USB_DRIVER=ftdi_sio
E: ID_USB_INTERFACES=:ffffff:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=FTDI
E: ID_VENDOR_ENC=FTDI
E: ID_VENDOR_FROM_DATABASE=Future Technology Devices International, Ltd
E: ID_VENDOR_ID=0403
E: MAJOR=188
E: MINOR=0
E: SUBSYSTEM=tty
E: UDEV_LOG=3
E: USEC_INITIALIZED=13402105


thank you

User avatar
topguy
Posts: 5685
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: USB udev rules does it really work ?

Mon Jul 20, 2015 3:48 pm

I have made a few udev rules files and have some experience, especially with those tricky usb2serial. The clue is to keep the rules as simple as possible.

This is one I have used:

Code: Select all

ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", ATTRS{bcdDevice}=="0400", SYMLINK+="cradle0"
The only reason I use ATTRS{bcdDevice}=="0400" is I had another FTDI device of the same model and this was the only difference between the two. If you have only one of them then you should skip it.

You will also get a much better output for creating the rules if you try this command:

Code: Select all

udevadm info -a -p /sys/bus/usb-serial/devices/ttyUSB0/
You will see that the output is divided into blocks (actuallly usb-driver layers ) and there is this not well known fact that you can't make a rule which contain elements from different blocks.

Finally two other important tools for debuggin udev rules:

Code: Select all

# Reload rules after edit.
udevadm control --reload-rules

Code: Select all

# Test the specific rules triggered for a device.
udevadm test -a add  $(udevadm info -q path -n /dev/ttyUSB0 )
The last one is the only one I have found that will tell you when you have made a syntax error in the rule-file.

Return to “General discussion”