PuTTY – Access Serial Port as /dev/ttyUSB0 but Not as Named Udev Device

puttyserial portudev

I have multiple USB-to-serial converters. I need to access one of them in particular. I'm using a udev rule to give it a special name. I have rebooted since I last modified it.

SUBSYSTEM=="usb", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", NAME="serial", MODE="0666"

That vendor/product combination is unique among all of my usb devices.

$ ls -l /dev/serial
crw-rw-rw-. 1 root root 189, 133 Feb  8 23:57 /dev/serial
$ ls -l /dev/ttyUSB0
crw-rw----. 1 root dialout 188, 0 Feb  8 23:58 /dev/ttyUSB0

I'm using PuTTY to read them, and it works on /dev/ttyUSB0, but not on /dev/serial . The error still appears when I am running PuTTY as root.

The error message I receive

Unable to open connection to :
Unable to configure serial port

In case it matters, I'm running CentOS 6.

uname -a
Linux xxxxxx 2.6.32-279.22.1.el6.x86_64 #1 SMP Wed Feb 6 03:10:46 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

EDIT: WORKING

The following udev rule was what finally worked:

SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK+="COM1", MODE="0666"

Note that SUBSYSTEM is tty, not usb, NAME has been changed to SYMLINK+, and serial has been changed to COM1 (to not interfere with /dev/serial, as a commenter pointed out.)

Thanks for your help, guys!

Best Answer

You want your rule to pay attention to the tty subsystem, not the usb one.

SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK+="serial"

A USB device generates several udev events when you plug it in as the kernel recognizes more things about it. Since it's a USB device, it first engages the usb subsystem, which I think will create a raw USB device, which PuTTY can't use. A few steps later it will load the device's specific driver, and since this is a serial device, it will engage the tty subsystem, which creates a device file that PuTTY can use.

This rule will create a symlink to whichever /dev/ttyUSB* happens to be assigned to your device. Tested successfully with PuTTY on my own serial dongle.

Incidentally, for diagnostics I sometimes run the following rule, to get an idea of what the udev scripts are seeing:

RUN+="/home/me/bin/udev-diag .$kernel .$number .$devpath .$id .$parent .$root .$tempnode"

where udev-diag is essentially:

env >>/tmp/udev-events
echo "$@" >>/tmp/udev-events

For more general use, the udevmonitor program is also handy.

Related Question