Hi,
in usb-linux.c my qemu crashes in
static int usb_host_open(USBHostDevice *dev, int bus_num, int addr, char
*port, const char *prod_name, int speed)
because port is NULL.
The attached patches should fix this.
cheers,
Gerd
>From 15fd107f500f8a0f6ffa05fa3a9775d37afda1bd Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kra...@redhat.com>
Date: Wed, 17 Aug 2011 23:35:45 +0200
Subject: [PATCH 1/2] usb-linux: constify port
Signed-off-by: Gerd Hoffmann <kra...@redhat.com>
---
usb-linux.c | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/usb-linux.c b/usb-linux.c
index 5562187..dec3bc9 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -53,7 +53,7 @@ struct usb_ctrltransfer {
void *data;
};
-typedef int USBScanFunc(void *opaque, int bus_num, int addr, char *port,
+typedef int USBScanFunc(void *opaque, int bus_num, int addr, const char *port,
int class_id, int vendor_id, int product_id,
const char *product_name, int speed);
@@ -1135,7 +1135,8 @@ static int usb_linux_full_speed_compat(USBHostDevice *dev)
}
static int usb_host_open(USBHostDevice *dev, int bus_num,
- int addr, char *port, const char *prod_name, int speed)
+ int addr, const char *port,
+ const char *prod_name, int speed)
{
int fd = -1, ret;
char buf[1024];
@@ -1713,7 +1714,8 @@ static int usb_host_scan(void *opaque, USBScanFunc *func)
static QEMUTimer *usb_auto_timer;
-static int usb_host_auto_scan(void *opaque, int bus_num, int addr, char *port,
+static int usb_host_auto_scan(void *opaque, int bus_num,
+ int addr, const char *port,
int class_id, int vendor_id, int product_id,
const char *product_name, int speed)
{
@@ -1875,7 +1877,8 @@ static const char *usb_class_str(uint8_t class)
return p->class_name;
}
-static void usb_info_device(Monitor *mon, int bus_num, int addr, char *port,
+static void usb_info_device(Monitor *mon, int bus_num,
+ int addr, const char *port,
int class_id, int vendor_id, int product_id,
const char *product_name,
int speed)
@@ -1916,7 +1919,7 @@ static void usb_info_device(Monitor *mon, int bus_num,
int addr, char *port,
}
static int usb_host_info_device(void *opaque, int bus_num, int addr,
- char *path, int class_id,
+ const char *path, int class_id,
int vendor_id, int product_id,
const char *product_name,
int speed)
--
1.7.1
>From 3da0c8ed9d83928bbb88c2ffbd3ae8d2eed2e41a Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kra...@redhat.com>
Date: Wed, 17 Aug 2011 23:36:46 +0200
Subject: [PATCH 2/2] usb-linux: set port to non-NULL for /proc/bus/usb/devices
scan
Signed-off-by: Gerd Hoffmann <kra...@redhat.com>
---
usb-linux.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/usb-linux.c b/usb-linux.c
index dec3bc9..f8a47da 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -1505,7 +1505,7 @@ 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,
+ ret = func(opaque, bus_num, addr, "?", class_id, vendor_id,
product_id, product_name, speed);
}
the_end:
--
1.7.1