diff mbox

[v2] qemu-options.hx: Improve documentation of chardev multiplexing mode

Message ID 1455643738-6068-1-git-send-email-peter.maydell@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Peter Maydell Feb. 16, 2016, 5:28 p.m. UTC
The current documentation of chardev mux=on is rather brief and opaque;
expand it to hopefully be a bit more helpful.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
There was some discussion on #qemu yesterday evening about multiplexing,
and "make the docs a bit less confusing" was one suggestion...

v1->v2 changes:
 * include examples of the multiplexer use
 * mention that some other command options implicitly create a mux
 * link to the documentation of the mux's escape keys
 * fix up the documentation of mux escape keys so it can actually
   be linked to
 * drop the not-implemented "Ctrl-a ?" from the docs
 * improve the documentation of the mux keys a bit (in particular
   mentioning -echr, and being more generic than just "console/monitor")

Our doc structure overall is pretty busted (why is all the documentation
of generic stuff like -chardev lurking in "PC system emulation", for
instance), so this is about as far as I want to go in cleaning up
for now...

 qemu-doc.texi   | 30 ++++++++++++++++++++----------
 qemu-options.hx | 45 +++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 63 insertions(+), 12 deletions(-)

Comments

Laszlo Ersek Feb. 16, 2016, 6:07 p.m. UTC | #1
On 02/16/16 18:28, Peter Maydell wrote:
> The current documentation of chardev mux=on is rather brief and opaque;
> expand it to hopefully be a bit more helpful.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> There was some discussion on #qemu yesterday evening about multiplexing,
> and "make the docs a bit less confusing" was one suggestion...
> 
> v1->v2 changes:
>  * include examples of the multiplexer use
>  * mention that some other command options implicitly create a mux
>  * link to the documentation of the mux's escape keys
>  * fix up the documentation of mux escape keys so it can actually
>    be linked to
>  * drop the not-implemented "Ctrl-a ?" from the docs
>  * improve the documentation of the mux keys a bit (in particular
>    mentioning -echr, and being more generic than just "console/monitor")
> 
> Our doc structure overall is pretty busted (why is all the documentation
> of generic stuff like -chardev lurking in "PC system emulation", for
> instance), so this is about as far as I want to go in cleaning up
> for now...
> 
>  qemu-doc.texi   | 30 ++++++++++++++++++++----------
>  qemu-options.hx | 45 +++++++++++++++++++++++++++++++++++++++++++--
>  2 files changed, 63 insertions(+), 12 deletions(-)
> 
> diff --git a/qemu-doc.texi b/qemu-doc.texi
> index c324da8..bc9dd13 100644
> --- a/qemu-doc.texi
> +++ b/qemu-doc.texi
> @@ -158,7 +158,8 @@ TODO (no longer available)
>  * pcsys_introduction:: Introduction
>  * pcsys_quickstart::   Quick Start
>  * sec_invocation::     Invocation
> -* pcsys_keys::         Keys
> +* pcsys_keys::         Keys in the graphical frontends
> +* mux_keys::           Keys in the character backend multiplexer
>  * pcsys_monitor::      QEMU Monitor
>  * disk_images::        Disk Images
>  * pcsys_network::      Network emulation
> @@ -272,7 +273,7 @@ targets do not need a disk image.
>  @c man end
>  
>  @node pcsys_keys
> -@section Keys
> +@section Keys in the graphical frontends
>  
>  @c man begin OPTIONS
>  
> @@ -322,15 +323,23 @@ Toggle mouse and keyboard grab.
>  In the virtual consoles, you can use @key{Ctrl-Up}, @key{Ctrl-Down},
>  @key{Ctrl-PageUp} and @key{Ctrl-PageDown} to move in the back log.
>  
> -@kindex Ctrl-a h
> -During emulation, if you are using the @option{-nographic} option, use
> -@key{Ctrl-a h} to get terminal commands:
> +@c man end
> +
> +@node mux_keys
> +@section Keys in the character backend multiplexer
> +
> +@c man begin OPTIONS
> +
> +During emulation, if you are using a character backend multiplexer
> +(which is the default if you are using @option{-nographic}) then
> +several commands are available via an escape sequence. These
> +key sequences all start with an escape character, which is @key{Ctrl-a}
> +by default, but can be changed with @option{-echr}. The list below assumes
> +you're using the default.
>  
>  @table @key
>  @item Ctrl-a h
>  @kindex Ctrl-a h
> -@item Ctrl-a ?
> -@kindex Ctrl-a ?
>  Print this help
>  @item Ctrl-a x
>  @kindex Ctrl-a x
> @@ -346,10 +355,11 @@ Toggle console timestamps
>  Send break (magic sysrq in Linux)
>  @item Ctrl-a c
>  @kindex Ctrl-a c
> -Switch between console and monitor
> +Rotate between the frontends connected to the multiplexer (usually
> +this switches between the monitor and the console)
>  @item Ctrl-a Ctrl-a
> -@kindex Ctrl-a a
> -Send Ctrl-a
> +@kindex Ctrl-a Ctrl-a
> +Send the escape character to the frontend
>  @end table
>  @c man end
>  
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 2f0465e..7e6762e 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -2162,8 +2162,49 @@ 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.
> +Specify @option{mux=on} to enable this mode.
> +A multiplexer is a "1:N" device, and here the "1" end is your specified chardev
> +backend, and the "N" end is the various parts of QEMU that can talk to a chardev.
> +If you create a chardev with @option{id=myid} and @option{mux=on}, QEMU will
> +create a multiplexer with your specified ID, and you can then configure multiple
> +front ends to use that chardev ID for their input/output. Up to four different
> +front ends can be connected to a single multiplexed chardev. (Without
> +multiplexing enabled, a chardev can only be used by a single front end.)
> +For instance you could use this to allow a single stdio chardev to be used by
> +two serial ports and the QEMU monitor:
> +
> +@example
> +-chardev stdio,mux=on,id=char0 \
> +-mon chardev=char0,mode=readline,default \
> +-serial chardev:char0 \
> +-serial chardev:char0
> +@end example
> +
> +You can have more than one multiplexer in a system configuration; for instance
> +you could have a TCP port multiplexed between UART 0 and UART 1, and stdio
> +multiplexed between the QEMU monitor and a parallel port:
> +
> +@example
> +-chardev stdio,mux=on,id=char0 \
> +-mon chardev=char0,mode=readline,default \
> +-parallel chardev:char0 \
> +-chardev tcp,...,mux=on,id=char1 \
> +-serial chardev:char1 \
> +-serial chardev:char1
> +@end example
> +
> +When you're using a multiplexed character device, some escape sequences are
> +interpreted in the input. @xref{mux_keys, Keys in the character backend
> +multiplexer}.
> +
> +Note that some other command line options may implicitly create multiplexed
> +character backends; for instance @option{-serial mon:stdio} creates a
> +multiplexed stdio backend connected to the serial port and the QEMU monitor,
> +and @option{-nographic} also multiplexes the console and the monitor to
> +stdio.
> +
> +There is currently no support for multiplexing in the other direction
> +(where a single QEMU front end takes input and output from multiple chardevs).
>  
>  Every backend supports the @option{logfile} option, which supplies the path
>  to a file to record all data transmitted via the backend. The @option{logappend}
> 

not claiming to be an expert on this, but still:

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Kashyap Chamarthy Feb. 16, 2016, 7:44 p.m. UTC | #2
On Tue, Feb 16, 2016 at 05:28:58PM +0000, Peter Maydell wrote:
> The current documentation of chardev mux=on is rather brief and opaque;
> expand it to hopefully be a bit more helpful.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> There was some discussion on #qemu yesterday evening about multiplexing,
> and "make the docs a bit less confusing" was one suggestion...
> 
> v1->v2 changes:
>  * include examples of the multiplexer use
>  * mention that some other command options implicitly create a mux
>  * link to the documentation of the mux's escape keys
>  * fix up the documentation of mux escape keys so it can actually
>    be linked to
>  * drop the not-implemented "Ctrl-a ?" from the docs
>  * improve the documentation of the mux keys a bit (in particular
>    mentioning -echr, and being more generic than just "console/monitor")
> 
> Our doc structure overall is pretty busted (why is all the documentation
> of generic stuff like -chardev lurking in "PC system emulation", for
> instance), so this is about as far as I want to go in cleaning up
> for now...
> 
>  qemu-doc.texi   | 30 ++++++++++++++++++++----------
>  qemu-options.hx | 45 +++++++++++++++++++++++++++++++++++++++++++--
>  2 files changed, 63 insertions(+), 12 deletions(-)
> 
> diff --git a/qemu-doc.texi b/qemu-doc.texi
> index c324da8..bc9dd13 100644
> --- a/qemu-doc.texi
> +++ b/qemu-doc.texi
> @@ -158,7 +158,8 @@ TODO (no longer available)
>  * pcsys_introduction:: Introduction
>  * pcsys_quickstart::   Quick Start
>  * sec_invocation::     Invocation
> -* pcsys_keys::         Keys
> +* pcsys_keys::         Keys in the graphical frontends
> +* mux_keys::           Keys in the character backend multiplexer
>  * pcsys_monitor::      QEMU Monitor
>  * disk_images::        Disk Images
>  * pcsys_network::      Network emulation
> @@ -272,7 +273,7 @@ targets do not need a disk image.
>  @c man end
>  
>  @node pcsys_keys
> -@section Keys
> +@section Keys in the graphical frontends
>  
>  @c man begin OPTIONS
>  
> @@ -322,15 +323,23 @@ Toggle mouse and keyboard grab.
>  In the virtual consoles, you can use @key{Ctrl-Up}, @key{Ctrl-Down},
>  @key{Ctrl-PageUp} and @key{Ctrl-PageDown} to move in the back log.
>  
> -@kindex Ctrl-a h
> -During emulation, if you are using the @option{-nographic} option, use
> -@key{Ctrl-a h} to get terminal commands:
> +@c man end
> +
> +@node mux_keys
> +@section Keys in the character backend multiplexer
> +
> +@c man begin OPTIONS
> +
> +During emulation, if you are using a character backend multiplexer
> +(which is the default if you are using @option{-nographic}) then
> +several commands are available via an escape sequence. These
> +key sequences all start with an escape character, which is @key{Ctrl-a}
> +by default, but can be changed with @option{-echr}. The list below assumes
> +you're using the default.
>  
>  @table @key
>  @item Ctrl-a h
>  @kindex Ctrl-a h
> -@item Ctrl-a ?
> -@kindex Ctrl-a ?
>  Print this help
>  @item Ctrl-a x
>  @kindex Ctrl-a x
> @@ -346,10 +355,11 @@ Toggle console timestamps
>  Send break (magic sysrq in Linux)
>  @item Ctrl-a c
>  @kindex Ctrl-a c
> -Switch between console and monitor
> +Rotate between the frontends connected to the multiplexer (usually
> +this switches between the monitor and the console)
>  @item Ctrl-a Ctrl-a
> -@kindex Ctrl-a a
> -Send Ctrl-a
> +@kindex Ctrl-a Ctrl-a
> +Send the escape character to the frontend
>  @end table
>  @c man end
>  
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 2f0465e..7e6762e 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -2162,8 +2162,49 @@ 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.
> +Specify @option{mux=on} to enable this mode.
> +A multiplexer is a "1:N" device, and here the "1" end is your specified chardev
> +backend, and the "N" end is the various parts of QEMU that can talk to a chardev.
> +If you create a chardev with @option{id=myid} and @option{mux=on}, QEMU will
> +create a multiplexer with your specified ID, and you can then configure multiple
> +front ends to use that chardev ID for their input/output. Up to four different
> +front ends can be connected to a single multiplexed chardev. (Without
> +multiplexing enabled, a chardev can only be used by a single front end.)
> +For instance you could use this to allow a single stdio chardev to be used by
> +two serial ports and the QEMU monitor:
> +
> +@example
> +-chardev stdio,mux=on,id=char0 \
> +-mon chardev=char0,mode=readline,default \
> +-serial chardev:char0 \
> +-serial chardev:char0
> +@end example
> +
> +You can have more than one multiplexer in a system configuration; for instance
> +you could have a TCP port multiplexed between UART 0 and UART 1, and stdio
> +multiplexed between the QEMU monitor and a parallel port:
> +
> +@example
> +-chardev stdio,mux=on,id=char0 \
> +-mon chardev=char0,mode=readline,default \
> +-parallel chardev:char0 \
> +-chardev tcp,...,mux=on,id=char1 \
> +-serial chardev:char1 \
> +-serial chardev:char1
> +@end example
> +
> +When you're using a multiplexed character device, some escape sequences are
> +interpreted in the input. @xref{mux_keys, Keys in the character backend
> +multiplexer}.
> +
> +Note that some other command line options may implicitly create multiplexed
> +character backends; for instance @option{-serial mon:stdio} creates a
> +multiplexed stdio backend connected to the serial port and the QEMU monitor,
> +and @option{-nographic} also multiplexes the console and the monitor to
> +stdio.
> +
> +There is currently no support for multiplexing in the other direction
> +(where a single QEMU front end takes input and output from multiple chardevs).
>  
>  Every backend supports the @option{logfile} option, which supplies the path
>  to a file to record all data transmitted via the backend. The @option{logappend}

Nice.  Reads a whole lot clearer (contextual description, followed by a
practical example and related additional information) than before.  And
as a user of QEMU, I could follow if I pay attention carefully. :-)

Thanks!

FWIW:

Reviewed-by: Kashyap Chamarthy <kchamart@redhat.com>
Stefan Hajnoczi Feb. 17, 2016, 9:56 a.m. UTC | #3
On Tue, Feb 16, 2016 at 05:28:58PM +0000, Peter Maydell wrote:
> The current documentation of chardev mux=on is rather brief and opaque;
> expand it to hopefully be a bit more helpful.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> There was some discussion on #qemu yesterday evening about multiplexing,
> and "make the docs a bit less confusing" was one suggestion...
> 
> v1->v2 changes:
>  * include examples of the multiplexer use
>  * mention that some other command options implicitly create a mux
>  * link to the documentation of the mux's escape keys
>  * fix up the documentation of mux escape keys so it can actually
>    be linked to
>  * drop the not-implemented "Ctrl-a ?" from the docs
>  * improve the documentation of the mux keys a bit (in particular
>    mentioning -echr, and being more generic than just "console/monitor")
> 
> Our doc structure overall is pretty busted (why is all the documentation
> of generic stuff like -chardev lurking in "PC system emulation", for
> instance), so this is about as far as I want to go in cleaning up
> for now...
> 
>  qemu-doc.texi   | 30 ++++++++++++++++++++----------
>  qemu-options.hx | 45 +++++++++++++++++++++++++++++++++++++++++++--
>  2 files changed, 63 insertions(+), 12 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
diff mbox

Patch

diff --git a/qemu-doc.texi b/qemu-doc.texi
index c324da8..bc9dd13 100644
--- a/qemu-doc.texi
+++ b/qemu-doc.texi
@@ -158,7 +158,8 @@  TODO (no longer available)
 * pcsys_introduction:: Introduction
 * pcsys_quickstart::   Quick Start
 * sec_invocation::     Invocation
-* pcsys_keys::         Keys
+* pcsys_keys::         Keys in the graphical frontends
+* mux_keys::           Keys in the character backend multiplexer
 * pcsys_monitor::      QEMU Monitor
 * disk_images::        Disk Images
 * pcsys_network::      Network emulation
@@ -272,7 +273,7 @@  targets do not need a disk image.
 @c man end
 
 @node pcsys_keys
-@section Keys
+@section Keys in the graphical frontends
 
 @c man begin OPTIONS
 
@@ -322,15 +323,23 @@  Toggle mouse and keyboard grab.
 In the virtual consoles, you can use @key{Ctrl-Up}, @key{Ctrl-Down},
 @key{Ctrl-PageUp} and @key{Ctrl-PageDown} to move in the back log.
 
-@kindex Ctrl-a h
-During emulation, if you are using the @option{-nographic} option, use
-@key{Ctrl-a h} to get terminal commands:
+@c man end
+
+@node mux_keys
+@section Keys in the character backend multiplexer
+
+@c man begin OPTIONS
+
+During emulation, if you are using a character backend multiplexer
+(which is the default if you are using @option{-nographic}) then
+several commands are available via an escape sequence. These
+key sequences all start with an escape character, which is @key{Ctrl-a}
+by default, but can be changed with @option{-echr}. The list below assumes
+you're using the default.
 
 @table @key
 @item Ctrl-a h
 @kindex Ctrl-a h
-@item Ctrl-a ?
-@kindex Ctrl-a ?
 Print this help
 @item Ctrl-a x
 @kindex Ctrl-a x
@@ -346,10 +355,11 @@  Toggle console timestamps
 Send break (magic sysrq in Linux)
 @item Ctrl-a c
 @kindex Ctrl-a c
-Switch between console and monitor
+Rotate between the frontends connected to the multiplexer (usually
+this switches between the monitor and the console)
 @item Ctrl-a Ctrl-a
-@kindex Ctrl-a a
-Send Ctrl-a
+@kindex Ctrl-a Ctrl-a
+Send the escape character to the frontend
 @end table
 @c man end
 
diff --git a/qemu-options.hx b/qemu-options.hx
index 2f0465e..7e6762e 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2162,8 +2162,49 @@  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.
+Specify @option{mux=on} to enable this mode.
+A multiplexer is a "1:N" device, and here the "1" end is your specified chardev
+backend, and the "N" end is the various parts of QEMU that can talk to a chardev.
+If you create a chardev with @option{id=myid} and @option{mux=on}, QEMU will
+create a multiplexer with your specified ID, and you can then configure multiple
+front ends to use that chardev ID for their input/output. Up to four different
+front ends can be connected to a single multiplexed chardev. (Without
+multiplexing enabled, a chardev can only be used by a single front end.)
+For instance you could use this to allow a single stdio chardev to be used by
+two serial ports and the QEMU monitor:
+
+@example
+-chardev stdio,mux=on,id=char0 \
+-mon chardev=char0,mode=readline,default \
+-serial chardev:char0 \
+-serial chardev:char0
+@end example
+
+You can have more than one multiplexer in a system configuration; for instance
+you could have a TCP port multiplexed between UART 0 and UART 1, and stdio
+multiplexed between the QEMU monitor and a parallel port:
+
+@example
+-chardev stdio,mux=on,id=char0 \
+-mon chardev=char0,mode=readline,default \
+-parallel chardev:char0 \
+-chardev tcp,...,mux=on,id=char1 \
+-serial chardev:char1 \
+-serial chardev:char1
+@end example
+
+When you're using a multiplexed character device, some escape sequences are
+interpreted in the input. @xref{mux_keys, Keys in the character backend
+multiplexer}.
+
+Note that some other command line options may implicitly create multiplexed
+character backends; for instance @option{-serial mon:stdio} creates a
+multiplexed stdio backend connected to the serial port and the QEMU monitor,
+and @option{-nographic} also multiplexes the console and the monitor to
+stdio.
+
+There is currently no support for multiplexing in the other direction
+(where a single QEMU front end takes input and output from multiple chardevs).
 
 Every backend supports the @option{logfile} option, which supplies the path
 to a file to record all data transmitted via the backend. The @option{logappend}