1

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?

Dave Baker
  • 11
  • 2
  • minicom doesn't emulate VT220 (it's a hybrid of less capable terminals). – Thomas Dickey Dec 02 '22 at 21:23
  • Strange, `^[[3~` (DEL) isnt a VT100 command and it does work through minicom. Either way, you're saying there's more than just sending the code to send these commands? I was under the impression it was entirely up to the recipient how these received bytes are handled. – Dave Baker Dec 05 '22 at 14:57
  • no - its display (output) is the main issue with emulation. Glancing at the [source](https://github.com/Distrotech/minicom/blob/master/src/vt100.c) (ignore the comment at the top), the only VT220 feature I notice is `ECH`. – Thomas Dickey Dec 05 '22 at 21:29
  • huh, I guess DEL is from VT100 afterall, but I feel like you misunderstood the problem, minicom isn't the problem, it's pyserial, basically sending DEL works with minicom, miniterm and bash echo, but not with pyserial – Dave Baker Dec 06 '22 at 13:20

0 Answers0