From patchwork Thu Feb 21 09:59:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 222237 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 72D5B2C008E for ; Thu, 21 Feb 2013 21:22:41 +1100 (EST) Received: from localhost ([::1]:44271 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8SxD-0005QR-Gz for incoming@patchwork.ozlabs.org; Thu, 21 Feb 2013 05:00:39 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35119) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8Sw0-0003Gs-NY for qemu-devel@nongnu.org; Thu, 21 Feb 2013 04:59:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U8Svu-0001wd-8w for qemu-devel@nongnu.org; Thu, 21 Feb 2013 04:59:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:17749) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U8Svt-0001vp-Un for qemu-devel@nongnu.org; Thu, 21 Feb 2013 04:59:18 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r1L9xHlJ018762 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 21 Feb 2013 04:59:17 -0500 Received: from rincewind.home.kraxel.org (ovpn-116-21.ams2.redhat.com [10.36.116.21]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r1L9xFM1013526; Thu, 21 Feb 2013 04:59:16 -0500 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 4FE0741B40; Thu, 21 Feb 2013 10:59:14 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 21 Feb 2013 10:59:10 +0100 Message-Id: <1361440753-13413-12-git-send-email-kraxel@redhat.com> In-Reply-To: <1361440753-13413-1-git-send-email-kraxel@redhat.com> References: <1361440753-13413-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 11/14] usb: fix endpoint descriptor ordering 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 Fix the ordering of the endpoint descriptors for superspeed endpoints: The superspeed companion must come first, possible additional descriptors for the endpoint after that. Signed-off-by: Gerd Hoffmann --- hw/usb/desc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hw/usb/desc.c b/hw/usb/desc.c index b7c3233..b389381 100644 --- a/hw/usb/desc.c +++ b/hw/usb/desc.c @@ -225,12 +225,9 @@ int usb_desc_endpoint(const USBDescEndpoint *ep, int flags, d->u.endpoint.bRefresh = ep->bRefresh; d->u.endpoint.bSynchAddress = ep->bSynchAddress; } - if (ep->extra) { - memcpy(dest + bLength, ep->extra, extralen); - } if (superlen) { - USBDescriptor *d = (void *)(dest + bLength + extralen); + USBDescriptor *d = (void *)(dest + bLength); d->bLength = 0x06; d->bDescriptorType = USB_DT_ENDPOINT_COMPANION; @@ -243,6 +240,10 @@ int usb_desc_endpoint(const USBDescEndpoint *ep, int flags, usb_hi(ep->wBytesPerInterval); } + if (ep->extra) { + memcpy(dest + bLength + superlen, ep->extra, extralen); + } + return bLength + extralen + superlen; }