We want to expose VCs using a VteTerminal widget. We need access to provide our own CharDriverState in order to do this.
Signed-off-by: Anthony Liguori <aligu...@us.ibm.com> --- console.c | 14 +++++++++++++- console.h | 6 +++++- qemu-char.c | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/console.c b/console.c index 135394f..d8303af 100644 --- a/console.c +++ b/console.c @@ -1510,7 +1510,7 @@ static void text_console_do_init(CharDriverState *chr, DisplayState *ds) chr->init(chr); } -int text_console_init(QemuOpts *opts, CharDriverState **_chr) +static int text_console_init(QemuOpts *opts, CharDriverState **_chr) { CharDriverState *chr; TextConsole *s; @@ -1555,6 +1555,18 @@ int text_console_init(QemuOpts *opts, CharDriverState **_chr) return 0; } +static VcHandler *vc_handler = text_console_init; + +int vc_init(QemuOpts *opts, CharDriverState **_chr) +{ + return vc_handler(opts, _chr); +} + +void register_vc_handler(VcHandler *handler) +{ + vc_handler = handler; +} + void text_consoles_set_display(DisplayState *ds) { int i; diff --git a/console.h b/console.h index 6ba0d5d..7225ae6 100644 --- a/console.h +++ b/console.h @@ -356,7 +356,6 @@ void vga_hw_text_update(console_ch_t *chardata); int is_graphic_console(void); int is_fixedsize_console(void); -int text_console_init(QemuOpts *opts, CharDriverState **_chr); void text_consoles_set_display(DisplayState *ds); void console_select(unsigned int index); void console_color_init(DisplayState *ds); @@ -364,6 +363,11 @@ void qemu_console_resize(DisplayState *ds, int width, int height); void qemu_console_copy(DisplayState *ds, int src_x, int src_y, int dst_x, int dst_y, int w, int h); +typedef int (VcHandler)(QemuOpts *, CharDriverState **); + +int vc_init(QemuOpts *opts, CharDriverState **_chr); +void register_vc_handler(VcHandler *handler); + /* sdl.c */ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame); diff --git a/qemu-char.c b/qemu-char.c index b1d80dd..4680d3c 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -2736,7 +2736,7 @@ static const struct { { .name = "socket", .open = qemu_chr_open_socket }, { .name = "udp", .open = qemu_chr_open_udp }, { .name = "msmouse", .open = qemu_chr_open_msmouse }, - { .name = "vc", .open = text_console_init }, + { .name = "vc", .open = vc_init }, #ifdef _WIN32 { .name = "file", .open = qemu_chr_open_win_file_out }, { .name = "pipe", .open = qemu_chr_open_win_pipe }, -- 1.7.4.1