D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] udev rules for persistent serial device naming

 

On 21/03/18 09:54, Robin Cornelius wrote:
> Hi everyone,
> 
> ran into an issue. I've got an ancient (off line/not networked) Debian
> Lenny system that is running some industrial process control and there
> is much resistance and effort required to upgrade it.
> 
> Recently needed to change some external hardware, so i've ended up
> with 2 FDTI USB serial converters attached and the the usual fun and
> games have started where its a lottery which one gets /dev/ttyUSB0 and
> ttyUSB1
> 
> So i thought udev to the rescue.. as my udev foo is lacking i googled
> and nearly every reference i can find uses this format for udev entry
> :-
> 
> SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001",
> ATTRS{serial}=="A6008isP", SYMLINK+="mydevice"
> 
> so i change the above to match my VID/PID and serial and great it
> works, but something was wrong
> 
> the symlink was not :-
> 
>  /dev/mydevice -> /dev/ttyUSB1
> 
> but was :-
> 
>  /dev/mydevice -> /dev/bus/usb/0
> 
> 
> 
> what? thats not a char device being exposed? needless to say opening
> that device and talking to it does not work.
> 
> Does anyone know what is wrong? I'm finding that google is not my
> friend as this system is so old i'm expecting that a detail is wrong
> and all examples use the latest format for udev rules.
> 
> Thanks
> 
> Robin
> 

Have a look here:

http://reactivated.net/writing_udev_rules.html#udevinfo

Specifically I believe you need to use the "NAME=" syntax to control
where in the /dev/ tree you want your new device to appear as well as
the "SYMLINK=" argument. I think you're running into issues where some
of your arguments will unnecessarily match both instances which is "not
kosher" for some reason: try matching just SUBSYSTEM=="tty" and the
serials, you're not gaining anything by matching the idVendor and idProduct.

udev rules are one of those things that never really worked quite as
well as everyone hoped they would...

Cheers
-- 
The Mailing List for the Devon & Cornwall LUG
https://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq