From patchwork Wed Mar 10 09:45:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Arnaud Patard (Rtp)" X-Patchwork-Id: 47214 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 CF0F3B7BFA for ; Wed, 10 Mar 2010 20:43:36 +1100 (EST) Received: from localhost ([127.0.0.1]:55194 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NpIRu-0008KH-Ro for incoming@patchwork.ozlabs.org; Wed, 10 Mar 2010 04:43:30 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NpIRK-0008KC-PE for qemu-devel@nongnu.org; Wed, 10 Mar 2010 04:42:54 -0500 Received: from [199.232.76.173] (port=39315 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NpIRJ-0008Jl-MM for qemu-devel@nongnu.org; Wed, 10 Mar 2010 04:42:53 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NpIRI-0008KF-Cw for qemu-devel@nongnu.org; Wed, 10 Mar 2010 04:42:53 -0500 Received: from lechat.rtp-net.org ([88.191.19.38]:58071) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NpIRI-0008K3-2T for qemu-devel@nongnu.org; Wed, 10 Mar 2010 04:42:52 -0500 Received: by lechat.rtp-net.org (Postfix, from userid 5001) id 832AF1008B; Wed, 10 Mar 2010 10:45:13 +0100 (CET) Received: from lechat.rtp-net.org (ip6-localhost [IPv6:::1]) by lechat.rtp-net.org (Postfix) with ESMTP id 2E4F91007D for ; Wed, 10 Mar 2010 10:45:13 +0100 (CET) From: Arnaud Patard (Rtp) To: qemu-devel@nongnu.org Organization: RtpNet Date: Wed, 10 Mar 2010 10:45:12 +0100 Message-ID: <87pr3cmrx3.fsf@lechat.rtp-net.org> MIME-Version: 1.0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCH] hw/usb-msd: fix some usb requests 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 The usb-msd device emulation needs some small tweaks in the requests emulations. For instance, the reset/maxlun requests are class/interface specific so requests for them with the type class and recipient interface bits sets have to be handled. Signed-off-by: Arnaud Patard diff --git a/hw/usb-msd.c b/hw/usb-msd.c index bb39b62..bec82f9 100644 --- a/hw/usb-msd.c +++ b/hw/usb-msd.c @@ -321,17 +321,19 @@ static int usb_msd_handle_control(USBDevice *dev, int request, int value, ret = 0; break; case EndpointOutRequest | USB_REQ_CLEAR_FEATURE: - if (value == 0 && index != 0x81) { /* clear ep halt */ - goto fail; - } + ret = 0; + break; + case InterfaceOutRequest | USB_REQ_SET_INTERFACE: ret = 0; break; /* Class specific requests. */ + case (((USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8) | MassStorageReset): case MassStorageReset: /* Reset state ready for the next CBW. */ s->mode = USB_MSDM_CBW; ret = 0; break; + case (((USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8) | GetMaxLun): case GetMaxLun: data[0] = 0; ret = 1;