Thanks Greg for the reply.
Following are some outputs for a cable ::
ls -lrth /dev/serial/by-path/
total 0
lrwxrwxrwx 1 root root 13 Sep 13 14:43
platform-3f980000.usb-usb-0:1.4:1.0-port0 -> ../../ttyUSB0
ls -lrth /dev/serial/by-id/
total 0
lrwxrwxrwx 1 root root 13 Sep 13 14:43
usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0 ->
../../ttyUSB0
So, what should be a udev-rule for this cable, so that only and only
this piece of cable is mapped to /dev/ttyUSB0 on this system, ever, in
whatever slot this cable is inserted?
For brevity, right now the rule would be ::
SUBSYSTEM=="tty", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303",
ATTRS{serial}=="3f980000.usb", SYMLINK+="ttyUSB0"
but since serial-numbers are not guaranteed to be the differentiator,
so I will be highly thankful for letting me know the unique udev-rule.
Looking forward to a reply :)
Thanks and Regards,
Ajay
On Tue, Sep 13, 2016 at 7:34 PM, Greg KH <[email protected]> wrote:
> On Tue, Sep 13, 2016 at 07:20:01PM +0530, Ajay Garg wrote:
>> Ahhhh..... (sorry for my stupid realisation-originated-question), for
>> the same serial-cable types with identical "idVendor" and "idProduct",
>> are they guaranteed to have unique serial-numbers?
>
> No, there is no such USB requirement. Odds are, if it is a cheap
> device, the serial numbers will all be the same.
>
>> We have the Prolific-PL2303-Serial-To-USB-converters with ID 067b:2303.
>> Right now I have two of these pieces, and they have identical 067b:2303, but
>>
>> udevadm info -a -n /dev/ttyUSB0 | grep '{serial}' | head -n1
>>
>> gives different serial-numbers for these two pieces.
>
> Oh nice, you have some "good" ones :)
>
>> Can I generalize this to any piece of the same cable-type?
>
> Nope :(
>
> That's why you should use /dev/serial/ it should give you something you
> can use, even if the serial numbers are identical.
>
> good luck!
>
> greg k-h
--
Regards,
Ajay
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html