Skip to contentSkip to conversation

remove warning when using auto filters with -usbdevice

PATCH In review Andreas Winkelbauer 2 participants 2 messages Sep 17, 2008 – Sep 22, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remove warning when using auto filters with -usbdevice

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.

---

bye,
Andi

vl.c +7 -1
diff -uNrp trunk.orig/vl.c trunk/vl.c
@@ -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;
+        } else {
+            dev = usb_host_device_open(p);
+        }
     } else if (!strcmp(devname, "mouse")) {
         dev = usb_mouse_init();
     } else if (!strcmp(devname, "tablet")) {
#1 lore raw
Quoted 16 lines · Andreas Winkelbauer

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.

---

bye,
Andi

diff -uNrp trunk.orig/vl.c trunk/vl.c

vl.c 2008-09-17 03:20:28.000000000 +0200 static int usb_device_add(const char *de · line 5792

Quoted 8 lines
vl.c 2008-09-17 03:20:28.000000000 +0200 renamed from vl.c 2008-09-17 02:11:53.000000000 +0200 +4 -1
@@ -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

Quoted 6 lines
vl.c 2008-09-17 03:20:28.000000000 +0200 renamed from vl.c 2008-09-17 02:11:53.000000000 +0200 +3 -0
+        } else {
+            dev = usb_host_device_open(p);
+        }
     } else if (!strcmp(devname, "mouse")) {
         dev = usb_mouse_init();
     } else if (!strcmp(devname, "tablet")) {