1
votes

Having a huge problem with giving udev rules to USB-to-Serial adapter devices, I have two of those and they have the same attributes. Is there any other way to set the udev rules for each of them or am I out of luck? They have "bcm2708_usb" kernel version. Thanks!

Also, I'm using them all through usb hub

This is what ended up with

  • like mentioned below, I used "lsusb -t" command to get the USB serial device tree

  • created a file "/etc/udev/rules.d/99-input.rules"

  • In that file I wrote this line "SYMLINK+="printer" ATTRS{devpath}=="1.2.1"

  • Saved the file and these commands to enable the rules without the need of reboot - "sudo udevadm control --reload-rules", "sudo udevadm trigger"

To test it out I used "sudo minicom -s" and in the "serial setup" selection I set the device to "/dev/printer"

1
What is the device on the other end?Shane Wealti

1 Answers

2
votes

I had this problem in the past with two identical USB-Serial devices. In the end we solved it long term by replacing them with a four-port USB-Serial device which was the only USB-Serial device in the system, making it simpler to find and detect the individual serial ports regardless of where the four-port USB was connected.

However:

Empirical Approach

You may be able to do it with a bit of empirical observation, if you can physically identify and maintain the USB port it is connected to, and if the USB subsystems don't change (say, thanks to other PCI cards or USB hubs being removed/added, BIOS update, etc. - its a big 'if', I know...) and if you only have one system you care about...

The command lsusb -t will give you a tree of USB devices and ports. You can use this to find your device(s). Pick one then remove it and plug it into a different USB ports to confirm you have the device you want. Label it, and label the physical port you want to use it with, and make a note of the Bus, Port, Device, address etc. at that point in time. Provided the PCI bus doesn't change, etc., then that USB bus, device, port should remain the one corresponding to that USB-serial device.

Example output:

/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/5p, 480M
    |__ Port 3: Dev 2, If 0, Class=hub, Driver=hub/4p, 480M
        |__ Port 1: Dev 7, If 0, Class=vend., Driver=pl2303, 12M

In this case, the chain Bus 02, Port 3 Dev1 --> Port 1 Dev 7

You might then be able to use that information in a udev rule to discriminate the specific USB-serial device, something along the lines of:

ATTRS{devpath}=="3.1",ATTRS{idVendor}=="0557", ATTRPICS{idProduct}=="2008"

Here, 3.1 corresponds to the bottom Port 3, Port 1

Here is an example not plugged into a hub:

/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
    |__ Port 1: Dev 2, If 0, Class=vend., Driver=pl2303, 12M

and

ATTRS{devpath}=="1",ATTRS{idVendor}=="0557", ATTRS{idProduct}=="2008"

Ignore the Dev number, it changes each time you plug in. Obviously, replace the productId, etc. with yours...