From: Grazvydas Ignotas <notasas@gmail.com>
To: qemu-devel@nongnu.org
Cc: Grazvydas Ignotas <notasas@gmail.com>
Subject: [Qemu-devel] [PATCH] usb-linux: allow multiple devices with matching IDs
Date: Fri, 22 Oct 2010 19:10:01 +0300 [thread overview]
Message-ID: <1287763801-25458-1-git-send-email-notasas@gmail.com> (raw)
Right now if we pass through multiple USB devices with matching vendor
and product IDs, only first one is passed to guest, as the code thinks
second device is already attached. The only way to get those devices
working is to specify bus.addr which is inconvenient if devices are
frequently replugged on host, because the address changes after replug.
Fix this by checking bus.addr before assuming the device is already
attached. This way -usbdevice host:1234:1234 -usbdevice host:1234:1234
will pass through 2 devices correctly.
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
---
usb-linux.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/usb-linux.c b/usb-linux.c
index c3c38ec..b5f1396 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -1464,9 +1464,13 @@ static int usb_host_auto_scan(void *opaque, int bus_num, int addr,
}
/* We got a match */
- /* Already attached ? */
if (s->fd != -1) {
- return 0;
+ /* Already attached? */
+ if (s->bus_num == bus_num && s->addr == addr)
+ return 0;
+
+ /* Not attached but needs another hostdev */
+ continue;
}
DPRINTF("husb: auto open: bus_num %d addr %d\n", bus_num, addr);
--
1.6.3.3
next reply other threads:[~2010-10-22 16:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-22 16:10 Grazvydas Ignotas [this message]
2010-11-10 16:01 ` [Qemu-devel] [PATCH] usb-linux: allow multiple devices with matching IDs Markus Armbruster
2010-11-13 14:32 ` Grazvydas Ignotas
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=1287763801-25458-1-git-send-email-notasas@gmail.com \
--to=notasas@gmail.com \
--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).