With ser2net you can map serial devices to a port.

installation:
>> apt install ser2net

how to get the usb device id:
>> all connected usb-devices are listed here: /dev/serial/by-path/

config:
>> the config file can be found at /etc/ser2net.yaml
>> <accepter> can be tcp or telnet, if tcp is selected tab and arrow keys won't work because the data is transmitted raw
>> example:
#####################################################
%YAML 1.1
---
# This is a ser2net configuration file, tailored to be rather
# simple.
#
# Find detailed documentation in ser2net.yaml(5)
# A fully featured configuration file is in
# /usr/share/doc/ser2net/examples/ser2net.yaml.gz
#
# If you find your configuration more useful than this very simple
# one, please submit it as a bugreport

define: &banner \r\n\ port \p device \d [\B] (Debian GNU/Linux) \r\n\r\n

connection: &con001
accepter: telnet,5001
enable: on
options:
banner: *banner
kickolduser: true
telnet-brk-on-sync: true
connector: serialdev,
/dev/serial/by-path/pci-0000:00:14.0-usb-0:4:1.0,
115200n81,local
#####################################################


troubleshooting:
>> if you restart the machine the ser2net service will fail, because the usb ports are not ready on startup
>> to fix this add the following line to ser2net.service in the [Unit] section:

After=network-online.target
Wants=network-online.target


link: https://manpages.ubuntu.com/manpages/impish/man5/ser2net.yaml.5.html

computer2know :: thank you for your visit :: have a nice day :: © 2024