Linux Udev Rules

From Tekkotsu Wiki

Jump to: navigation, search

Linux-based robots such as the Calliope require udev rules to assure that hardware devices are configured properly and assigned consistent device paths on which Tekkotsu can rely. For example, on a robot with a netbook and an external camera, the netbook's webcam should always be assigned to /dev/video0 and the external camera to /dev/video1, not vice versa. At boot time, either assignment is possible, but with a udev rule we can force the correct assignment to occur.

Udev rules need to be installed on the robot itself. If you are running Tekkotsu on a workstation and simulating a robot using Mirage, you do not need the udev rules. However, if you are attaching real hardware such as a webcam or Kinect device to the workstation itself, you will want to install the udev rules.

Contents

Check if Linux Udev Rules are Installed

To check if the udev rules are already installed, do:

ls /etc/udev/rules.d

There should be a file named 10-calliope.rules.

Install Udev Rules for Create and Calliope Robots

Note: these rules require serial USB devices, such as the connections to the Create and the Dynamixel servo controllers, to have been assigned specific serial numbers so Linux can tell them apart. See the article on FTDI USB Serial device programming for instructions on how to program the serial numbers for FTDI devices such as the iRobot serial-to-USB cable. The file below also works for serial cables that use the Prolific Technology PL2303 chip. If you're using a different kind of serial cable you will need to ascertain the device vendor id and product id (use "lsusb -v") and then modify the udev rules to recognize that device.

Use the instructions below to install the udev rules:

sudo -s
cd /etc/udev/rules.d
wget -N http://Chiara-Robot.org/download/udev/rules.d/10-calliope.rules

mkdir -p /etc/udev/scripts
cd /etc/udev/scripts
wget -N http://Chiara-Robot.org/download/udev/scripts/set_ftdi_low_latency.sh
wget -N http://Chiara-Robot.org/download/udev/scripts/reload_ov534_driver.sh
chmod +x *

Learn More About Udev Rules

Udev rules files are human-readable, so you can browse them to see how your robot's devices are being configured.

The udevadm utility can be used to examine device configurations. It takes the place of several older utilities such as udevinfo and udevtest. Read the udevadm man page for instructions. Example:

udevadm info -a -p $(udevadm info -q path -n /dev/video0)

A good tutorial on udev rules is available at http://www.reactivated.net/writing_udev_rules.html. Note: where this tutorial refers to udevinfo, use udevadm instead.

Related Pages

FTDI USB Serial device programming