Skip to content

udev_rules

Rodrigo Serra edited this page Nov 28, 2023 · 1 revision

UDEV rules

The following rules must be correctly set on the robot in order to use the devices and boards:

These rules are found in the robot on /lib/udev/rules.d/40-pal-usb.rules

You can check this file for examples: http://dante.isr.tecnico.ulisboa.pt/socrob_at_home/scripts/tree/master/udev_rules/85-mbot.rules) (usually installed in ~/scripts/udev_rules).

Most rules specify the devices by their physical port, meaning that they must always be connected to the same USB port. If some devices/boards do not work after executing the script and reconnecting the USB, you may need to update the udev rules, following these instructions:

Updating rules

The physical USB port is identified by the value of KERNELS.

To find this value follow these steps (on the robot):

  • execute ls /dev/serial/by-id/ -l, connect the device in a USB port, execute ls /dev/serial/by-id/ -l again to see where our device is linked. E.g.:
socrob@mbot05n:~ $ ls /dev/serial/by-id/ -l
total 0
lrwxrwxrwx 1 root root 13 Nov 28 17:16 usb-FTDI_MM232R_USB_MODULE_board1-if00-port0 -> ../../ttyUSB1
lrwxrwxrwx 1 root root 13 Nov 28 17:16 usb-FTDI_MM232R_USB_MODULE_board3-if00-port0 -> ../../ttyUSB3
lrwxrwxrwx 1 root root 13 Nov 28 17:16 usb-FTDI_MM232R_USB_MODULE_FTF55GYP-if00-port0 -> ../../ttyUSB4
lrwxrwxrwx 1 root root 13 Nov 28 17:16 usb-FTDI_USB__-__Serial_Converter_FT2FWO9G-if00-port0 -> ../../ttyUSB0
lrwxrwxrwx 1 root root 13 Nov 28 17:16 usb-FTDI_USB__-__Serial_Converter_FT2FWO9O-if00-port0 -> ../../ttyUSB2
lrwxrwxrwx 1 root root 13 Nov 28 17:16 usb-Hokuyo_Data_Flex_for_USB_URG-Series_USB_Driver-if00 -> ../../ttyACM0

In this case the device we are interested in is ttyUSB2.

  • To find out the value of KERNELS in the rule, execute this command: udevadm info -q path -n /dev/ttyUSB2 (substitute ttyUSB2 with the actual device found previously). E.g.:
socrob@mbot05n:~ $ udevadm info -q path -n /dev/ttyUSB2
/devices/pci0000:00/0000:00:14.0/usb3/3-1/3-1.2/3-1.2:1.0/ttyUSB2/tty/ttyUSB2

In this example the value of KERNELS is 3-1.2:1.0.

  • execute sudo udevadm control --reload and if necessary disconnect and reconnect the device to the USB port, and check that the device is linked by executing ls /dev/mbot -l
Clone this wiki locally