Current-Users archive

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

Stable names for USB serial adapters



Hey folks...

Perhaps you, like me, are frustrated that USB serial devices can get enumerated in non-deterministic ways, which makes putting those device names in configuration files (such as /etc/remote) less than useful.

I threw together a little devpubd hook to fix this problem for those adapters that have serial numbers (FTDI devices seem to reliably have these):

	https://www.netbsd.org/~thorpej/99-ucom-symlinks

When it sees a ucom device attach, it creates four symlinks, and then cleans them up when the device detaches:

the-ripe-vessel:thorpej 55$ ls -l /dev/*ty-u* /dev/ucom* 
0 lrwxr-xr-x  1 root  wheel  10 Dec 17 12:18 /dev/cty-uftdi-AQ01BZTV-0@ -> /dev/ctyU0
0 lrwxr-xr-x  1 root  wheel  10 Dec 17 12:18 /dev/dty-uftdi-AQ01BZTV-0@ -> /dev/dtyU0
0 lrwxr-xr-x  1 root  wheel  10 Dec 17 12:18 /dev/tty-uftdi-AQ01BZTV-0@ -> /dev/ttyU0
0 lrwxr-xr-x  1 root  wheel  16 Dec 17 12:18 /dev/ucom0@ -> uftdi-AQ01BZTV-0
the-ripe-vessel:thorpej 56$

<pulls device>

the-ripe-vessel:thorpej 56$ ls -l /dev/*ty-u* /dev/ucom* 
ls: /dev/*ty-u*: No such file or directory
ls: /dev/ucom*: No such file or directory
the-ripe-vessel:thorpej 57$ 

This lets me have something like the following in /etc/remote:

shark-console:dv=/dev/dty-uftdi-AQ01BZTV-0:br#9600:pa=none:dc:

Anyway, just thought I'd share that little stocking stuffer with everyone in the hopes you, like me, find it useful.

Cheers!

-- thorpej



Home | Main Index | Thread Index | Old Index