From patchwork Wed Feb 3 00:36:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "David S. Ahern" X-Patchwork-Id: 44330 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 926EDB7D47 for ; Wed, 3 Feb 2010 11:46:25 +1100 (EST) Received: from localhost ([127.0.0.1]:43282 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NcTG6-0001t6-B8 for incoming@patchwork.ozlabs.org; Tue, 02 Feb 2010 19:38:18 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NcTEY-0001Yu-T9 for qemu-devel@nongnu.org; Tue, 02 Feb 2010 19:36:43 -0500 Received: from [199.232.76.173] (port=57409 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NcTEY-0001Yb-9G for qemu-devel@nongnu.org; Tue, 02 Feb 2010 19:36:42 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NcTEV-0006UX-C6 for qemu-devel@nongnu.org; Tue, 02 Feb 2010 19:36:42 -0500 Received: from sj-iport-6.cisco.com ([171.71.176.117]:59218) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1NcTEU-0006UH-VM for qemu-devel@nongnu.org; Tue, 02 Feb 2010 19:36:39 -0500 Authentication-Results: sj-iport-6.cisco.com; dkim=neutral (message not signed) header.i=none X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAPpTaEurR7H+/2dsb2JhbADBC5gxhEUE X-IronPort-AV: E=Sophos;i="4.49,394,1262563200"; d="scan'208";a="477207374" Received: from sj-core-2.cisco.com ([171.71.177.254]) by sj-iport-6.cisco.com with ESMTP; 03 Feb 2010 00:36:36 +0000 Received: from [64.101.76.217] ([64.101.76.217]) by sj-core-2.cisco.com (8.13.8/8.14.3) with ESMTP id o130aZn8025604; Wed, 3 Feb 2010 00:36:35 GMT Message-ID: <4B68C513.5080205@cisco.com> Date: Tue, 02 Feb 2010 17:36:35 -0700 From: "David S. Ahern" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.7) Gecko/20100120 Fedora/3.0.1-1.fc11 Thunderbird/3.0.1 MIME-Version: 1.0 To: Michael Buesch Subject: Re: [Qemu-devel] usb-host quirks References: <201002021442.07991.mb@bu3sch.de> In-Reply-To: <201002021442.07991.mb@bu3sch.de> X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: qemu-devel@nongnu.org X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On 02/02/2010 06:42 AM, Michael Buesch wrote: > Hi, > > I've got a buggy device that needs a special workaround to be usable under > host-usb access. The device really doesn't like being reset via USBDEVFS_RESET. It > immediatenly locks up the device firmware or whatever. It won't respond properly anymore. > With the following patch it works fine, though. > What about the USBDEVFS_RESET in usb_host_open? Does that have an impact? For some USB keys I have had to add an additional reset prior to claiming interfaces: * available config. We used to start with 1, which does not David Ahern > So I was wondering what the accepted way was to get these quirks upstream into the qemu > source tree. Is usb-linux.c the correct place, or should we put the quirk into > a different place? > > --- > usb-linux.c | 4 ++++ > 1 file changed, 4 insertions(+) > > --- qemu.orig/usb-linux.c > +++ qemu/usb-linux.c > @@ -389,6 +389,10 @@ static void usb_host_handle_reset(USBDev > > dprintf("husb: reset device %u.%u\n", s->bus_num, s->addr); > > + if (((s->descr[8] << 8) | s->descr[9]) == 0x2471 && > + ((s->descr[10] << 8) | s->descr[11]) == 0x0853) > + return; > + > ioctl(s->fd, USBDEVFS_RESET); > > usb_host_claim_interfaces(s, s->configuration); > diff --git a/usb-linux.c b/usb-linux.c index 1aaa595..092e75c 100644 --- a/usb-linux.c +++ b/usb-linux.c @@ -906,6 +906,9 @@ static int usb_host_open(USBHostDevice *dev, int bus_num, #endif + /* some keys require a reset before the getconfig */ + ioctl(fd, USBDEVFS_RESET); + /* * Initial configuration is -1 which makes us claim first