Change Default Names for Usb Virtual Serial Ports in Linux

Change default names for USB virtual serial ports in Linux

You should try using the names in /dev/serial/by-id instead, since those names include the name of the device and should not depend on the order of connection.

By the way, it is also possible to write udev rules that make symbolic links for the serial ports depending on what device they belong to. I am not sure how that would work for a composite device with 6 serial ports, but there probably is a way to make it work.

Virtual Serial Port for Linux

You can use a pty ("pseudo-teletype", where a serial port is a "real teletype") for this. From one end, open /dev/ptyp5, and then attach your program to /dev/ttyp5; ttyp5 will act just like a serial port, but will send/receive everything it does via /dev/ptyp5.

If you really need it to talk to a file called /dev/ttys2, then simply move your old /dev/ttys2 out of the way and make a symlink from ptyp5 to ttys2.

Of course you can use some number other than ptyp5. Perhaps pick one with a high number to avoid duplicates, since all your login terminals will also be using ptys.

Wikipedia has more about ptys: http://en.wikipedia.org/wiki/Pseudo_terminal

How to assign user defined name to USB CDC Serial ports?

You can use an udev rule:
Find the vendor and product id of your device (you can get it with the lsusb command) then create the file /etc/udev/rules.d./99-serial.rules
with the rule (replace idVendor, idProduct and NAME accordingly):

SUBSYSTEM=="tty", ATTRS{idVendor}=="O123", ATTRS{idProduct}=="0123", NAME="chooseSomeName"

Unplug and plug the device again. It should now be accessible through /dev/chooseSomeName

Persistant name in usb device which open several connections || connect USB to specific port

Change default names for USB virtual serial ports in Linux

This post was the solution to my troubles, instead of using the /devttyACMx
y changed to used the names in /dev/serial/by-id/
up until now it has worked fine, if it stops doing it I will post it

How to configure virtual serial port's baud rate

You may apply Socat option b115200 when creating the PTYs.

With something like

stty -f /dev/ttys009 115200

it might be possible to change the speed afterwards.



Related Topics



Leave a reply



Submit