Minicom and Serial to USB Converter

For an embedded developer, the regular D9 serial port is a very vital interface. Unfortunately, my new development machine is not having the serial port. So I started using the Serial to USB converter. The main issue with this converter is, the device file (/dev/ttyUSBx) associated with USB port will vary frequently and it forced me to change the minicom configuration accordingly. So I thought of forcing a specific device file for this converter.

Here, UDEV system will help. In udev, by linking a new device event from kernel to a user space program, we can do some dynamic actions using the UDev rules. I created a new udev rule to link the newly created /dev/ttyUSBx device to a fixed link (/dev/seriral2usb). So that, my minicom always refer to the fixed link, which in-turn refer to the actual device file (ttyUSB0, 1, 2).

Now we will see, howto udev for this purpose:

  1. Create a rule file in /etc/udev/rules.d/88-usb.rules and set it permission to 644.
  2. Enter this rule: 
    • SUBSYSTEMS==”usb”, ATTRS{idVendor}==”067b”, ATTRS{idProduct}==”2303″, SYMLINK+=”serial2usb” MODE=”0666″
  3. In minicom conf file, change serial device to /dev/serial2usb
  4. Restart the udev or the system.
  5. Whenever the usb device (with this vendor and product id) is connected, then the serial2usb link will be pointed to the actual device file (ttyUSBx).

The next qustion is, “Howto find the vendor and product id?”. Use lsusb command. Output from my PC is attached here:

Bus 001 Device 004: ID 0bda:0111 Realtek Semiconductor Corp. Card Reader
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 006: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 002 Device 003: ID 093a:2510 Pixart Imaging, Inc.
Bus 002 Device 002: ID 046e:52c0 Behavior Tech. Computer Corp.

We can also use the UDEV command to find more info to form different kind of rules. For example, using the following command, I can get more info to form new UDEV rules

udevadm info –name=/dev/ttyUSB0 –attribute-walk

The new rule is:

KERNELS==”ttyUSB?”, SUBSYSTEMS==”usb-serial”, DRIVERS==”pl2303″, SYMLINK+=”serial2usb”

Advertisements
Tagged with:
Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: