I have network device that serves up a telnet/RFC2217 (virtual serial port) interface. On Linux, how do I create a virtual tty that connects to this thing? If I understand correctly, socat doesn't really support telnet and does not support RFC2217.
1 Answer
Please have a look at the ttynvt driver [1]. It supports RFC2217, ioctls and tty line disciplines (tty and PPP).
-
This works properly, tested with pyserial 3.5 on WSL2 in Windows store Debian.– RGD2Jul 14, 2022 at 0:13
-
pyserial 3.5, FWIW, fails to connect if the served port won't allow mode changes. This is incorrect behaviour under rfc2217, it should instead respect that, read back the settings, and adapt accordingly. This is what happens with an Advantech EKI-1524 serial port server, when accessed directly from pyserial. If using lars-thrane-as/ttynvt , at least if the ports are set to be consistent with the settings pyserial defaults to, pyserial works.– RGD2Jul 14, 2022 at 0:18
TIOCMSET
) on the port. And instead of writing a kernel driver, aLD_PRELOAD
hack (that will trick the program into believing it's writing to a real serial port) may work just as well.