2
votes

I have several USB-serial converters (Prolific) attached to a USB hub. I can't find any udev information that allows me to distinguish these converters depending on the physical port they are connected to.

I hope the device path can give me that information...

/devices/pci0000:00/0000:00:0f.5/usb1/1-3/1-3.1/1-3.1:1.0/ttyUSB0

...but I could not find any documentation that explains the meaning of the numbers (hopefully one of them exactly identifies the physical port). Can somebody explain these numbers and tell me if they allow me to clearly identify the physical port?

2

2 Answers

2
votes

I'm no expert in this field, but these are my interpretation of those numbers:

  • pci0000:00: This is your PCI controller.
  • 0000:00:0f.5: This is the PCI identifier of your USB controller.
  • usb1: The usb controller itself.
  • 1-3: The identifier of the USB hub. It may be an internal hub, or it may be absent.
  • 1-3.1: Device connected to the first port of that hub.
  • 1-3.1:1.0: Configuration #1, Interface #0 in that device.

So, my guess is that the physical port is identified by 1-3.1, that is the string to the left of the colon in the last piece of the device path.

I don't have a hub around but I'd bet that if you connect it via a hub you'll get something like:

/devices/pci0000:00/0000:00:0f.5/usb1/1-3/1-3.1/1-3.1.1/1-3.1.1:1.0/ttyUSB0

The physical port would be 1-3.1.1, and that last 1 would be the port used in that hub.

1
votes

This site: http://hackaday.com/2009/09/18/how-to-write-udev-rules/ references the command: udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0) (okay, it's a little different, but that command works)

which tells us information like this:

KERNELS=="3-1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"

I've used this information in the past to put together a rule like this one:

KERNELS=="3-1", SUBSYSTEMS=="usb", DRIVERS=="usb", SYMLINK+="USBPORT1"

So every time a device gets plugged into usb port 1, it creates a simlink in the /dev folder that is consistent regardless of what order things are plugged in.