In ILOM and presumable older ALOM as well, the default escape sequence
to drop from serial back to ILOM is '#.';  this is very convenient since
I'm always connecting to ILOM via serial or SSH, both use ~ by default.

This diff makes cu(1) use # for guest domains to mimic ILOM.  I'm always
connected via serial or SSH to the primary domain, hence same pattern.

As `ldomctl console' is recent addition that is not yet included in the
last release which still requires manual cu(1) usage, I see no reason
not to "break" usage pattern.

Furthermore, let's print a brief reminder about the escape character:

        $ doas obj/ldomctl console guest1
        Escape character: #
        Connected to /dev/ttyV0 (speed 9600)

        {0} ok 

similar to what ILOM does (empty lines as they are printed):

        -> start -script /SP/console

        Serial console started.  To stop, type #.


        OpenBSD/sparc64 (xxx) (console)

        login: 


Feedback? OK?


Index: ldomctl.8
===================================================================
RCS file: /cvs/src/usr.sbin/ldomctl/ldomctl.8,v
retrieving revision 1.21
diff -u -p -r1.21 ldomctl.8
--- ldomctl.8   30 Dec 2019 20:10:48 -0000      1.21
+++ ldomctl.8   31 Dec 2019 18:27:26 -0000
@@ -48,6 +48,8 @@ e.g. 512M.
 Using
 .Xr cu 1
 connect to the console of the guest domain.
+The escape character is
+.Sy # .
 .It Cm delete Ar configuration
 Delete the specified configuration from non-volatile storage.
 .It Cm download Ar directory
Index: ldomctl.c
===================================================================
RCS file: /cvs/src/usr.sbin/ldomctl/ldomctl.c,v
retrieving revision 1.31
diff -u -p -r1.31 ldomctl.c
--- ldomctl.c   28 Dec 2019 18:36:02 -0000      1.31
+++ ldomctl.c   31 Dec 2019 18:33:09 -0000
@@ -643,8 +643,9 @@ guest_console(int argc, char **argv)
                    "ttyV%llu", guest->gid - 1);
 
                closefrom(STDERR_FILENO + 1);
+               fprintf(stderr, "Escape character: #\n");
                execl(LDOMCTL_CU, LDOMCTL_CU, "-r", "-l", console_str,
-                   (char *)NULL);
+                   "-E", "#", (char *)NULL);
                err(1, "failed to open console");
        }
 }

Reply via email to