qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] remove warning when using auto filters with -us


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH] remove warning when using auto filters with -usbdevice
Date: Mon, 22 Sep 2008 09:44:14 -0500
User-agent: Thunderbird 2.0.0.16 (X11/20080723)

Andreas Winkelbauer wrote:
This patch adds a check in usb_device_add() to distinguish between usb
auto filters and usb devices.

In turn confusing warnings like "Warning: could not add USB device
host:auto:..." are removed.

Signed-off-by: Andreas Winkelbauer <address@hidden>
---

bye,
Andi
diff -uNrp trunk.orig/vl.c trunk/vl.c
--- trunk.orig/vl.c    2008-09-17 02:11:53.000000000 +0200
+++ trunk/vl.c    2008-09-17 03:20:28.000000000 +0200
@@ -5786,7 +5786,13 @@ static int usb_device_add(const char *de
         return -1;
if (strstart(devname, "host:", &p)) {
-        dev = usb_host_device_open(p);
+        /* check if we actually want to add an auto filter */
+        if (strstart(p, "auto:", NULL))    {
+            usb_host_device_open(p);
+            return 0;

This does not check the results of usb_host_device_open(). I think a better approach would be to introduce an auto_add flag into this function that defaults to = 1, and if strstart(p, "auto:"), then set it to zero. Lower in the function, where you would add 'dev', first check auto_add. Then you maintain a single return point and also ensure that you do proper error checking.

Regards,

Anthony Liguori

+        } else {
+            dev = usb_host_device_open(p);
+        }
     } else if (!strcmp(devname, "mouse")) {
         dev = usb_mouse_init();
     } else if (!strcmp(devname, "tablet")) {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]