VirtualBox

Changeset 81667 in vbox for trunk/src/VBox/Main/src-client


Ignore:
Timestamp:
Nov 5, 2019 11:08:21 AM (5 years ago)
Author:
vboxsync
Message:

Main: Added a portPath attribute to IUSBDevice. This will allow uniquely identifying a specific USB port in a system (see bugref:9518).

Location:
trunk/src/VBox/Main/src-client
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/RemoteUSBDeviceImpl.cpp

    r76553 r81667  
    7878    unconst(mData.backend)      = "vrdp";
    7979
     80    char port[16];
     81    RTStrPrintf(port, sizeof(port), "%u", pDevDesc->idPort);
     82    unconst(mData.portPath)     = port;
     83
    8084    unconst(mData.port)         = pDevDesc->idPort;
    8185    unconst(mData.version)      = (uint16_t)(pDevDesc->bcdUSB >> 8);
     
    8993            case VRDE_USBDEVICESPEED_LOW:
    9094            case VRDE_USBDEVICESPEED_FULL:
    91                 unconst(mData.portVersion) = 1;
    9295                unconst(mData.speed) = USBConnectionSpeed_Full;
    9396                break;
     
    9598            case VRDE_USBDEVICESPEED_HIGH:
    9699            case VRDE_USBDEVICESPEED_VARIABLE:
    97                 unconst(mData.portVersion) = 2;
    98100                unconst(mData.speed) = USBConnectionSpeed_High;
    99101                break;
    100102
    101103            case VRDE_USBDEVICESPEED_SUPERSPEED:
    102                 unconst(mData.portVersion) = 3;
    103104                unconst(mData.speed) = USBConnectionSpeed_Super;
    104105                break;
     
    107108    else
    108109    {
    109         unconst(mData.portVersion)  = mData.version;
    110110        unconst(mData.speed) = mData.version == 3 ? USBConnectionSpeed_Super
    111111                             : mData.version == 2 ? USBConnectionSpeed_High
     
    154154
    155155    unconst(mData.port) = 0;
     156    unconst(mData.portPath).setNull();
    156157    unconst(mData.version) = 1;
    157     unconst(mData.portVersion) = 1;
    158158
    159159    unconst(mData.dirty) = FALSE;
     
    237237}
    238238
     239HRESULT RemoteUSBDevice::getPortPath(com::Utf8Str &aPortPath)
     240{
     241    /* this is const, no need to lock */
     242    aPortPath = mData.portPath;
     243
     244    return S_OK;
     245}
     246
    239247HRESULT RemoteUSBDevice::getVersion(USHORT *aVersion)
    240248{
    241249    /* this is const, no need to lock */
    242250    *aVersion = mData.version;
    243 
    244     return S_OK;
    245 }
    246 
    247 HRESULT RemoteUSBDevice::getPortVersion(USHORT *aPortVersion)
    248 {
    249     /* this is const, no need to lock */
    250     *aPortVersion = mData.portVersion;
    251251
    252252    return S_OK;
  • trunk/src/VBox/Main/src-client/USBDeviceImpl.cpp

    r81644 r81667  
    9696    ComAssertComRCRet(hrc, hrc);
    9797
     98    hrc = aUSBDevice->COMGETTER(PortPath)(bstr.asOutParam());
     99    ComAssertComRCRet(hrc, hrc);
     100
    98101    hrc = aUSBDevice->COMGETTER(Version)(&unconst(mData.version));
    99102    ComAssertComRCRet(hrc, hrc);
     
    143146
    144147    unconst(mData.port) = 0;
     148    unconst(mData.portPath).setNull();
    145149    unconst(mData.version) = 1;
    146150
     
    273277    /* this is const, no need to lock */
    274278    *aPort = mData.port;
     279
     280    return S_OK;
     281}
     282
     283HRESULT OUSBDevice::getPortPath(com::Utf8Str &aPortPath)
     284{
     285    /* this is const, no need to lock */
     286    aPortPath = mData.portPath;
    275287
    276288    return S_OK;
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