remove warning when using auto filters with -usbdevice
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
@@ -5786,7 +5786,13 @@ static int usb_device_add(const char *dereturn -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" )) {
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.
Signed-off-by Andreas Winkelbauer <[email protected]>---
bye,
Andidiff -uNrp
trunk.orig/vl.ctrunk/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")) {