]> git.proxmox.com Git - qemu.git/commitdiff
usb: class specific interface requests
authorMax Reitz <max@tyndur.org>
Sun, 14 Mar 2010 11:19:03 +0000 (12:19 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Wed, 31 Mar 2010 16:16:52 +0000 (11:16 -0500)
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 <max@tyndur.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/usb-msd.c
hw/usb-net.c
hw/usb-ohci.c
hw/usb.h

index e9235eaf67da6d608fdfda06fe94db40bb7a9c8c..c1c2537475865879079524ce25dd97dd474047cd 100644 (file)
@@ -327,14 +327,12 @@ static int usb_msd_handle_control(USBDevice *dev, int request, int value,
         ret = 0;
         break;
         /* Class specific requests.  */
-    case (((USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE) << 8) | MassStorageReset):
-    case MassStorageReset:
+    case ClassInterfaceOutRequest | 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:
+    case ClassInterfaceRequest | GetMaxLun:
         data[0] = 0;
         ret = 1;
         break;
index 4c17435c8436939d2b316d00b93385aab2760bcd..ff0ca442372485ae44f0fbedb9b55190e3f23dcb 100644 (file)
@@ -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
index 93f7d7948350910609fec66619e0177948787bcb..61ad6142c559801e8136e3c65556dbfc1a4e4863 100644 (file)
@@ -907,7 +907,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:");
index 106d1744f15f044cb3dded5958c620e02d2cebfc..00d2802206ad456713e6743fcdbba1d116378794 100644 (file)
--- a/hw/usb.h
+++ b/hw/usb.h
 #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