From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nx0zl-0001g7-06 for qemu-devel@nongnu.org; Wed, 31 Mar 2010 12:42:21 -0400 Received: from [140.186.70.92] (port=39685 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nx0zj-0001d0-Eq for qemu-devel@nongnu.org; Wed, 31 Mar 2010 12:42:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nx0zg-0004Uy-Pl for qemu-devel@nongnu.org; Wed, 31 Mar 2010 12:42:19 -0400 Received: from mail-pw0-f45.google.com ([209.85.160.45]:56459) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nx0zg-0004UK-Kq for qemu-devel@nongnu.org; Wed, 31 Mar 2010 12:42:16 -0400 Received: by pwi6 with SMTP id 6so284502pwi.4 for ; Wed, 31 Mar 2010 09:42:13 -0700 (PDT) Message-ID: <4BB37B5F.7030702@codemonkey.ws> Date: Wed, 31 Mar 2010 11:42:07 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] [PATCH] usb: class specific interface requests References: <1268565543-28001-1-git-send-email-max@tyndur.org> In-Reply-To: <1268565543-28001-1-git-send-email-max@tyndur.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: qemu-devel@nongnu.org On 03/14/2010 06:19 AM, Max Reitz wrote: > Mass Storage Reset and Get Max LUN are class specific requests, but > they were not marked as such in hw/usb-msd.c, moved therefore > ClassInterfaceRequest and ClassInterfaceOutRequest from hw/usb-net.c > to hw/usb.h. > Furthermore there was a problem in hw/usb-ohci.c when using DEBUG > concerning systems where size_t is a 32 bit integer (printf resulted > in a segmentation fault). > > Signed-off-by: Max Reitz > Applied. Thanks. Regards, Anthony Liguori > --- > hw/usb-msd.c | 4 ++-- > hw/usb-net.c | 5 ----- > hw/usb-ohci.c | 2 +- > hw/usb.h | 4 ++++ > 4 files changed, 7 insertions(+), 8 deletions(-) > > diff --git a/hw/usb-msd.c b/hw/usb-msd.c > index 1a11bc5..87b744f 100644 > --- a/hw/usb-msd.c > +++ b/hw/usb-msd.c > @@ -327,12 +327,12 @@ static int usb_msd_handle_control(USBDevice *dev, int request, int value, > ret = 0; > break; > /* Class specific requests. */ > - case MassStorageReset: > + case ClassInterfaceOutRequest | MassStorageReset: > /* Reset state ready for the next CBW. */ > s->mode = USB_MSDM_CBW; > ret = 0; > break; > - case GetMaxLun: > + case ClassInterfaceRequest | GetMaxLun: > data[0] = 0; > ret = 1; > break; > diff --git a/hw/usb-net.c b/hw/usb-net.c > index 6875f11..45aa427 100644 > --- a/hw/usb-net.c > +++ b/hw/usb-net.c > @@ -71,11 +71,6 @@ enum usbstring_idx { > #define USB_DT_CS_INTERFACE 0x24 > #define USB_DT_CS_ENDPOINT 0x25 > > -#define ClassInterfaceRequest \ > - ((USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE)<< 8) > -#define ClassInterfaceOutRequest \ > - ((USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE)<< 8) > - > #define USB_CDC_SEND_ENCAPSULATED_COMMAND 0x00 > #define USB_CDC_GET_ENCAPSULATED_RESPONSE 0x01 > #define USB_CDC_REQ_SET_LINE_CODING 0x20 > diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c > index 5c5dc4a..ac23c44 100644 > --- a/hw/usb-ohci.c > +++ b/hw/usb-ohci.c > @@ -908,7 +908,7 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed) > flag_r = (td.flags& OHCI_TD_R) != 0; > #ifdef DEBUG_PACKET > DPRINTF(" TD @ 0x%.8x %" PRId64 " bytes %s r=%d cbp=0x%.8x be=0x%.8x\n", > - addr, len, str, flag_r, td.cbp, td.be); > + addr, (int64_t)len, str, flag_r, td.cbp, td.be); > > if (len> 0&& dir != OHCI_TD_DIR_IN) { > DPRINTF(" data:"); > diff --git a/hw/usb.h b/hw/usb.h > index 106d174..00d2802 100644 > --- a/hw/usb.h > +++ b/hw/usb.h > @@ -91,6 +91,10 @@ > #define EndpointRequest ((USB_DIR_IN|USB_TYPE_STANDARD|USB_RECIP_ENDPOINT)<<8) > #define EndpointOutRequest \ > ((USB_DIR_OUT|USB_TYPE_STANDARD|USB_RECIP_ENDPOINT)<<8) > +#define ClassInterfaceRequest \ > + ((USB_DIR_IN|USB_TYPE_CLASS|USB_RECIP_INTERFACE)<<8) > +#define ClassInterfaceOutRequest \ > + ((USB_DIR_OUT|USB_TYPE_CLASS|USB_RECIP_INTERFACE)<<8) > > #define USB_REQ_GET_STATUS 0x00 > #define USB_REQ_CLEAR_FEATURE 0x01 >