From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H32IZ-0006lc-RA for qemu-devel@nongnu.org; Fri, 05 Jan 2007 22:32:47 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H32IX-0006lQ-EY for qemu-devel@nongnu.org; Fri, 05 Jan 2007 22:32:46 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H32IX-0006lN-8i for qemu-devel@nongnu.org; Fri, 05 Jan 2007 22:32:45 -0500 Received: from [128.83.139.10] (helo=mail.cs.utexas.edu) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1H32IW-0003Ah-Qd for qemu-devel@nongnu.org; Fri, 05 Jan 2007 22:32:45 -0500 Message-ID: <459F1853.5050006@cs.utexas.edu> Date: Fri, 05 Jan 2007 21:32:35 -0600 From: Anthony Liguori MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030803020505090702020605" Subject: [Qemu-devel] [PATCH] Add an info vnc monitor command Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------030803020505090702020605 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------030803020505090702020605 Content-Type: text/x-patch; name="qemu-info-vnc.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="qemu-info-vnc.diff" 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; --------------030803020505090702020605--