VirtualBox

Changeset 70273 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 21, 2017 12:43:40 PM (7 years ago)
Author:
vboxsync
Message:

USB/win: Use port speed already reported by OS to disginguish between LS/FS/HS devices (see bugref:7280).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxUSB/win/lib/VBoxUsbLib-win.cpp

    r69500 r70273  
    5252#include <hidsdi.h>
    5353
     54/* Defined in Windows 8 DDK (through usbdi.h) but we use Windows 7 DDK to build. */
     55#define UsbSuperSpeed   3
     56
    5457#define VBOX_USB_USE_DEVICE_NOTIFICATION
    5558
     
    310313    else
    311314        pDev->enmState = USBDEVICESTATE_USED_BY_HOST_CAPTURABLE;
    312     pDev->enmSpeed = USBDEVICESPEED_UNKNOWN;
     315
     316    /* Determine the speed the device is operating at. */
     317    switch (pConInfo->Speed)
     318    {
     319        case UsbLowSpeed:   pDev->enmSpeed = USBDEVICESPEED_LOW;    break;
     320        case UsbFullSpeed:  pDev->enmSpeed = USBDEVICESPEED_FULL;   break;
     321        case UsbHighSpeed:  pDev->enmSpeed = USBDEVICESPEED_HIGH;   break;
     322        default:    /* If we don't know, most likely it's something new. */
     323        case UsbSuperSpeed: pDev->enmSpeed = USBDEVICESPEED_SUPER;  break;
     324    }
     325    /* Unfortunately USB_NODE_CONNECTION_INFORMATION_EX will not report UsbSuperSpeed, and
     326     * it's not even defined in the Win7 DDK we use. So we go by the USB version, and
     327     * luckily we know that USB3 must mean SuperSpeed. The USB3 spec guarantees this (9.6.1).
     328     */
     329    if (pDev->bcdUSB >= 0x0300)
     330        pDev->enmSpeed = USBDEVICESPEED_SUPER;
     331
    313332    int rc = RTStrAPrintf((char **)&pDev->pszAddress, "%s", lpszDrvKeyName);
    314333    if (rc < 0)
     
    9911010                    || MonInfo.enmState == USBDEVICESTATE_USED_BY_GUEST);
    9921011            pDevs->enmState = MonInfo.enmState;
    993             if (pDevs->bcdUSB == 0x300)
    994                 /* USB3 spec guarantees this (9.6.1). */
    995                 pDevs->enmSpeed = USBDEVICESPEED_SUPER;
    996             else
    997                 /* The following is not 100% accurate but we only care about high-speed vs. non-high-speed */
    998                 pDevs->enmSpeed = Dev.fHiSpeed ? USBDEVICESPEED_HIGH : USBDEVICESPEED_FULL;
    9991012
    10001013            if (pDevs->enmState != USBDEVICESTATE_USED_BY_HOST)
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