From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KbbOR-0004Am-7O for qemu-devel@nongnu.org; Fri, 05 Sep 2008 09:30:31 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KbbOP-00049V-Ro for qemu-devel@nongnu.org; Fri, 05 Sep 2008 09:30:30 -0400 Received: from [199.232.76.173] (port=53456 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KbbOP-000496-I0 for qemu-devel@nongnu.org; Fri, 05 Sep 2008 09:30:29 -0400 Received: from mail.windriver.com ([147.11.1.11]:51931 helo=mail.wrs.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KbbOP-0006Fi-Uh for qemu-devel@nongnu.org; Fri, 05 Sep 2008 09:30:30 -0400 Message-ID: <48C1346F.3000405@windriver.com> Date: Fri, 05 Sep 2008 08:30:23 -0500 From: Jason Wessel MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] Add USB sys file-system support (v2) References: <1220571341.2638.6.camel@hephaestion> <1220580385.2638.15.camel@hephaestion> In-Reply-To: <1220580385.2638.15.camel@hephaestion> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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, linux@tjworld.net Cc: kvm TJ wrote: > Revision 2. > > I realised I'd made a major programming boo-boo despite knowing better - > requesting an allocation of memory in the host USB file-system scan > function, forgetting that the function isn't just called once but > repeatedly. That would have led to orphaned memory allocations each time > a USB scan or open operation occurred - baaad! > > I've also changed the logic so it only scans for the USB file-system > type the first time. After that it works off stored values. > > Perhaps there is more work to do with this patch, or there are other pieces still pending? I tried out the patch because it looked reasonably interesting on ubuntu 7.10 64bit, and looked like a nice way to attach a local USB device, but it did not quite work. IE: (qemu) info usbhost Device 3.2, speed 12 Mb/s Class 00: USB device 067b:2303, USB-Serial Controller The first thing I tried was using it with the vendor/product id and it failed immediately. qemu ... -usb -usbdevice host:067b:2303 Warning: could not add USB device host:067b:2303 Then I tried using it with bus.addr syntax: qemu ... -usb -usbdevice host:003.002 husb: open device 3.2 husb: opened /dev/bus/usb/003/002 husb: config #1 need -1 husb: 1 interfaces claimed for configuration -1 husb: grabbed usb device 3.2 usb_linux_update_endp_table: Broken pipe Warning: could not add USB device host:003.002 It turns out that it is failing on the ioctl in usb-linux.c 541 ct.bRequestType = USB_DIR_IN | USB_RECIP_INTERFACE; 542 ct.bRequest = USB_REQ_GET_INTERFACE; 543 ct.wValue = 0; 544 ct.wIndex = interface; 545 ct.wLength = 1; 546 ct.data = &alt_interface; 547 ct.timeout = 50; 548 549 ret = ioctl(s->fd, USBDEVFS_CONTROL, &ct); 550 if (ret < 0) { 551 perror("usb_linux_update_endp_table"); 552 return 1; 553 } I can see that some of the ioctls succeed so perhaps it is partially working. Any ideas around why this might be failing? I had not ever looked at the qemu usb code before, but the -1 for the configuration did look a bit suspicious . Cheers, Jason.