qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] remove warning when using auto filters with -usbdevice
Date: Mon, 22 Sep 2008 09:44:14 -0500	[thread overview]
Message-ID: <48D7AF3E.4080705@codemonkey.ws> (raw)
In-Reply-To: <48D13556.2090704@gmx.at>

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")) {

      reply	other threads:[~2008-09-22 14:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48D7AF3E.4080705@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).