[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 10/18] usb-host: parse port in /proc/bus/usb/devices
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 10/18] usb-host: parse port in /proc/bus/usb/devices scan |
Date: |
Fri, 2 Sep 2011 11:56:39 +0200 |
Unfortunaly this is limited to root ports.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
usb-linux.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/usb-linux.c b/usb-linux.c
index ef29a76..7995178 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -1483,7 +1483,8 @@ static int usb_host_scan_dev(void *opaque, USBScanFunc
*func)
FILE *f = NULL;
char line[1024];
char buf[1024];
- int bus_num, addr, speed, device_count, class_id, product_id, vendor_id;
+ int bus_num, addr, speed, device_count;
+ int class_id, product_id, vendor_id, port;
char product_name[512];
int ret = 0;
@@ -1521,6 +1522,10 @@ static int usb_host_scan_dev(void *opaque, USBScanFunc
*func)
goto fail;
}
bus_num = atoi(buf);
+ if (get_tag_value(buf, sizeof(buf), line, "Port=", " ") < 0) {
+ goto fail;
+ }
+ port = atoi(buf);
if (get_tag_value(buf, sizeof(buf), line, "Dev#=", " ") < 0) {
goto fail;
}
@@ -1566,7 +1571,12 @@ static int usb_host_scan_dev(void *opaque, USBScanFunc
*func)
}
if (device_count && (vendor_id || product_id)) {
/* Add the last device. */
- ret = func(opaque, bus_num, addr, 0, class_id, vendor_id,
+ if (port > 0) {
+ snprintf(buf, sizeof(buf), "%d", port);
+ } else {
+ snprintf(buf, sizeof(buf), "?");
+ }
+ ret = func(opaque, bus_num, addr, buf, class_id, vendor_id,
product_id, product_name, speed);
}
the_end:
--
1.7.1
- [Qemu-devel] [PULL] usb patch queue, Gerd Hoffmann, 2011/09/02
- [Qemu-devel] [PATCH 03/18] usb-host: fix halted endpoints, Gerd Hoffmann, 2011/09/02
- [Qemu-devel] [PATCH 02/18] usb-host: reapurb error report fix, Gerd Hoffmann, 2011/09/02
- [Qemu-devel] [PATCH 04/18] usb-host: limit open retries, Gerd Hoffmann, 2011/09/02
- [Qemu-devel] [PATCH 01/18] usb-host: start tracing support, Gerd Hoffmann, 2011/09/02
- [Qemu-devel] [PATCH 11/18] usb: fix use after free, Gerd Hoffmann, 2011/09/02
- [Qemu-devel] [PATCH 13/18] usb-ccid: remote wakeup support, Gerd Hoffmann, 2011/09/02
- [Qemu-devel] [PATCH 10/18] usb-host: parse port in /proc/bus/usb/devices scan,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 09/18] usb-host: constify port, Gerd Hoffmann, 2011/09/02
- [Qemu-devel] [PATCH 05/18] usb-host: fix configuration tracking., Gerd Hoffmann, 2011/09/02
- [Qemu-devel] [PATCH 06/18] usb-host: claim port, Gerd Hoffmann, 2011/09/02
- [Qemu-devel] [PATCH 08/18] usb-ehci: handle siTDs, Gerd Hoffmann, 2011/09/02
- [Qemu-devel] [PATCH 07/18] usb-host: endpoint table fixup, Gerd Hoffmann, 2011/09/02
- [Qemu-devel] [PATCH 15/18] usb-host: tag as unmigratable, Gerd Hoffmann, 2011/09/02
- [Qemu-devel] [PATCH 17/18] usb-musb: Take a DeviceState* in init function, Gerd Hoffmann, 2011/09/02
- [Qemu-devel] [PATCH 16/18] usb: Remove leading underscores from __musb_irq_max, Gerd Hoffmann, 2011/09/02
- [Qemu-devel] [PATCH 12/18] usb-ccid: switch to USBDesc*, Gerd Hoffmann, 2011/09/02
- [Qemu-devel] [PATCH 14/18] usb: claim port at device initialization time., Gerd Hoffmann, 2011/09/02