From patchwork Tue Aug 16 07:37:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Petter Selasky X-Patchwork-Id: 110158 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E075DB6F81 for ; Tue, 16 Aug 2011 17:50:15 +1000 (EST) Received: from localhost ([::1]:52034 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QtEPV-0001RJ-Ag for incoming@patchwork.ozlabs.org; Tue, 16 Aug 2011 03:50:05 -0400 Received: from eggs.gnu.org ([140.186.70.92]:48367) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QtEPO-0001RC-N8 for qemu-devel@nongnu.org; Tue, 16 Aug 2011 03:49:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QtEPN-0003ri-HU for qemu-devel@nongnu.org; Tue, 16 Aug 2011 03:49:58 -0400 Received: from mailfe08.c2i.net ([212.247.154.226]:46305 helo=swip.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QtEPN-0003rc-3o for qemu-devel@nongnu.org; Tue, 16 Aug 2011 03:49:57 -0400 X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=0STrgBBJ/IeSzGUncdVPgrlXwYQACyAaeTEJnWJdz8Q= c=1 sm=1 a=SvYTsOw2Z4kA:10 a=fJEGAQ7EGC8A:10 a=dBRESv0yCI8A:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=4dUV7anAB9YGbLdZuTQA:9 a=4NtnIaRTLMHL91dE4QwA:7 a=pILNOxqGKmIA:10 a=8PRmaPxWSHiRE86-vQ4A:9 a=GIi2Wv7FhjRqQxNC:21 a=NSU_4XTvM9YSOr7i:21 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe08.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 166471043; Tue, 16 Aug 2011 09:39:51 +0200 Received-SPF: softfail receiver=mailfe08.swip.net; client-ip=188.126.198.129; envelope-from=hselasky@freebsd.org From: Hans Petter Selasky To: Juergen Lock Date: Tue, 16 Aug 2011 09:37:27 +0200 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <20110815202656.GA94934@triton8.kn-bremen.de> In-Reply-To: <20110815202656.GA94934@triton8.kn-bremen.de> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Message-Id: <201108160937.27850.hselasky@freebsd.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 212.247.154.226 Cc: "freebsd-emulation@FreeBSD.org" , "qemu-devel@nongnu.org" , "freebsd-usb@FreeBSD.org" Subject: Re: [Qemu-devel] qemu 0.15.0 testing, usb redirection, and libusb_get_device_speed() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Monday 15 August 2011 22:26:56 Juergen Lock wrote: > Hi! > > I just prepared a preliminary update of the emulators/qemu-devel > port to 0.15.0 [1], and among other things it now also has a > usb network redirection feature using usbredir [2], which uses > libusb 1.0 and a function that is missing in our version, > libusb_get_device_speed(). I added a stub to the code that > always returns LIBUSB_SPEED_UNKNOWN > (files/patch-usbredirhost-usbredirhost.c in the usbredir port [2]), > question for Hans (I guess), would there be an easy way to make a > `proper' implementation? > > If anyone wants to help me test qemu 0.15.0, thanx! Please try the attached patch to libusb in /usr/src/lib/libusb . You only need to rebuild libusb: make all install clean > FETCHENTRY: entry at 22C5484 is of type 2 which is not supported > yet processing error - resetting ehci HC Try my patch first. EHCI needs to know device speed. --HPS === libusb.h ================================================================== --- libusb.h (revision 224768) +++ libusb.h (local) @@ -151,6 +151,14 @@ LIBUSB_ERROR_OTHER = -99, }; +enum libusb_speed { + LIBUSB_SPEED_UNKNOWN = 0, + LIBUSB_SPEED_LOW = 1, + LIBUSB_SPEED_FULL = 2, + LIBUSB_SPEED_HIGH = 3, + LIBUSB_SPEED_SUPER = 4, +}; + enum libusb_transfer_status { LIBUSB_TRANSFER_COMPLETED, LIBUSB_TRANSFER_ERROR, @@ -304,6 +312,7 @@ void libusb_free_device_list(libusb_device ** list, int unref_devices); uint8_t libusb_get_bus_number(libusb_device * dev); uint8_t libusb_get_device_address(libusb_device * dev); +enum libusb_speed libusb_get_device_speed(libusb_device * dev); int libusb_clear_halt(libusb_device_handle *devh, uint8_t endpoint); int libusb_get_max_packet_size(libusb_device * dev, uint8_t endpoint); libusb_device *libusb_ref_device(libusb_device * dev); === libusb10.c ================================================================== --- libusb10.c (revision 224768) +++ libusb10.c (local) @@ -272,6 +272,27 @@ return (libusb20_dev_get_address(dev->os_priv)); } +enum libusb_speed +libusb_get_device_speed(libusb_device *dev) +{ + if (dev == NULL) + return (0); /* should not happen */ + + switch (libusb20_dev_get_speed(dev->os_priv)) { + case LIBUSB20_SPEED_LOW: + return (LIBUSB_SPEED_LOW); + case LIBUSB20_SPEED_FULL: + return (LIBUSB_SPEED_FULL); + case LIBUSB20_SPEED_HIGH: + return (LIBUSB_SPEED_HIGH); + case LIBUSB20_SPEED_SUPER: + return (LIBUSB_SPEED_SUPER); + default: + break; + } + return (LIBUSB_SPEED_UNKNOWN); +} + int libusb_get_max_packet_size(libusb_device *dev, uint8_t endpoint) {