VirtualBox

Changeset 53121 in vbox


Ignore:
Timestamp:
Oct 22, 2014 7:35:21 PM (10 years ago)
Author:
vboxsync
Message:

USB: Added required SS descriptors to emulated MSD.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vusb.h

    r53098 r53121  
    7070#define VUSB_DT_INTERFACE_MIN_LEN       9
    7171#define VUSB_DT_ENDPOINT_MIN_LEN        7
     72/** @} */
     73
     74/** @name USB Device Capability Type Codes (from spec)
     75 * @{ */
     76#define VUSB_DCT_WIRELESS_USB           0x01
     77#define VUSB_DCT_USB_20_EXTENSION       0x02
     78#define VUSB_DCT_SUPERSPEED_USB         0x03
     79#define VUSB_DCT_CONTAINER_ID           0x04
    7280/** @} */
    7381
     
    203211    uint8_t  iInterface;
    204212} VUSBDESCINTERFACE;
    205 /** Pointer to an USB interface descriptor. */
     213/** Pointer to a USB interface descriptor. */
    206214typedef VUSBDESCINTERFACE *PVUSBDESCINTERFACE;
    207215/** Pointer to a const USB interface descriptor. */
     
    221229    uint8_t  bInterval;
    222230} VUSBDESCENDPOINT;
    223 /** Pointer to an USB endpoint descriptor. */
     231/** Pointer to a USB endpoint descriptor. */
    224232typedef VUSBDESCENDPOINT *PVUSBDESCENDPOINT;
    225233/** Pointer to a const USB endpoint descriptor. */
     
    238246    uint16_t wBytesPerInterval;
    239247} VUSBDESCSSEPCOMPANION;
    240 /** Pointer to an USB endpoint companion descriptor. */
     248/** Pointer to a USB endpoint companion descriptor. */
    241249typedef VUSBDESCSSEPCOMPANION *PVUSBDESCSSEPCOMPANION;
    242250/** Pointer to a const USB endpoint companion descriptor. */
     
    254262    uint8_t  bNumDeviceCaps;
    255263} VUSBDESCBOS;
    256 /** Pointer to an USB BOS descriptor. */
     264/** Pointer to a USB BOS descriptor. */
    257265typedef VUSBDESCBOS *PVUSBDESCBOS;
    258266/** Pointer to a const USB BOS descriptor. */
     
    261269
    262270/**
    263  * USB Device Capabilty Descriptor within BOS (from USB3 spec)
     271 * Generic USB Device Capability Descriptor within BOS (from USB3 spec)
    264272 */
    265273typedef struct VUSBDESCDEVICECAP
     
    270278    uint8_t  aCapSpecific[1];
    271279} VUSBDESCDEVICECAP;
    272 /** Pointer to an USB device capability descriptor. */
     280/** Pointer to a USB device capability descriptor. */
    273281typedef VUSBDESCDEVICECAP *PVUSBDESCDEVICECAP;
    274282/** Pointer to a const USB device capability descriptor. */
    275283typedef const VUSBDESCDEVICECAP *PCVUSBDESCDEVICECAP;
     284
     285
     286/**
     287 * SuperSpeed USB Device Capability Descriptor within BOS
     288 */
     289typedef struct VUSBDESCSSDEVCAP
     290{
     291    uint8_t  bLength;
     292    uint8_t  bDescriptorType;       /* DEVICE CAPABILITY */
     293    uint8_t  bDevCapabilityType;    /* SUPERSPEED_USB */
     294    uint8_t  bmAttributes;
     295    uint16_t wSpeedsSupported;
     296    uint8_t  bFunctionalitySupport;
     297    uint8_t  bU1DevExitLat;
     298    uint16_t wU2DevExitLat;
     299} VUSBDESCSSDEVCAP;
     300/** Pointer to an SS USB device capability descriptor. */
     301typedef VUSBDESCSSDEVCAP *PVUSBDESCSSDEVCAP;
     302/** Pointer to a const SS USB device capability descriptor. */
     303typedef const VUSBDESCSSDEVCAP *PCVUSBDESCSSDEVCAP;
     304
     305
     306/**
     307 * USB 2.0 Extension Descriptor within BOS
     308 */
     309typedef struct VUSBDESCUSB2EXT
     310{
     311    uint8_t  bLength;
     312    uint8_t  bDescriptorType;       /* DEVICE CAPABILITY */
     313    uint8_t  bDevCapabilityType;    /* USB 2.0 EXTENSION */
     314    uint8_t  bmAttributes;
     315} VUSBDESCUSB2EXT;
     316/** Pointer to a USB 2.0 extension capability descriptor. */
     317typedef VUSBDESCUSB2EXT *PVUSBDESCUSB2EXT;
     318/** Pointer to a const USB 2.0 extension capability descriptor. */
     319typedef const VUSBDESCUSB2EXT *PCVUSBDESCUSB2EXT;
    276320
    277321
  • trunk/src/VBox/Devices/Storage/UsbMsd.cpp

    r53097 r53121  
    342342};
    343343
     344static const VUSBDESCSSEPCOMPANION g_aUsbMsdEpCompanionSS =
     345{
     346    /* .bLength = */            sizeof(VUSBDESCSSEPCOMPANION),
     347    /* .bDescriptorType = */    VUSB_DT_SS_ENDPOINT_COMPANION,
     348    /* .bMaxBurst = */          15  /* we can burst all the way */,
     349    /* .bmAttributes = */       0   /* no streams */,
     350    /* .wBytesPerInterval = */  0   /* not a periodic endpoint */
     351};
     352
    344353static const VUSBDESCENDPOINTEX g_aUsbMsdEndpointDescsSS[2] =
    345354{
     
    354363        },
    355364        /* .pvMore = */     NULL,
    356         /* .pvClass = */    NULL,
    357         /* .cbClass = */    0
     365        /* .pvClass = */    &g_aUsbMsdEpCompanionSS,
     366        /* .cbClass = */    sizeof(g_aUsbMsdEpCompanionSS)
    358367    },
    359368    {
     
    367376        },
    368377        /* .pvMore = */     NULL,
    369         /* .pvClass = */    NULL,
    370         /* .cbClass = */    0
     378        /* .pvClass = */    &g_aUsbMsdEpCompanionSS,
     379        /* .cbClass = */    sizeof(g_aUsbMsdEpCompanionSS)
    371380    }
    372381};
     
    548557    /* .bNumConfigurations = */     1,
    549558    /* .bReserved = */              0
     559};
     560
     561static const struct {
     562    VUSBDESCBOS         bos;
     563    VUSBDESCSSDEVCAP    sscap;
     564} g_UsbMsdBOS =
     565{
     566    {
     567        /* .bLength = */                sizeof(g_UsbMsdBOS.bos),
     568        /* .bDescriptorType = */        VUSB_DT_BOS,
     569        /* .wTotalLength = */           sizeof(g_UsbMsdBOS),
     570        /* .bNumDeviceCaps = */         1
     571    },
     572    {
     573        /* .bLength = */                sizeof(VUSBDESCSSDEVCAP),
     574        /* .bDescriptorType = */        VUSB_DT_DEVICE_CAPABILITY,
     575        /* .bDevCapabilityType = */     VUSB_DCT_SUPERSPEED_USB,
     576        /* .bmAttributes = */           0   /* No LTM. */,
     577        /* .wSpeedsSupported = */       0xe /* Any speed is good. */,
     578        /* .bFunctionalitySupport = */  2   /* Want HS at least. */,
     579        /* .bU1DevExitLat = */          0,  /* We are blazingly fast. */
     580        /* .wU2DevExitLat = */          0
     581    }
    550582};
    551583
     
    18241856                        cbCopy = RT_MIN(cbCopy, sizeof(g_UsbMsdDeviceQualifier));
    18251857                        memcpy(&pUrb->abData[sizeof(*pSetup)], &g_UsbMsdDeviceQualifier, cbCopy);
     1858                        return usbMsdCompleteOk(pThis, pUrb, cbCopy + sizeof(*pSetup));
     1859                    case VUSB_DT_BOS:
     1860                        Log(("usbMsd: GET_DESCRIPTOR DT_BOS wValue=%#x wIndex=%#x\n", pSetup->wValue, pSetup->wIndex));
     1861                        /* Returned data is written after the setup message. */
     1862                        cbCopy = pUrb->cbData - sizeof(*pSetup);
     1863                        cbCopy = RT_MIN(cbCopy, sizeof(g_UsbMsdBOS));
     1864                        memcpy(&pUrb->abData[sizeof(*pSetup)], &g_UsbMsdBOS, cbCopy);
    18261865                        return usbMsdCompleteOk(pThis, pUrb, cbCopy + sizeof(*pSetup));
    18271866                    default:
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette