qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] remove warning when using auto filters with -usbdevice
@ 2008-09-17 16:50 Andreas Winkelbauer
  2008-09-22 14:44 ` Anthony Liguori
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Winkelbauer @ 2008-09-17 16:50 UTC (permalink / raw)
  To: aliguori; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 277 bytes --]

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 <andreas.winkelbauer@gmx.at>
---

bye,
Andi

[-- Attachment #2: qemu-autofilter-add.patch --]
[-- Type: text/x-patch, Size: 678 bytes --]

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;
+        } else {
+            dev = usb_host_device_open(p);
+        }
     } else if (!strcmp(devname, "mouse")) {
         dev = usb_mouse_init();
     } else if (!strcmp(devname, "tablet")) {

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] remove warning when using auto filters with -usbdevice
  2008-09-17 16:50 [Qemu-devel] [PATCH] remove warning when using auto filters with -usbdevice Andreas Winkelbauer
@ 2008-09-22 14:44 ` Anthony Liguori
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2008-09-22 14:44 UTC (permalink / raw)
  To: qemu-devel

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 <andreas.winkelbauer@gmx.at>
> ---
>
> 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")) {

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-09-22 14:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-17 16:50 [Qemu-devel] [PATCH] remove warning when using auto filters with -usbdevice Andreas Winkelbauer
2008-09-22 14:44 ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).