Re: Mapping USB-ports "by slot" rather than by "usb attributes"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 13, 2016 at 08:45:14PM +0530, Ajay Garg wrote:
> 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?

That's the opposite of what you should use, it doesn't matter what
device is assigned ttyUSB0 (as really, it will be random), you should
use the symlinks in /dev/serial/ instead to always address the "correct"
device.

So, if you know you want to talk to the device on the hub that is
connected into the 4th port, then open
	/dev/serial/by-path/platform-3f980000.usb-usb-0:1.4:1.0-port0

When you start connecting and disconnecting the devices, the ttyUSB
number will start to change, but the path to the device should be pretty
stable (note, it isn't always as USB busses can be enumerated in
different ways on different boots, but usually it is always the same)

The best is to use the serial number symlink, if you have unique ones,
as it sounds like you do, as those will always point to the correct
device.

hope this helps,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux