Can't seem to write VT220 commands through pyserial

112 Views Asked by At

So I have this script that connects to a linux machine while it's booting through serial to change bios settings. It's a messy bash script that connects through minicom. Thought I'd clean things up and remake the script with pyserial.

So far the basic VT100 commands work. Like '\x1B[A' for up arrow key, '\r' for enter, '\x1B' for escape. Good, that covers most the navigating and changing bios settings.

But the VT220 commands (which works in the bash script that uses minicom) don't work at all. Debug shows they get sent but they do nothing. Examples being '\x1B[3~' for delete or '\x1B[18~' for F7. I need these to actually enter the bios screen.

For the delete button I tried multiple variations: b'\x1B[3~' b'\x1B\x5B\x33\x7E' '\[3~' b'\[3~' (last two are using the actual ESC character that isn't showing up right here)

None of em work.I thought maybe I needed a different code for the python environment, so I tried firing up miniterm and sending the delete key manually with the debug filter. It works and miniterm debug says it sent '\x1B[3~', so I'm definitely using the right code.

For some extra information, I'm setting up the serial port with defaults and using the basic serial.write() function to send the command.

It doesn't really make sense to me that VT220 would directly be the issue since it should be entirely remote dependent. I have a feeling that the longer commands are maybe being sent as multiple steps, so the terminal is only receiving '\x1B[3'+'~' and not '\x1B[3~' but that's just a baseless hunch and I don't know how to verify that.

Any ideas?

0

There are 0 best solutions below