Commit a9ce859052ccb0d588173dfa11bc9cd6858ec6c3
1 parent
564c337e
info vnc command (Anthony Liguori)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2391 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
3 changed files
with
25 additions
and
0 deletions
monitor.c
| ... | ... | @@ -1297,6 +1297,8 @@ static term_cmd_t info_cmds[] = { |
| 1297 | 1297 | "", "show the currently saved VM snapshots" }, |
| 1298 | 1298 | { "mice", "", do_info_mice, |
| 1299 | 1299 | "", "show which guest mouse is receiving events" }, |
| 1300 | + { "vnc", "", do_info_vnc, | |
| 1301 | + "", "show the vnc server status"}, | |
| 1300 | 1302 | { NULL, NULL, }, |
| 1301 | 1303 | }; |
| 1302 | 1304 | ... | ... |
vl.h
| ... | ... | @@ -909,6 +909,7 @@ void cocoa_display_init(DisplayState *ds, int full_screen); |
| 909 | 909 | |
| 910 | 910 | /* vnc.c */ |
| 911 | 911 | void vnc_display_init(DisplayState *ds, const char *display); |
| 912 | +void do_info_vnc(void); | |
| 912 | 913 | |
| 913 | 914 | /* x_keymap.c */ |
| 914 | 915 | extern uint8_t _translate_keycode(const int key); | ... | ... |
vnc.c
| ... | ... | @@ -73,6 +73,8 @@ struct VncState |
| 73 | 73 | int last_x; |
| 74 | 74 | int last_y; |
| 75 | 75 | |
| 76 | + const char *display; | |
| 77 | + | |
| 76 | 78 | Buffer output; |
| 77 | 79 | Buffer input; |
| 78 | 80 | kbd_layout_t *kbd_layout; |
| ... | ... | @@ -90,6 +92,24 @@ struct VncState |
| 90 | 92 | uint8_t modifiers_state[256]; |
| 91 | 93 | }; |
| 92 | 94 | |
| 95 | +static VncState *vnc_state; /* needed for info vnc */ | |
| 96 | + | |
| 97 | +void do_info_vnc(void) | |
| 98 | +{ | |
| 99 | + if (vnc_state == NULL) | |
| 100 | + term_printf("VNC server disabled\n"); | |
| 101 | + else { | |
| 102 | + term_printf("VNC server active on: "); | |
| 103 | + term_print_filename(vnc_state->display); | |
| 104 | + term_printf("\n"); | |
| 105 | + | |
| 106 | + if (vnc_state->csock == -1) | |
| 107 | + term_printf("No client connected\n"); | |
| 108 | + else | |
| 109 | + term_printf("Client connected\n"); | |
| 110 | + } | |
| 111 | +} | |
| 112 | + | |
| 93 | 113 | /* TODO |
| 94 | 114 | 1) Get the queue working for IO. |
| 95 | 115 | 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) |
| 1150 | 1170 | exit(1); |
| 1151 | 1171 | |
| 1152 | 1172 | ds->opaque = vs; |
| 1173 | + vnc_state = vs; | |
| 1174 | + vs->display = arg; | |
| 1153 | 1175 | |
| 1154 | 1176 | vs->lsock = -1; |
| 1155 | 1177 | vs->csock = -1; | ... | ... |