From 5ccfae10a79e52654c9edc68da6d05f29466b4f9 Mon Sep 17 00:00:00 2001 From: aliguori Date: Fri, 31 Oct 2008 17:31:29 +0000 Subject: Implement "info chardev" command. (Gerd Hoffmann) This patch makes qemu keep track of the character devices in use and implements a "info chardev" monitor command to print a list. qemu_chr_open() sticks the devices into a linked list now. It got a new argument (label), so there is a name for each device. It also assigns a filename to each character device. By default it just copyes the filename passed in. Individual drivers can fill in something else though. qemu_chr_open_pty() sets the filename to name of the pseudo tty allocated. Output looks like this: (qemu) info chardev monitor: filename=unix:/tmp/run.sh-26827/monitor,server,nowait serial0: filename=unix:/tmp/run.sh-26827/console,server serial1: filename=pty:/dev/pts/5 parallel0: filename=vc:640x480 Signed-off-by: Gerd Hoffmann Signed-off-by: Anthony Liguori git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5575 c046a42c-6fe2-441c-8c8c-71466251a162 --- hw/usb-serial.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'hw') diff --git a/hw/usb-serial.c b/hw/usb-serial.c index 40d04cb2d..a6a756d95 100644 --- a/hw/usb-serial.c +++ b/hw/usb-serial.c @@ -521,6 +521,8 @@ USBDevice *usb_serial_init(const char *filename) USBSerialState *s; CharDriverState *cdrv; unsigned short vendorid = 0x0403, productid = 0x6001; + char label[32]; + static int index; while (*filename && *filename != ':') { const char *p; @@ -555,7 +557,8 @@ USBDevice *usb_serial_init(const char *filename) if (!s) return NULL; - cdrv = qemu_chr_open(filename); + snprintf(label, sizeof(label), "usbserial%d", index++); + cdrv = qemu_chr_open(label, filename); if (!cdrv) goto fail; s->cs = cdrv; -- cgit v1.2.3