diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2009-09-10 10:58:49 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-09-11 10:19:49 -0500 |
commit | 6ea314d91439741e95772dfbab98b4135e04bebb (patch) | |
tree | a9988cefcac0b4426ee8be45fa212e7e82e427f2 /qemu-char.c | |
parent | 48b7649691a20063d7a97920628f234f348e4f70 (diff) |
convert vc chardev to QemuOpts.
new cmd line syntax:
-chardev vc,id=name
-chardev vc,id=name,width=pixels,height=pixels
-chardev vc,id=name,cols=chars,rows=chars
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'qemu-char.c')
-rw-r--r-- | qemu-char.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/qemu-char.c b/qemu-char.c index e02ac5e013..3240e138a9 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -2221,7 +2221,7 @@ static CharDriverState *qemu_chr_open_socket(QemuOpts *opts) static QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename) { - char host[65], port[33]; + char host[65], port[33], width[8], height[8]; int pos; const char *p; QemuOpts *opts; @@ -2238,6 +2238,23 @@ static QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename) qemu_opt_set(opts, "backend", filename); return opts; } + if (strstart(filename, "vc", &p)) { + qemu_opt_set(opts, "backend", "vc"); + if (*p == ':') { + if (sscanf(p+1, "%8[0-9]x%8[0-9]", width, height) == 2) { + /* pixels */ + qemu_opt_set(opts, "width", width); + qemu_opt_set(opts, "height", height); + } else if (sscanf(p+1, "%8[0-9]Cx%8[0-9]C", width, height) == 2) { + /* chars */ + qemu_opt_set(opts, "cols", width); + qemu_opt_set(opts, "rows", height); + } else { + goto fail; + } + } + return opts; + } if (strcmp(filename, "con:") == 0) { qemu_opt_set(opts, "backend", "console"); return opts; @@ -2306,6 +2323,7 @@ static const struct { { .name = "null", .open = qemu_chr_open_null }, { .name = "socket", .open = qemu_chr_open_socket }, { .name = "msmouse", .open = qemu_chr_open_msmouse }, + { .name = "vc", .open = text_console_init }, #ifdef _WIN32 { .name = "file", .open = qemu_chr_open_win_file_out }, { .name = "pipe", .open = qemu_chr_open_win_pipe }, @@ -2376,12 +2394,6 @@ CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*i return qemu_chr_open_opts(opts, init); } - if (!strcmp(filename, "vc")) { - chr = text_console_init(NULL); - } else - if (strstart(filename, "vc:", &p)) { - chr = text_console_init(p); - } else if (strstart(filename, "udp:", &p)) { chr = qemu_chr_open_udp(p); } else |