From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FiGoq-0007mg-3z for qemu-devel@nongnu.org; Mon, 22 May 2006 16:16:00 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FiGop-0007mU-Js for qemu-devel@nongnu.org; Mon, 22 May 2006 16:15:59 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FiGop-0007mR-FE for qemu-devel@nongnu.org; Mon, 22 May 2006 16:15:59 -0400 Received: from [24.93.47.41] (helo=ms-smtp-02.texas.rr.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FiGst-0003Uf-5r for qemu-devel@nongnu.org; Mon, 22 May 2006 16:20:11 -0400 Received: from [192.168.0.11] (cpe-67-9-160-120.austin.res.rr.com [67.9.160.120]) by ms-smtp-02.texas.rr.com (8.13.6/8.13.6) with ESMTP id k4MKFvxJ015283 for ; Mon, 22 May 2006 15:15:57 -0500 (CDT) Message-ID: <44721BFC.3080504@austin.rr.com> Date: Mon, 22 May 2006 15:15:56 -0500 From: Lonnie Mendez MIME-Version: 1.0 Subject: Re: [Qemu-devel] [usb] display device identifier string for user with info usb References: <44721B36.1070909@austin.rr.com> In-Reply-To: <44721B36.1070909@austin.rr.com> Content-Type: multipart/mixed; boundary="------------020507040607090207020806" Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------020507040607090207020806 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Whoops. Wrong patch - missing 1 chunk - please see attached. --------------020507040607090207020806 Content-Type: text/plain; name="qemu-info-usb.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="qemu-info-usb.diff" --- qemu/hw/usb.h 2006-05-21 11:30:15.000000000 -0500 +++ qemu/hw/usb.h 2006-05-22 13:23:10.000000000 -0500 @@ -127,6 +127,7 @@ int (*handle_data)(USBDevice *dev, int pid, uint8_t devep, uint8_t *data, int len); uint8_t addr; + char devname[32]; int state; uint8_t setup_buf[8]; --- qemu/hw/usb-hub.c 2006-05-21 11:30:15.000000000 -0500 +++ qemu/hw/usb-hub.c 2006-05-22 13:23:53.000000000 -0500 @@ -542,6 +542,8 @@ s->dev.handle_control = usb_hub_handle_control; s->dev.handle_data = usb_hub_handle_data; + strcpy(s->dev.devname, "QEMU USB Hub"); + s->nb_ports = nb_ports; for(i = 0; i < s->nb_ports; i++) { port = &s->ports[i]; --- qemu/hw/usb-hid.c 2006-04-12 16:09:07.000000000 -0500 +++ qemu/hw/usb-hid.c 2006-05-22 13:24:57.000000000 -0500 @@ -515,6 +515,8 @@ s->dev.handle_data = usb_mouse_handle_data; s->kind = USB_TABLET; + strcpy(s->dev.devname, "QEMU USB Tablet"); + return (USBDevice *)s; } @@ -533,5 +535,7 @@ s->dev.handle_data = usb_mouse_handle_data; s->kind = USB_MOUSE; + strcpy(s->dev.devname, "QEMU USB Mouse"); + return (USBDevice *)s; } --- qemu/usb-linux.c 2006-03-11 12:03:38.000000000 -0600 +++ qemu/usb-linux.c 2006-05-22 15:06:28.000000000 -0500 @@ -44,6 +44,7 @@ int vendor_id, int product_id, const char *product_name, int speed); static int usb_host_find_device(int *pbus_num, int *paddr, + char *product_name, const char *devname); //#define DEBUG @@ -145,8 +146,9 @@ char buf[1024]; int descr_len, dev_descr_len, config_descr_len, nb_interfaces; int bus_num, addr; + char product_name[32]; - if (usb_host_find_device(&bus_num, &addr, devname) < 0) + if (usb_host_find_device(&bus_num, &addr, product_name, devname) < 0) return NULL; snprintf(buf, sizeof(buf), USBDEVFS_PATH "/%03d/%03d", @@ -230,6 +232,12 @@ dev->dev.handle_reset = usb_host_handle_reset; dev->dev.handle_control = usb_host_handle_control; dev->dev.handle_data = usb_host_handle_data; + + if (product_name[0] == '\0') + snprintf(dev->dev.devname, 31, "host:%s", devname); + else + strncpy(dev->dev.devname, product_name, 31); + return (USBDevice *)dev; } @@ -337,6 +345,7 @@ int product_id; int bus_num; int addr; + char product_name[32]; } FindDeviceState; static int usb_host_find_device_scan(void *opaque, int bus_num, int addr, @@ -345,8 +354,11 @@ const char *product_name, int speed) { FindDeviceState *s = opaque; - if (vendor_id == s->vendor_id && - product_id == s->product_id) { + if ((vendor_id == s->vendor_id && + product_id == s->product_id) || + (bus_num == s->bus_num && + addr == s->addr)) { + strncpy(s->product_name, product_name, 31); s->bus_num = bus_num; s->addr = addr; return 1; @@ -358,7 +370,8 @@ /* the syntax is : 'bus.addr' (decimal numbers) or 'vendor_id:product_id' (hexa numbers) */ -static int usb_host_find_device(int *pbus_num, int *paddr, +static int usb_host_find_device(int *pbus_num, int *paddr, + char *product_name, const char *devname) { const char *p; @@ -369,6 +382,11 @@ if (p) { *pbus_num = strtoul(devname, NULL, 0); *paddr = strtoul(p + 1, NULL, 0); + fs.bus_num = *pbus_num; + fs.addr = *paddr; + ret = usb_host_scan(&fs, usb_host_find_device_scan); + if (ret) + strcpy(product_name, fs.product_name); return 0; } p = strchr(devname, ':'); @@ -379,6 +397,7 @@ if (ret) { *pbus_num = fs.bus_num; *paddr = fs.addr; + strcpy(product_name, fs.product_name); return 0; } } --- qemu/vl.c 2006-05-21 11:30:15.000000000 -0500 +++ qemu/vl.c 2006-05-22 14:49:58.000000000 -0500 @@ -3387,8 +3422,8 @@ speed_str = "?"; break; } - term_printf(" Device %d.%d, speed %s Mb/s\n", - 0, dev->addr, speed_str); + term_printf(" Device %d.%d, Speed %s Mb/s, Product %s\n", + 0, dev->addr, speed_str, dev->devname); } } --------------020507040607090207020806--