labgrid icon indicating copy to clipboard operation
labgrid copied to clipboard

labgrid-client console: add escape sequence to call other client commands

Open khilman opened this issue 1 year ago • 4 comments

Story: I'm using labgrid-client -p <place> console to connect to a place. From within the console window, I want to trigger a power on/off/cycle (e.g. the equivalent of callling labgrid-client -p <place> power cycle from another shell.)

This request is inspired by similar feature in conmux where for any given console, you can use an escape sequence (e.g. ~$ in conmux) which can commands on the host where the conmux server (same as labgrid-exporter) is running.

khilman avatar May 02 '24 20:05 khilman

I had the same idea as well and do have a prototype somewhere which implements a labgrid-client CLI which takes commands and executes them without closing the client connection. To implement this we would either need to write our own RFC2711 client with an escape sequence for this CLI or wire up the RFC2711 client that is AFAIR included within pyserial.

Emantor avatar May 03 '24 06:05 Emantor

I'd find that useful as well, but it would probably mean using an internal telnet/RFC2711 client instead of microcom. Also, it would lend itself to supporting hot keys as well (e.g. CTRL-<something> to trigger a power cycle or a strategy state). So far we've shied away from that due to the possible maintenance required.

How is this done in conmux? Do you have a link to the relevant code?

jluebbe avatar May 03 '24 09:05 jluebbe

You can see some discussion of it in the conmux docs here (search for escape): https://autotest.readthedocs.io/en/latest/main/remote/Conmux-OriginalDocumentation.html

And the code is here: https://github.com/autotest/autotest/tree/master/conmux Though TBH, I haven't ever looked at this code (it's in perl) so I won't pretend to understand how it works.

More specifically, it seems like it's here where the conmux escape sequence ~$ is handled: https://github.com/autotest/autotest/blob/0862aa74389bf434533697a9d970cf91e03b09ce/conmux/conmux#L1049

khilman avatar May 03 '24 19:05 khilman

Just a crazy idea: Extend RFC2217 with a command (set?) to do labgrid stuff? (Or rather extend telnet as several other RFCs (e.g. RFC2217, but not RFC2711 😃) did.

ukleinek avatar Apr 09 '25 07:04 ukleinek