monitor: Small usability fixes
cover monitor: Small usability fixes
Here are some patches that address what I brought up in [1]:
- avoid naming collisions between new -mon and old -monitor
- fix mux'ed monitor startup focus
- document new mux syntax
[1] http://thread.gmane.org/gmane.comp.emulators.qemu/65976
Jan Kiszka (3):
monitor: Cleanup ID assignment for compat switch
monitor: Reorder intialization to drop initial mux focus
chardev: Document mux option
qemu-options.hx | 35 ++++++++++++++++++++--------------- vl.c | 15 +++++++-------- 2 files changed, 27 insertions(+), 23 deletions(-)
PATCH 1/3 monitor: Cleanup ID assignment for compat switch
Canonicalize the ID assignment when creating monitor devices via the legacy switch and use less easily colliding names.
--- vl.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-)
vl.c +3 -5
@@ -2418,11 +2418,9 @@ static void monitor_parse(const char *optarg, const char *mode)if (strstart (optarg,"chardev:" , &p)) {snprintf (label,sizeof (label),"%s" , p); }else { -if (monitor_device_index) { -snprintf (label,sizeof (label),"monitor%d" , - monitor_device_index); - }else { -snprintf (label,sizeof (label),"monitor" ); +snprintf (label,sizeof (label),"compat_monitor%d" , + monitor_device_index); +if (monitor_device_index ==0 ) { def =1 ; } opts =qemu_chr_parse_compat (label, optarg);
Signature · 1 line
1.6.0.2
PATCH 2/3 monitor: Reorder intialization to drop initial mux focus
In reply to Jan KiszkaSo far a multiplexed monitor started disabled. Restore this property for the new way of configuring by moving the monitor initialization before all devices (the last one to attach to a char-mux will gain the focus).
Once we have a real use case for that, we may also consider assigning the initial focus explicitly.
--- vl.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
vl.c +4 -3
@@ -3712,6 +3712,10 @@ int main(int argc, char **argv, char **envp) } } +if (qemu_opts_foreach (&qemu_mon_opts, mon_init_func,NULL ,1 ) !=0 ) { +exit (1 ); + } +if (foreach_device_config (DEV_SERIAL , serial_parse) <0 )exit (1 );if (foreach_device_config (DEV_PARALLEL , parallel_parse) <0 )
@@ -3824,9 +3828,6 @@ int main(int argc, char **argv, char **envp)text_consoles_set_display (ds); -if (qemu_opts_foreach (&qemu_mon_opts, mon_init_func,NULL ,1 ) !=0 ) -exit (1 ); -if (gdbstub_dev &&gdbserver_start (gdbstub_dev) <0 ) {fprintf (stderr,"qemu: could not open gdbserver on device '%s'\n" , gdbstub_dev);
Signature · 1 line
1.6.0.2
PATCH 3/3 chardev: Document mux option
In reply to Jan Kiszka--- qemu-options.hx | 35 ++++++++++++++++++++--------------- 1 files changed, 20 insertions(+), 15 deletions(-)
qemu-options.hx +20 -15
@@ -1175,32 +1175,33 @@ DEFHEADING() DEFHEADING(Character device options:) DEF("chardev", HAS_ARG, QEMU_OPTION_chardev, - "-chardev null,id=id\n" + "-chardev null,id=id[,mux=on|off]\n" "-chardev socket,id=id[,host=host],port=host[,to=to][,ipv4][,ipv6][,nodelay]\n" - " [,server][,nowait][,telnet] (tcp)\n" - "-chardev socket,id=id,path=path[,server][,nowait][,telnet] (unix)\n" + " [,server][,nowait][,telnet][,mux=on|off] (tcp)\n" + "-chardev socket,id=id,path=path[,server][,nowait][,telnet],[mux=on|off] (unix)\n" "-chardev udp,id=id[,host=host],port=port[,localaddr=localaddr]\n" - " [,localport=localport][,ipv4][,ipv6]\n" - "-chardev msmouse,id=id\n" + " [,localport=localport][,ipv4][,ipv6][,mux=on|off]\n" + "-chardev msmouse,id=id[,mux=on|off]\n" "-chardev vc,id=id[[,width=width][,height=height]][[,cols=cols][,rows=rows]]\n" - "-chardev file,id=id,path=path\n" - "-chardev pipe,id=id,path=path\n" + " [,mux=on|off]\n" + "-chardev file,id=id,path=path[,mux=on|off]\n" + "-chardev pipe,id=id,path=path[,mux=on|off]\n" #ifdef _WIN32 - "-chardev console,id=id\n" - "-chardev serial,id=id,path=path\n" + "-chardev console,id=id[,mux=on|off]\n" + "-chardev serial,id=id,path=path[,mux=on|off]\n" #else - "-chardev pty,id=id\n" - "-chardev stdio,id=id\n" + "-chardev pty,id=id[,mux=on|off]\n" + "-chardev stdio,id=id[,mux=on|off]\n" #endif #ifdef CONFIG_BRLAPI - "-chardev braille,id=id\n" + "-chardev braille,id=id[,mux=on|off]\n" #endif #if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \ || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) - "-chardev tty,id=id,path=path\n" + "-chardev tty,id=id,path=path[,mux=on|off]\n" #endif #if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) - "-chardev parport,id=id,path=path\n" + "-chardev parport,id=id,path=path[,mux=on|off]\n" #endif , QEMU_ARCH_ALL )
@@ -1210,7 +1211,7 @@ STEXI The general form of a character device option is: @table @option -@item -chardev @var{backend} ,id=@var{id} [,@var{options}] +@item -chardev @var{backend} ,id=@var{id} [,mux=on|off] [,@var{options}] @findex -chardev Backend is one of: @option{null},
@@ -1232,6 +1233,10 @@ The specific backend will determine the applicable options. All devices must have an id, which can be any string up to 127 characters long. It is used to uniquely identify this device in other command line directives. +A character device may be used in multiplexing mode by multiple front-ends. +The key sequence of @key{Control-a} and @key{c} will rotate the input focus +between attached front-ends. Specify @option{mux=on} to enable this mode. + Options to each backend are described below. @item -chardev null ,id=@var{id}
Signature · 1 line
1.6.0.2