Writing a Bus Pirate udev rule

It only took a couple of instances where the Bus Pirate wasn’t linked to /dev/ttyUSB0 before I got sick of that game and wrote a udev rule to create a symlink. Now, every time I plug it in it is available at /dev/buspirate. This simple bit of code creates the rule:

sudo echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="0403", ATTR{idProduct}=="6001";, MODE="0660", SYMLINK+="buspirate"' | sudo tee /etc/udev/rules.d/47-BusPirate.rules
sudo restart udev

Note: The restart udev command is for Ubuntu 9.10 Karmic Koala. Older version should run “sudo /etc/init.d/udev restart” instead.

Update: Kenny emailed saying he uses this for Bus Pirate v4:

SUBSYSTEM=="usb", ATTR{idVendor}=="04d8", ATTR{idProduct}=="fb00", MODE="0660", SYMLINK+="buspirate4"

That should do it.  You can now point your serial terminal program to ‘/dev/buspirate’. This doesn’t differentiate between different devices using the same FTDI chip but I don’t have any others so this isn’t a problem. If you need to specifically pinpoint this Bus Pirate as a unique device, add a compare key that looks at the serial number (ATTRS{serial}==”YourSerialNumberHere”).