Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NDGin-0003zZ-BV for qemu-devel@nongnu.org; Wed, 25 Nov 2009 07:11:45 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NDGii-0003w3-Ax for qemu-devel@nongnu.org; Wed, 25 Nov 2009 07:11:44 -0500 Received: from [199.232.76.173] (port=53259 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDGii-0003vz-2q for qemu-devel@nongnu.org; Wed, 25 Nov 2009 07:11:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:5536) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NDGih-0004KL-OG for qemu-devel@nongnu.org; Wed, 25 Nov 2009 07:11:40 -0500 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAPCBcD5014802 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 25 Nov 2009 07:11:38 -0500 From: Gerd Hoffmann Date: Wed, 25 Nov 2009 13:11:34 +0100 Message-Id: <1259151094-12287-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH] chardev: make chardevs specified in config file work. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann The patch decuples the -chardev switch and the actual chardev initialization. Without this patch qemu ignores chardev entries coming via -readconfig. Signed-off-by: Gerd Hoffmann --- vl.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/vl.c b/vl.c index d188fc6..524b496 100644 --- a/vl.c +++ b/vl.c @@ -4573,6 +4573,16 @@ static int device_init_func(QemuOpts *opts, void *opaque) return 0; } +static int chardev_init_func(QemuOpts *opts, void *opaque) +{ + CharDriverState *chr; + + chr = qemu_chr_open_opts(opts, NULL); + if (!chr) + return -1; + return 0; +} + struct device_config { enum { DEV_USB, /* -usbdevice */ @@ -5193,9 +5203,6 @@ int main(int argc, char **argv, char **envp) fprintf(stderr, "parse error: %s\n", optarg); exit(1); } - if (qemu_chr_open_opts(opts, NULL) == NULL) { - exit(1); - } break; case QEMU_OPTION_serial: add_device_config(DEV_SERIAL, optarg); @@ -5506,6 +5513,9 @@ int main(int argc, char **argv, char **envp) qemu_opts_foreach(&qemu_device_opts, default_driver_check, NULL, 0); + if (qemu_opts_foreach(&qemu_chardev_opts, chardev_init_func, NULL, 1) != 0) + exit(1); + if (display_type == DT_NOGRAPHIC) { if (default_parallel) add_device_config(DEV_PARALLEL, "null"); -- 1.6.2.5