I've been wrestling with this, and it's time to give up and ask the experts.
C3000 with stock ROM, but portability desired.
My program will communicate with two separate USB serial devices, which will appear on /dev/ttyUSB0-1. I can probe the devices to find out which device is on which tty, but if there are other serial devices connected, the probing would be likely to upset their operation. (The stock ROM has only two serial devices, but mknod seems happy to create more, and I'd like my program to assume that other devices could be present.)
The devices are identified by their Manufacturer, Product and SerialNumber strings in the output of lsusb -v, but that gives me two problems:
1. lsusb -v has to be run as root; I'd prefer my program not to need root privileges.
2. Although it identifies the devices, it still doesn't answer the question of which tty each is connected to.
I can get my program to run dmesg and then parse the output, and I've had some success there - but:
1. Parsing the dmesg output is hardly elegant, and presumably highly non-portable, not to say driver-dependent.
2. dmesg appears to use a circular buffer, and the information I need is not necessarily still present when I need it.
The question in its most simplified form:
How can my program find the manufacturer, product and serial number strings (as listed by lsusb) of the hardware connected to a given ttyUSB port, with bonus points for elegance and portability?
As usual, enlightenment would be much appreciated.