VirtualBox

Changeset 56393 in vbox for trunk/src/VBox/Devices/Storage


Ignore:
Timestamp:
Jun 12, 2015 2:57:04 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
100993
Message:

UsbMsd: Added scaffolding for returning different descriptors when configured as CD-ROM.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/UsbMsd.cpp

    r56292 r56393  
    242242    volatile bool       fSignalIdle;
    243243
     244    /** Indicates that this device is a CD-ROM. */
     245    bool                fIsCdrom;
     246
    244247    /**
    245248     * LUN\#0 data.
     
    536539};
    537540
     541static const VUSBDESCDEVICE g_UsbCdDeviceDesc20 =
     542{
     543    /* .bLength = */                sizeof(g_UsbCdDeviceDesc20),
     544    /* .bDescriptorType = */        VUSB_DT_DEVICE,
     545    /* .bcdUsb = */                 0x200, /* USB 2.0 */
     546    /* .bDeviceClass = */           0 /* Class specified in the interface desc. */,
     547    /* .bDeviceSubClass = */        0 /* Subclass specified in the interface desc. */,
     548    /* .bDeviceProtocol = */        0 /* Protocol specified in the interface desc. */,
     549    /* .bMaxPacketSize0 = */        64,
     550    /* .idVendor = */               VBOX_USB_VENDOR,
     551    /* .idProduct = */              USBMSD_PID_CD,
     552    /* .bcdDevice = */              0x0100, /* 1.0 */
     553    /* .iManufacturer = */          USBMSD_STR_ID_MANUFACTURER,
     554    /* .iProduct = */               USBMSD_STR_ID_PRODUCT_CDROM,
     555    /* .iSerialNumber = */          0,
     556    /* .bNumConfigurations = */     1
     557};
     558
    538559static const VUSBDESCDEVICE g_UsbMsdDeviceDesc30 =
    539560{
     
    554575};
    555576
     577static const VUSBDESCDEVICE g_UsbCdDeviceDesc30 =
     578{
     579    /* .bLength = */                sizeof(g_UsbCdDeviceDesc30),
     580    /* .bDescriptorType = */        VUSB_DT_DEVICE,
     581    /* .bcdUsb = */                 0x300, /* USB 2.0 */
     582    /* .bDeviceClass = */           0 /* Class specified in the interface desc. */,
     583    /* .bDeviceSubClass = */        0 /* Subclass specified in the interface desc. */,
     584    /* .bDeviceProtocol = */        0 /* Protocol specified in the interface desc. */,
     585    /* .bMaxPacketSize0 = */        9 /* 512, the only option for USB3. */,
     586    /* .idVendor = */               VBOX_USB_VENDOR,
     587    /* .idProduct = */              USBMSD_PID_CD,
     588    /* .bcdDevice = */              0x0110, /* 1.10 */
     589    /* .iManufacturer = */          USBMSD_STR_ID_MANUFACTURER,
     590    /* .iProduct = */               USBMSD_STR_ID_PRODUCT_CDROM,
     591    /* .iSerialNumber = */          0,
     592    /* .bNumConfigurations = */     1
     593};
     594
    556595static const VUSBDEVICEQUALIFIER g_UsbMsdDeviceQualifier =
    557596{
     
    600639};
    601640
     641static const PDMUSBDESCCACHE g_UsbCdDescCacheFS =
     642{
     643    /* .pDevice = */                &g_UsbCdDeviceDesc20,
     644    /* .paConfigs = */              &g_UsbMsdConfigDescFS,
     645    /* .paLanguages = */            g_aUsbMsdLanguages,
     646    /* .cLanguages = */             RT_ELEMENTS(g_aUsbMsdLanguages),
     647    /* .fUseCachedDescriptors = */  true,
     648    /* .fUseCachedStringsDescriptors = */ true
     649};
     650
    602651static const PDMUSBDESCCACHE g_UsbMsdDescCacheHS =
    603652{
     
    610659};
    611660
     661static const PDMUSBDESCCACHE g_UsbCdDescCacheHS =
     662{
     663    /* .pDevice = */                &g_UsbCdDeviceDesc20,
     664    /* .paConfigs = */              &g_UsbMsdConfigDescHS,
     665    /* .paLanguages = */            g_aUsbMsdLanguages,
     666    /* .cLanguages = */             RT_ELEMENTS(g_aUsbMsdLanguages),
     667    /* .fUseCachedDescriptors = */  true,
     668    /* .fUseCachedStringsDescriptors = */ true
     669};
     670
    612671static const PDMUSBDESCCACHE g_UsbMsdDescCacheSS =
    613672{
    614673    /* .pDevice = */                &g_UsbMsdDeviceDesc30,
     674    /* .paConfigs = */              &g_UsbMsdConfigDescSS,
     675    /* .paLanguages = */            g_aUsbMsdLanguages,
     676    /* .cLanguages = */             RT_ELEMENTS(g_aUsbMsdLanguages),
     677    /* .fUseCachedDescriptors = */  true,
     678    /* .fUseCachedStringsDescriptors = */ true
     679};
     680
     681static const PDMUSBDESCCACHE g_UsbCdDescCacheSS =
     682{
     683    /* .pDevice = */                &g_UsbCdDeviceDesc30,
    615684    /* .paConfigs = */              &g_UsbMsdConfigDescSS,
    616685    /* .paLanguages = */            g_aUsbMsdLanguages,
     
    20212090    LogFlow(("usbMsdUsbGetDescriptorCache/#%u:\n", pUsbIns->iInstance));
    20222091    if (pThis->pUsbIns->enmSpeed == VUSB_SPEED_SUPER)
    2023         return &g_UsbMsdDescCacheSS;
     2092        return pThis->fIsCdrom ? &g_UsbCdDescCacheSS : &g_UsbMsdDescCacheSS;
    20242093    else if (pThis->pUsbIns->enmSpeed == VUSB_SPEED_HIGH)
    2025         return &g_UsbMsdDescCacheHS;
     2094        return pThis->fIsCdrom ? &g_UsbCdDescCacheHS : &g_UsbMsdDescCacheHS;
    20262095    else
    2027         return &g_UsbMsdDescCacheFS;
     2096        return pThis->fIsCdrom ? &g_UsbCdDescCacheFS : &g_UsbMsdDescCacheFS;
    20282097}
    20292098
     
    22452314        return PDMUsbHlpVMSetError(pUsbIns, VERR_PDM_MISSING_INTERFACE_BELOW, RT_SRC_POS,
    22462315                                   N_("MSD failed to query the PDMISCSICONNECTOR from the driver below it"));
     2316
     2317    /*
     2318     * Find out what kind of device we are.
     2319     */
     2320    pThis->fIsCdrom = false;    //@todo: Find out somehow
    22472321
    22482322    /*
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