]> git.proxmox.com Git - qemu.git/commitdiff
info vnc command (Anthony Liguori)
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Mon, 5 Feb 2007 20:20:30 +0000 (20:20 +0000)
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>
Mon, 5 Feb 2007 20:20:30 +0000 (20:20 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2391 c046a42c-6fe2-441c-8c8c-71466251a162

monitor.c
vl.h
vnc.c

index 893040a174c92dbaf5de0147143d5cb6ba299ac1..33c482b09085a0698562994b66b381a5f0c2fc71 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -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 --git a/vl.h b/vl.h
index d492f3e7b19d0259152ecf61d27f9e6f774e8518..ff717863f591d19665de96d60d630251ef15df14 100644 (file)
--- a/vl.h
+++ b/vl.h
@@ -909,6 +909,7 @@ void cocoa_display_init(DisplayState *ds, int full_screen);
 
 /* vnc.c */
 void vnc_display_init(DisplayState *ds, const char *display);
+void do_info_vnc(void);
 
 /* x_keymap.c */
 extern uint8_t _translate_keycode(const int key);
diff --git a/vnc.c b/vnc.c
index 30dc516527cd90294d7fcdd9cafbc0aefdab9429..f729e05d8fb723c3c3eb04e0c42cb5a1ea4fd87a 100644 (file)
--- a/vnc.c
+++ b/vnc.c
@@ -73,6 +73,8 @@ struct VncState
     int last_x;
     int last_y;
 
+    const char *display;
+
     Buffer output;
     Buffer input;
     kbd_layout_t *kbd_layout;
@@ -90,6 +92,24 @@ struct VncState
     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.
    2) there is some weirdness when using the -S option (the screen is grey
@@ -1150,6 +1170,8 @@ void vnc_display_init(DisplayState *ds, const char *arg)
        exit(1);
 
     ds->opaque = vs;
+    vnc_state = vs;
+    vs->display = arg;
 
     vs->lsock = -1;
     vs->csock = -1;