I finally needed to plug multiple PL2303s into a hub, so I'd like to follow up on this with what I think is a fix. I've made changes to the usb-parse-devpath.pm file so that it handles USB hubs. In my testing, I am using USB Bus 007.
If a PL2303 is plugged directly into USB Bus 7, it will get the usual incremental /dev/ttyUSBx, and there will be a link created: /dev/ttyUSB7-1.
However, if a hub is plugged into bus 7, e.g.
Code:
Bus 007 Device 101: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
and a PL2303 is plugged into that, the created link will delineate which port on the hub it's plugged into. For example: "/dev/ttyUSB7-1.3". I've done simple testing with "gtkterm -p /dev/ttyUSB7-1.3" (and for /dev/ttyUSB7-1.4) to verify it works.
File: /etc/udev/rules.d/usb-parse-devpath.pm
Code:
#!/usr/bin/perl -w
@items = split("/", $ARGV[0]);
for ($i = 0; $i < @items; $i++) {
if ($items[$i] =~ m/^usb[0-9]+$/) {
if ($items[$i + 2] =~ m/:/) {
print $items[$i + 1] . "\n";
} else {
print $items[$i + 2] . "\n";
}
last;
}
}
I have not (nor do I intend to) looked into the possibility of hubs plugged into hubs.