VirtualBox

Changeset 81667 in vbox for trunk/src/VBox


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
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DevPCNet.cpp

    r81624 r81667  
    18361836    unsigned cbPacket = cb;
    18371837    uint32_t iDesc = CSR_XMTRC(pThis);
     1838    uint32_t iFirstDesc = iDesc;
    18381839
    18391840    STAM_PROFILE_ADV_START(&pThis->CTX_SUFF_Z(StatTxLenCalc), a);
     
    18451846        else
    18461847            iDesc--;
     1848
     1849        if (iDesc == iFirstDesc)
     1850            break;
    18471851
    18481852        RTGCPHYS32 addrDesc = pcnetTdraAddr(pThis, iDesc);
     
    24842488    int         rc;
    24852489    unsigned    cFlushIrq = 0;
     2490    int         cMax = 32;
    24862491    STAM_PROFILE_ADV_START(&pThis->CTX_SUFF_Z(StatTransmit), a);
    24872492    do
     
    27182723        STAM_COUNTER_INC(&pThis->aStatXmitChainCounts[RT_MIN(cBuffers,
    27192724                                                      RT_ELEMENTS(pThis->aStatXmitChainCounts)) - 1]);
     2725        if (--cMax == 0)
     2726            break;
    27202727    } while (CSR_TXON(pThis));          /* transfer on */
    27212728
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r81644 r81667  
    2067120671  <interface
    2067220672    name="IUSBDevice" extends="$unknown"
    20673     uuid="7ea6ec18-ed43-48e6-a12c-6988c5c9e3ff"
     20673    uuid="6dc83c2c-81a9-4005-9d52-fc45a78bf3f5"
    2067420674    wsmap="managed"
    2067520675    reservedAttributes="4"
     
    2072020720
    2072120721    <attribute name="address" type="wstring" readonly="yes">
    20722       <desc>Host specific address of the device.</desc>
     20722      <desc>
     20723        Host-specific address of the device, uniquely
     20724        identifying a physically connected device in the system.
     20725        Note that the address of a USB device may change across
     20726        device re-plugs and host suspend/resume cycles or reboots.
     20727      </desc>
    2072320728    </attribute>
    2072420729
    2072520730    <attribute name="port" type="unsigned short" readonly="yes">
    2072620731      <desc>
    20727         Host USB port number the device is physically
     20732        Host USB port number on the hub the device is physically
    2072820733        connected to.
     20734      </desc>
     20735    </attribute>
     20736
     20737    <attribute name="portPath" type="wstring" readonly="yes">
     20738      <desc>
     20739        Host-specific identifier of the port (including hub) the USB
     20740        device is physically connected to. Note that hubs may be
     20741        dynamically added and removed, and that hub enumeration may not
     20742        be consistent across host reboots.
    2072920743      </desc>
    2073020744    </attribute>
  • trunk/src/VBox/Main/include/HostUSBDeviceImpl.h

    r76592 r81667  
    259259    HRESULT getAddress(com::Utf8Str &aAddress);
    260260    HRESULT getPort(USHORT *aPort);
     261    HRESULT getPortPath(com::Utf8Str &aPortPath);
    261262    HRESULT getVersion(USHORT *aVersion);
    262263    HRESULT getPortVersion(USHORT *aPortVersion);
  • trunk/src/VBox/Main/include/RemoteUSBDeviceImpl.h

    r76562 r81667  
    7979    HRESULT getPort(USHORT *aPort);
    8080    HRESULT getVersion(USHORT *aVersion);
    81     HRESULT getPortVersion(USHORT *aPortVersion);
     81    HRESULT getPortPath(com::Utf8Str &aAddress);
    8282    HRESULT getSpeed(USBConnectionSpeed_T *aSpeed);
    8383    HRESULT getRemote(BOOL *aRemote);
     
    9292    {
    9393        Data() : vendorId(0), productId(0), revision(0), port(0), version(1),
    94                  portVersion(1), speed(USBConnectionSpeed_Null), dirty(FALSE),
     94                 speed(USBConnectionSpeed_Null), dirty(FALSE),
    9595                 devId(0), clientId(0) {}
    9696
     
    109109
    110110        const uint16_t port;
     111        const Utf8Str portPath;
    111112        const uint16_t version;
    112         const uint16_t portVersion;
    113113        const USBConnectionSpeed_T speed;
    114114
  • trunk/src/VBox/Main/include/USBDeviceImpl.h

    r81644 r81667  
    5757    HRESULT getAddress(com::Utf8Str &aAddress);
    5858    HRESULT getPort(USHORT *aPort);
     59    HRESULT getPortPath(com::Utf8Str &aPortPath);
    5960    HRESULT getVersion(USHORT *aVersion);
    6061    HRESULT getSpeed(USBConnectionSpeed_T *aSpeed);
     
    9192        /** The host port number. */
    9293        const USHORT port;
     94        /** The host port path. */
     95        const com::Utf8Str portPath;
    9396        /** The major USB version number of the device. */
    9497        const USHORT version;
  • 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;
  • trunk/src/VBox/Main/src-server/HostUSBDeviceImpl.cpp

    r76592 r81667  
    204204
    205205    *aPort = mUsb->bPort;
     206
     207    return S_OK;
     208}
     209
     210
     211HRESULT HostUSBDevice::getPortPath(com::Utf8Str &aPortPath)
     212{
     213    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     214
     215    aPortPath = mUsb->pszPortPath;
    206216
    207217    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