qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@cs.utexas.edu>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Add an info vnc monitor command
Date: Fri, 05 Jan 2007 21:32:35 -0600	[thread overview]
Message-ID: <459F1853.5050006@cs.utexas.edu> (raw)

[-- Attachment #1: Type: text/plain, Size: 254 bytes --]

The following patch adds an info vnc monitor command.  When writing a 
front-end, it's useful to be able to determine 1) if a client is current 
connected to the VNC server and 2) what the VNC server is actually 
listening on.

Regards,

Anthony Liguori

[-- Attachment #2: qemu-info-vnc.diff --]
[-- Type: text/x-patch, Size: 1750 bytes --]

diff -r 64e6128482fb monitor.c
--- a/monitor.c	Fri Jan 05 21:20:37 2007 -0600
+++ b/monitor.c	Fri Jan 05 21:21:03 2007 -0600
@@ -1297,6 +1297,8 @@ static term_cmd_t info_cmds[] = {
       "", "show the currently saved VM snapshots" },
     { "mice", "", do_info_mice,
       "", "show which guest mouse is receiving events" },
+    { "vnc", "", do_info_vnc,
+      "", "show the vnc server status"},
     { NULL, NULL, },
 };
 
diff -r 64e6128482fb vl.h
--- a/vl.h	Fri Jan 05 21:20:37 2007 -0600
+++ b/vl.h	Fri Jan 05 21:20:37 2007 -0600
@@ -897,6 +897,7 @@ void cocoa_display_init(DisplayState *ds
 
 /* vnc.c */
 void vnc_display_init(DisplayState *ds, const char *display);
+void do_info_vnc(void);
 
 /* ide.c */
 #define MAX_DISKS 4
diff -r 64e6128482fb vnc.c
--- a/vnc.c	Fri Jan 05 21:20:37 2007 -0600
+++ b/vnc.c	Fri Jan 05 21:20:37 2007 -0600
@@ -73,6 +73,8 @@ struct VncState
     int last_x;
     int last_y;
 
+    const char *display;
+
     Buffer output;
     Buffer input;
     kbd_layout_t *kbd_layout;
@@ -89,6 +91,24 @@ struct VncState
     /* input */
     uint8_t modifiers_state[256];
 };
+
+static VncState *vnc_state; /* needed for info vnc */
+
+void do_info_vnc(void)
+{
+    if (vnc_state == NULL)
+	term_printf("VNC server disabled\n");
+    else {
+	term_printf("VNC server active on: ");
+	term_print_filename(vnc_state->display);
+	term_printf("\n");
+
+	if (vnc_state->csock == -1)
+	    term_printf("No client connected\n");
+	else
+	    term_printf("Client connected\n");
+    }
+}
 
 /* TODO
    1) Get the queue working for IO.
@@ -1150,6 +1170,8 @@ void vnc_display_init(DisplayState *ds, 
 	exit(1);
 
     ds->opaque = vs;
+    vnc_state = vs;
+    vs->display = arg;
 
     vs->lsock = -1;
     vs->csock = -1;

                 reply	other threads:[~2007-01-06  3:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=459F1853.5050006@cs.utexas.edu \
    --to=aliguori@cs.utexas.edu \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).