VirtualBox

Changeset 5713 in vbox


Ignore:
Timestamp:
Nov 12, 2007 5:06:56 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
26069
Message:

Added an maskedInterface property to the USB filters. It is used to hide a set of interface from the guest, which means that on Linux we won't capture those and linux can continue using them.

Location:
trunk
Files:
17 edited

Legend:

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

    r5529 r5713  
    581581 * @param   pvBackend       Pointer to the backend.
    582582 * @param   iUsbVersion     The preferred USB version.
    583  */
    584 PDMR3DECL(int) PDMR3USBCreateProxyDevice(PVM pVM, PCRTUUID pUuid, bool fRemote, const char *pszAddress, void *pvBackend, uint32_t iUsbVersion);
     583 * @param   fMaskedIfs      The interfaces to hide from the guest.
     584 */
     585PDMR3DECL(int) PDMR3USBCreateProxyDevice(PVM pVM, PCRTUUID pUuid, bool fRemote, const char *pszAddress, void *pvBackend,
     586                                         uint32_t iUsbVersion, uint32_t fMaskedIfs);
    585587
    586588/**
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp

    r5615 r5713  
    189189        Bstr mRemote;
    190190        Bstr mSerialNumber;
     191        Nullable <ULONG> mMaskedInterfaces;
    191192        USBDeviceFilterAction_T mAction;
    192193    };
     
    556557                 "                            [-remote yes|no] (null, VM filters only)\n"
    557558                 "                            [-serialnumber <string>] (null)\n"
     559                 "                            [-maskedinterfaces <XXXXXXXX>]\n"
    558560                 "\n");
    559561    }
     
    573575                 "                            [-remote yes|no] (null, VM filters only)\n"
    574576                 "                            [-serialnumber <string>|\"\"]\n"
     577                 "                            [-maskedinterfaces <XXXXXXXX>]\n"
    575578                 "\n");
    576579    }
     
    16311634                RTPrintf("USBFilterRemote%d=\"%lS\"\n", index + 1, bstr.raw());
    16321635            else
    1633                 RTPrintf("Remote:           %lS\n\n", bstr.raw());
     1636                RTPrintf("Remote:           %lS\n", bstr.raw());
    16341637            CHECK_ERROR_RET (DevPtr, COMGETTER (SerialNumber) (bstr.asOutParam()), rc);
    16351638            if (details == VMINFO_MACHINEREADABLE)
    16361639                RTPrintf("USBFilterSerialNumber%d=\"%lS\"\n", index + 1, bstr.raw());
    16371640            else
    1638                 RTPrintf("Serial Number:    %lS\n\n", bstr.raw());
     1641                RTPrintf("Serial Number:    %lS\n", bstr.raw());
     1642            if (details != VMINFO_MACHINEREADABLE)
     1643            {
     1644                ULONG fMaskedIfs;
     1645                CHECK_ERROR_RET (DevPtr, COMGETTER (MaskedInterfaces) (&fMaskedIfs), rc);
     1646                if (fMaskedIfs)
     1647                    RTPrintf("Masked Interfaces: 0x%08x\n", fMaskedIfs);
     1648                RTPrintf("\n");
     1649            }
    16391650
    16401651            rc = Enum->HasMore (&fMore);
     
    65766587                    return errorSyntax(USAGE_USBFILTER_ADD, "Not enough parameters");
    65776588                }
    6578                 else
    6579                 {
    6580                     return errorSyntax(USAGE_USBFILTER_MODIFY, "Not enough parameters");
    6581                 }
     6589                return errorSyntax(USAGE_USBFILTER_MODIFY, "Not enough parameters");
    65826590            }
    65836591
     
    66986706                    cmd.mFilter.mSerialNumber = argv [i];
    66996707                }
     6708                else if (strcmp(argv [i], "-maskedinterfaces") == 0)
     6709                {
     6710                    if (argc <= i + 1)
     6711                    {
     6712                        return errorArgument("Missing argument to '%s'", argv[i]);
     6713                    }
     6714                    i++;
     6715                    uint32_t u32;
     6716                    rc = RTStrToUInt32Full(argv[i], 0, &u32);
     6717                    if (RT_FAILURE(rc))
     6718                    {
     6719                        return errorArgument("Failed to convert the -maskinterfaces value '%s' to a number, rc=%Rrc", argv[i], rc);
     6720                    }
     6721                    cmd.mFilter.mMaskedInterfaces = u32;
     6722                }
    67006723                else if (strcmp(argv [i], "-action") == 0)
    67016724                {
     
    68206843                if (!f.mSerialNumber.isNull())
    68216844                    CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber.setNullIfEmpty()));
     6845                if (!f.mMaskedInterfaces.isNull())
     6846                    CHECK_ERROR_BREAK (flt, COMSETTER(MaskedInterfaces) (f.mMaskedInterfaces));
    68226847
    68236848                if (f.mAction != USBDeviceFilterAction_InvalidUSBDeviceFilterAction)
     
    68456870                if (!f.mSerialNumber.isNull())
    68466871                    CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber.setNullIfEmpty()));
     6872                if (!f.mMaskedInterfaces.isNull())
     6873                    CHECK_ERROR_BREAK (flt, COMSETTER(MaskedInterfaces) (f.mMaskedInterfaces));
    68476874
    68486875                CHECK_ERROR_BREAK (ctl, InsertDeviceFilter (cmd.mIndex, flt));
     
    68736900                if (!f.mSerialNumber.isNull())
    68746901                    CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber.setNullIfEmpty()));
     6902                if (!f.mMaskedInterfaces.isNull())
     6903                    CHECK_ERROR_BREAK (flt, COMSETTER(MaskedInterfaces) (f.mMaskedInterfaces));
    68756904
    68766905                if (f.mAction != USBDeviceFilterAction_InvalidUSBDeviceFilterAction)
     
    69016930                if (!f.mSerialNumber.isNull())
    69026931                    CHECK_ERROR_BREAK (flt, COMSETTER(SerialNumber) (f.mSerialNumber.setNullIfEmpty()));
     6932                if (!f.mMaskedInterfaces.isNull())
     6933                    CHECK_ERROR_BREAK (flt, COMSETTER(MaskedInterfaces) (f.mMaskedInterfaces));
    69036934            }
    69046935            break;
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r5580 r5713  
    33653365 *  @param aDevice
    33663366 *      The device in question.
     3367 *  @param aMaskedIfs
     3368 *      The interfaces to hide from the guest.
    33673369 *
    33683370 *  @note Locks this object for writing.
    33693371 */
    3370 HRESULT Console::onUSBDeviceAttach (IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError)
     3372HRESULT Console::onUSBDeviceAttach (IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs)
    33713373{
    33723374    LogFlowThisFunc (("aDevice=%p aError=%p\n", aDevice, aError));
     
    34193421    }
    34203422
    3421     HRESULT rc = attachUSBDevice (aDevice);
     3423    HRESULT rc = attachUSBDevice (aDevice, aMaskedIfs);
    34223424#endif /* PDMUsb */
    34233425
     
    47094711    AssertReturn (aHostDevice && aConfig, E_FAIL);
    47104712#else /* PDMUsb */
    4711 HRESULT Console::attachUSBDevice (IUSBDevice *aHostDevice)
     4713HRESULT Console::attachUSBDevice (IUSBDevice *aHostDevice, ULONG aMaskedIfs)
    47124714{
    47134715    AssertReturn (aHostDevice, E_FAIL);
     
    47634765    PVMREQ pReq = NULL;
    47644766    int vrc = VMR3ReqCall (mpVM, &pReq, RT_INDEFINITE_WAIT,
    4765                            (PFNRT) usbAttachCallback, 5, this, aHostDevice, Uuid.ptr(), fRemote, Address.raw());
     4767                           (PFNRT) usbAttachCallback, 6, this, aHostDevice, Uuid.ptr(), fRemote, Address.raw(), aMaskedIfs);
    47664768#endif /* PDMUsb */
    47674769    if (VBOX_SUCCESS (vrc))
     
    48634865//static
    48644866DECLCALLBACK(int)
    4865 Console::usbAttachCallback (Console *that, IUSBDevice *aHostDevice, PCRTUUID aUuid, bool aRemote, const char *aAddress)
     4867Console::usbAttachCallback (Console *that, IUSBDevice *aHostDevice, PCRTUUID aUuid, bool aRemote, const char *aAddress, ULONG aMaskedIfs)
    48664868{
    48674869    LogFlowFuncEnter();
     
    48874889
    48884890    int vrc = PDMR3USBCreateProxyDevice (that->mpVM, aUuid, aRemote, aAddress, pvRemoteBackend,
    4889                                          portVersion == 1 ? VUSB_STDVER_11 : VUSB_STDVER_20);
     4891                                         portVersion == 1 ? VUSB_STDVER_11 : VUSB_STDVER_20, aMaskedIfs);
    48904892    if (VBOX_SUCCESS (vrc))
    48914893    {
     
    57225724            /* Check if the device is ok for current USB filters. */
    57235725            BOOL fMatched = FALSE;
    5724 
    5725             HRESULT hrc = mControl->RunUSBDeviceFilters(device, &fMatched);
     5726            ULONG fMaskedIfs = 0;
     5727
     5728            HRESULT hrc = mControl->RunUSBDeviceFilters(device, &fMatched, &fMaskedIfs);
    57265729
    57275730            AssertComRC (hrc);
    57285731
    5729             LogFlowThisFunc (("USB filters return %d\n", fMatched));
     5732            LogFlowThisFunc (("USB filters return %d %#x\n", fMatched, fMaskedIfs));
    57305733
    57315734            if (fMatched)
    57325735            {
    5733                 hrc = onUSBDeviceAttach (device, NULL);
     5736                hrc = onUSBDeviceAttach (device, NULL, fMaskedIfs);
    57345737
    57355738                /// @todo (r=dmik) warning reporting subsystem
  • trunk/src/VBox/Main/HostImpl.cpp

    r5652 r5713  
    21932193    AssertReturn (aDevice->isStatePending() == false, false);
    21942194
    2195     bool hasMatch = aMachine->hasMatchingUSBFilter (aDevice);
     2195    ULONG maskedIfs;
     2196    bool hasMatch = aMachine->hasMatchingUSBFilter (aDevice, &maskedIfs);
    21962197
    21972198    if (hasMatch)
    21982199    {
    21992200        /* try to capture the device */
    2200         return aDevice->requestCapture (aMachine);
     2201        return aDevice->requestCapture (aMachine, maskedIfs);
    22012202    }
    22022203
  • trunk/src/VBox/Main/HostUSBDeviceImpl.cpp

    r5528 r5713  
    379379 *  Captured), then the machine is informed before this method returns.
    380380 *
    381  *  @param aMachine     Machine that will capture this device on success.
    382  *  @return             @c false if the device could be immediately captured
    383  *                      but the VM process refused to grab it;
    384  *                      @c true otherwise.
     381 *  @param aMachine         Machine that will capture this device on success.
     382 *  @param aMaskedIfs       The interfaces to hide from the guest.
     383 *  @return                 @c false if the device could be immediately captured
     384 *                          but the VM process refused to grab it;
     385 *                          @c true otherwise.
    385386 *
    386387 *  @note Must be called from under the object write lock.
     
    388389 *  @note May lock the given machine object for reading.
    389390 */
    390 bool HostUSBDevice::requestCapture (SessionMachine *aMachine)
     391bool HostUSBDevice::requestCapture (SessionMachine *aMachine, ULONG aMaskedIfs /* = 0*/)
    391392{
    392393    LogFlowThisFunc (("\n"));
     
    419420        LogFlowThisFunc (("Calling machine->onUSBDeviceAttach()...\n"));
    420421
    421         HRESULT rc = aMachine->onUSBDeviceAttach (d, NULL);
     422        HRESULT rc = aMachine->onUSBDeviceAttach (d, NULL, aMaskedIfs);
    422423
    423424        /* The VM process has a legal reason to fail (for example, incorrect
     
    449450    mPendingSince = RTTimeNanoTS();
    450451    mMachine = aMachine;
     452    mMaskedIfs = aMaskedIfs;
    451453
    452454    mUSBProxyService->captureDevice (this);
     
    738740        LogFlowThisFunc (("Calling machine->onUSBDeviceAttach()...\n"));
    739741
    740         HRESULT rc = mMachine->onUSBDeviceAttach (d, error);
     742        HRESULT rc = mMachine->onUSBDeviceAttach (d, error, mMaskedIfs);
    741743
    742744        /* The VM process has a legal reason to fail (for example, incorrect
  • trunk/src/VBox/Main/MachineImpl.cpp

    r5627 r5713  
    25372537}
    25382538
    2539 /** 
     2539/**
    25402540 *  Saves the registry entry of this machine to the given configuration node.
    2541  * 
     2541 *
    25422542 *  @param aEntryNode Node to save the registry entry to.
    25432543 *
     
    85148514 */
    85158515STDMETHODIMP SessionMachine::RunUSBDeviceFilters (IUSBDevice *aUSBDevice,
    8516                                                   BOOL *aMatched)
     8516                                                  BOOL *aMatched,
     8517                                                  ULONG *aMaskedIfs)
    85178518{
    85188519    LogFlowThisFunc (("\n"));
     
    85268527    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    85278528
    8528     *aMatched = mUSBController->hasMatchingFilter (aUSBDevice);
     8529    *aMatched = mUSBController->hasMatchingFilter (aUSBDevice, aMaskedIfs);
    85298530
    85308531    return S_OK;
     
    95169517}
    95179518
    9518 /** 
     9519/**
    95199520 *  Returns @c true if this machine's USB controller reports it has a matching
    95209521 *  filter for the given USB device and @c false otherwise.
     
    95229523 *  @note Locks this object for reading.
    95239524 */
    9524 bool SessionMachine::hasMatchingUSBFilter (const ComObjPtr <HostUSBDevice> &aDevice)
     9525bool SessionMachine::hasMatchingUSBFilter (const ComObjPtr <HostUSBDevice> &aDevice, ULONG *aMaskedIfs)
    95259526{
    95269527    AutoCaller autoCaller (this);
     
    95329533    AutoReaderLock alock (this);
    95339534
    9534     return mUSBController->hasMatchingFilter (aDevice);
     9535    return mUSBController->hasMatchingFilter (aDevice, aMaskedIfs);
    95359536}
    95369537
     
    95399540 */
    95409541HRESULT SessionMachine::onUSBDeviceAttach (IUSBDevice *aDevice,
    9541                                            IVirtualBoxErrorInfo *aError)
     9542                                           IVirtualBoxErrorInfo *aError,
     9543                                           ULONG aMaskedIfs)
    95429544{
    95439545    LogFlowThisFunc (("\n"));
     
    95609562        return E_FAIL;
    95619563
    9562     return directControl->OnUSBDeviceAttach (aDevice, aError);
     9564    return directControl->OnUSBDeviceAttach (aDevice, aError, aMaskedIfs);
    95639565}
    95649566
  • trunk/src/VBox/Main/SessionImpl.cpp

    r4071 r5713  
    606606
    607607STDMETHODIMP Session::OnUSBDeviceAttach (IUSBDevice *aDevice,
    608                                          IVirtualBoxErrorInfo *aError)
    609 {
    610     LogFlowThisFunc (("\n"));
    611 
    612     AutoCaller autoCaller (this);
    613     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    614 
    615     AutoReaderLock alock (this);
    616     AssertReturn (mState == SessionState_SessionOpen &&
    617                   mType == SessionType_DirectSession, E_FAIL);
    618 
    619     return mConsole->onUSBDeviceAttach (aDevice, aError);
     608                                         IVirtualBoxErrorInfo *aError,
     609                                         ULONG aMaskedIfs)
     610{
     611    LogFlowThisFunc (("\n"));
     612
     613    AutoCaller autoCaller (this);
     614    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
     615
     616    AutoReaderLock alock (this);
     617    AssertReturn (mState == SessionState_SessionOpen &&
     618                  mType == SessionType_DirectSession, E_FAIL);
     619
     620    return mConsole->onUSBDeviceAttach (aDevice, aError, aMaskedIfs);
    620621}
    621622
     
    994995#endif
    995996
    996 #if defined(RT_OS_OS2) 
     997#if defined(RT_OS_OS2)
    997998/** VM IPC mutex holder thread */
    998999DECLCALLBACK(int) IPCMutexHolderThread (RTTHREAD Thread, void *pvUser)
  • trunk/src/VBox/Main/USBControllerImpl.cpp

    r5617 r5713  
    539539        Bstr remote;
    540540        CFGLDRQueryBSTR (filter, "remote", remote.asOutParam());
     541        uint32_t maskedIfs;
     542        if (RT_FAILURE(CFGLDRQueryUInt32 (filter, "maskedInterfaces", &maskedIfs)))
     543            maskedIfs = 0;
    541544
    542545        ComObjPtr <USBDeviceFilter> filterObj;
     
    545548                              name, active, vendorId, productId, revision,
    546549                              manufacturer, product, serialNumber,
    547                               port, remote);
     550                              port, remote, maskedIfs);
    548551        /* error info is set by init() when appropriate */
    549552        if (SUCCEEDED (rc))
     
    657660            CFGLDRSetBSTR (filter, "remote", data.mRemote.string());
    658661#endif /* VBOX_WITH_USBFILTER */
     662
     663        if (data.mMaskedIfs)
     664            CFGLDRSetUInt32 (filter, "maskedInterfaces", data.mMaskedIfs);
    659665
    660666        CFGLDRReleaseNode (filter);
     
    11021108 *  @note Locks this object for reading.
    11031109 */
    1104 bool USBController::hasMatchingFilter (ComObjPtr <HostUSBDevice> &aDevice)
     1110bool USBController::hasMatchingFilter (const ComObjPtr <HostUSBDevice> &aDevice, ULONG *aMaskedIfs)
    11051111{
    11061112    AutoCaller autoCaller (this);
     
    11131119        return false;
    11141120
    1115     bool match = false;
    1116 
    11171121    /* apply self filters */
    11181122    for (DeviceFilterList::const_iterator it = mDeviceFilters->begin();
    1119          !match && it != mDeviceFilters->end();
     1123         it != mDeviceFilters->end();
    11201124         ++ it)
    11211125    {
    11221126        AutoLock filterLock (*it);
    1123         match = aDevice->isMatch ((*it)->data());
    1124     }
    1125 
    1126     return match;
     1127        if (aDevice->isMatch ((*it)->data()))
     1128        {
     1129            *aMaskedIfs = (*it)->data().mMaskedIfs;
     1130            return true;
     1131        }
     1132    }
     1133
     1134    return false;
    11271135}
    11281136
     
    11391147 *  @note Locks this object for reading.
    11401148 */
    1141 bool USBController::hasMatchingFilter (IUSBDevice *aUSBDevice)
     1149bool USBController::hasMatchingFilter (IUSBDevice *aUSBDevice, ULONG *aMaskedIfs)
    11421150{
    11431151    LogFlowThisFuncEnter();
     
    12651273
    12661274        match = true;
     1275        *aMaskedIfs = aData.mMaskedIfs;
    12671276        break;
    12681277    }
  • trunk/src/VBox/Main/USBDeviceFilterImpl.cpp

    r4071 r5713  
    174174                               INPTR BSTR aManufacturer, INPTR BSTR aProduct,
    175175                               INPTR BSTR aSerialNumber,
    176                                INPTR BSTR aPort, INPTR BSTR aRemote)
     176                               INPTR BSTR aPort, INPTR BSTR aRemote,
     177                               ULONG aMaskedIfs)
    177178{
    178179    LogFlowThisFunc (("aParent=%p\n", aParent));
     
    194195    mData->mName = aName;
    195196    mData->mActive = aActive;
     197    mData->mMaskedIfs = 0;
    196198
    197199    /* initialize all filters to any match using null string */
     
    233235        rc = COMSETTER(Remote) (aRemote);
    234236        CheckComRCBreakRC (rc);
     237        rc = COMSETTER(MaskedInterfaces) (aMaskedIfs);
     238        CheckComRCBreakRC (rc);
    235239    }
    236240    while (0);
     
    269273    mData->mName = aName;
    270274    mData->mActive = FALSE;
     275    mData->mMaskedIfs = 0;
    271276
    272277    /* initialize all filters to any match using null string */
     
    959964        mData.backup();
    960965        mData->mRemote = flt;
     966
     967        /* leave the lock before informing callbacks */
     968        alock.unlock();
     969
     970        return mParent->onDeviceFilterChange (this);
     971    }
     972
     973    return S_OK;
     974}
     975
     976STDMETHODIMP USBDeviceFilter::COMGETTER(MaskedInterfaces) (ULONG *aMaskedIfs)
     977{
     978    if (!aMaskedIfs)
     979        return E_POINTER;
     980
     981    AutoCaller autoCaller (this);
     982    CheckComRCReturnRC (autoCaller.rc());
     983
     984    AutoReaderLock alock (this);
     985
     986    *aMaskedIfs = mData->mMaskedIfs;
     987
     988    return S_OK;
     989}
     990
     991STDMETHODIMP USBDeviceFilter::COMSETTER(MaskedInterfaces) (ULONG aMaskedIfs)
     992{
     993    AutoCaller autoCaller (this);
     994    CheckComRCReturnRC (autoCaller.rc());
     995
     996    /* the machine needs to be mutable */
     997    Machine::AutoMutableStateDependency adep (mParent->parent());
     998    CheckComRCReturnRC (adep.rc());
     999
     1000    AutoLock alock (this);
     1001
     1002    if (mData->mMaskedIfs != aMaskedIfs)
     1003    {
     1004        mData.backup();
     1005        mData->mMaskedIfs = aMaskedIfs;
    9611006
    9621007        /* leave the lock before informing callbacks */
     
    11921237#endif /* VBOX_WITH_USBFILTER */
    11931238    mData->mRemote = NULL;
     1239    mData->mMaskedIfs = 0;
    11941240
    11951241    mInList = false;
     
    12731319#endif /* VBOX_WITH_USBFILTER */
    12741320    mData->mRemote = NULL;
     1321    mData->mMaskedIfs = 0;
    12751322
    12761323    /* Confirm successful initialization */
     
    17761823        tr ("The remote state filter is not supported by "
    17771824            "IHostUSBDeviceFilter objects"));
     1825}
     1826
     1827STDMETHODIMP HostUSBDeviceFilter::COMGETTER(MaskedInterfaces) (ULONG *aMaskedIfs)
     1828{
     1829    if (!aMaskedIfs)
     1830        return E_POINTER;
     1831
     1832    AutoCaller autoCaller (this);
     1833    CheckComRCReturnRC (autoCaller.rc());
     1834
     1835    AutoReaderLock alock (this);
     1836
     1837    *aMaskedIfs = mData->mMaskedIfs;
     1838
     1839    return S_OK;
     1840}
     1841
     1842STDMETHODIMP HostUSBDeviceFilter::COMSETTER(MaskedInterfaces) (INPTR ULONG aMaskedIfs)
     1843{
     1844    return setError (E_NOTIMPL,
     1845        tr ("The masked interfaces property is not applicable to IHostUSBDeviceFilter objects"));
    17781846}
    17791847
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r5641 r5713  
    19021902  <interface
    19031903     name="IInternalMachineControl" extends="$unknown"
    1904      uuid="f33740bf-53b2-4519-b950-104260c6a189"
     1904     uuid="1063893c-4c38-4304-aee9-73e072c181cc"
    19051905     internal="yes"
    19061906     wsmap="suppress"
     
    19341934      </desc>
    19351935      <param name="device" type="IUSBDevice" dir="in"/>
    1936       <param name="matched" type="boolean" dir="return"/>
     1936      <param name="matched" type="boolean" dir="out"/>
     1937      <param name="maskedInterfaces" type="unsigned long" dir="out"/>
    19371938    </method>
    19381939
     
    79817982  <enumerator
    79827983     name="IUSBDeviceFilterEnumerator" type="IUSBDeviceFilter"
    7983      uuid="8d066d8b-3576-4a22-a387-847840937453"
     7984     uuid="d5109c61-93e7-4726-926b-0dee1020da56"
    79847985     />
    79857986
     
    81408141          i.e. it is ignored by IHostUSBDeviceFilter objects.
    81418142        </note>
     8143      </desc>
     8144    </attribute>
     8145
     8146    <attribute name="maskedInterfaces" type="unsigned long">
     8147      <desc>
     8148       This is an advanced option for hiding one or more USB interfaces
     8149       from the guest. The value is a bitmask where the bits that are set
     8150       means the corresponding USB interface should be hidden, masked off
     8151       if you like.
     8152       This feature only works on Linux hosts.
    81428153      </desc>
    81438154    </attribute>
     
    85838594  <interface
    85848595     name="IInternalSessionControl" extends="$unknown"
    8585      uuid="e25a28b0-a58a-4582-b7c8-40abaa1f5d5b"
     8596     uuid="37838967-2430-4bb1-8acc-1b5b2c383d44"
    85868597     internal="yes"
    85878598     wsmap="suppress"
     
    87098720      <param name="device" type="IUSBDevice" dir="in"/>
    87108721      <param name="error" type="IVirtualBoxErrorInfo" dir="in"/>
     8722      <param name="maskedInterfaces" type="unsigned long" dir="in"/>
    87118723    </method>
    87128724
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r5520 r5713  
    174174    HRESULT onUSBControllerChange();
    175175    HRESULT onSharedFolderChange (BOOL aGlobal);
    176     HRESULT onUSBDeviceAttach (IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError);
     176    HRESULT onUSBDeviceAttach (IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs);
    177177    HRESULT onUSBDeviceDetach (INPTR GUIDPARAM aId, IVirtualBoxErrorInfo *aError);
    178178
     
    416416                       PVUSBIRHCONFIG aConfig, PCRTUUID aUuid);
    417417#else /* PDMUsb coding. */
    418     HRESULT attachUSBDevice (IUSBDevice *aHostDevice);
     418    HRESULT attachUSBDevice (IUSBDevice *aHostDevice, ULONG aMaskedIfs);
    419419    HRESULT detachUSBDevice (USBDeviceList::iterator &aIt);
    420420
    421421    static DECLCALLBACK(int)
    422422    usbAttachCallback (Console *that, IUSBDevice *aHostDevice, PCRTUUID aUuid,
    423                        bool aRemote, const char *aAddress);
     423                       bool aRemote, const char *aAddress, ULONG aMaskedIfs);
    424424    static DECLCALLBACK(int)
    425425    usbDetachCallback (Console *that, USBDeviceList::iterator *aIt, PCRTUUID aUuid);
  • trunk/src/VBox/Main/include/HostUSBDeviceImpl.h

    r5528 r5713  
    129129    Utf8Str name();
    130130
    131     bool requestCapture (SessionMachine *aMachine);
     131    bool requestCapture (SessionMachine *aMachine, ULONG aMaskedIfs = 0);
    132132    void requestRelease();
    133133    void requestHold();
     
    173173     * Only used for host devices. */
    174174    PUSBDEVICE mUsb;
     175
     176    /** The interface mask to be use in the pending capture. */
     177    ULONG mMaskedIfs;
    175178
    176179    friend class USBProxyService;
  • trunk/src/VBox/Main/include/MachineImpl.h

    r5642 r5713  
    358358    };
    359359
    360     /** 
     360    /**
    361361     *  Shortcut to AutoStateDependency <AnyStateDep>.
    362362     *  See AutoStateDependency to get the usage pattern.
     
    371371    typedef AutoStateDependency <AnyStateDep> AutoAnyStateDependency;
    372372
    373     /** 
     373    /**
    374374     *  Shortcut to AutoStateDependency <MutableStateDep>.
    375375     *  See AutoStateDependency to get the usage pattern.
     
    388388    typedef AutoStateDependency <MutableStateDep> AutoMutableStateDependency;
    389389
    390     /** 
     390    /**
    391391     *  Shortcut to AutoStateDependency <MutableOrSavedStateDep>.
    392392     *  See AutoStateDependency to get the usage pattern.
     
    511511    ComObjPtr <SessionMachine> sessionMachine();
    512512
    513     /** 
     513    /**
    514514     *  Returns the VirtualBox object this machine belongs to.
    515515     *
     
    520520    const ComObjPtr <VirtualBox, ComWeakRef> &virtualBox() const { return mParent; }
    521521
    522     /** 
     522    /**
    523523     *  Returns this machine's name.
    524524     *
     
    529529    const Guid &uuid() const { return mData->mUuid; }
    530530
    531     /** 
     531    /**
    532532     *  Returns this machine's full settings file path.
    533533     *
     
    538538    const Bstr &settingsFileFull() const { return mData->mConfigFileFull; }
    539539
    540     /** 
     540    /**
    541541     *  Returns this machine's name.
    542542     *
     
    771771    STDMETHOD(UpdateState)(MachineState_T machineState);
    772772    STDMETHOD(GetIPCId)(BSTR *id);
    773     STDMETHOD(RunUSBDeviceFilters) (IUSBDevice *aUSBDevice, BOOL *aMatched);
     773    STDMETHOD(RunUSBDeviceFilters) (IUSBDevice *aUSBDevice, BOOL *aMatched, ULONG *aMaskedIfs);
    774774    STDMETHOD(CaptureUSBDevice) (INPTR GUIDPARAM aId);
    775775    STDMETHOD(DetachUSBDevice) (INPTR GUIDPARAM aId, BOOL aDone);
     
    796796    bool checkForDeath();
    797797
    798 #if defined (RT_OS_WINDOWS) 
     798#if defined (RT_OS_WINDOWS)
    799799    HANDLE ipcSem() { return mIPCSem; }
    800800#elif defined (RT_OS_OS2)
     
    810810    HRESULT onUSBControllerChange();
    811811    HRESULT onUSBDeviceAttach (IUSBDevice *aDevice,
    812                                IVirtualBoxErrorInfo *aError);
     812                               IVirtualBoxErrorInfo *aError,
     813                               ULONG aMaskedIfs);
    813814    HRESULT onUSBDeviceDetach (INPTR GUIDPARAM aId,
    814815                               IVirtualBoxErrorInfo *aError);
    815816    HRESULT onSharedFolderChange();
    816817
    817     bool hasMatchingUSBFilter (const ComObjPtr <HostUSBDevice> &aDevice);
     818    bool hasMatchingUSBFilter (const ComObjPtr <HostUSBDevice> &aDevice, ULONG *aMaskedIfs);
    818819
    819820private:
  • trunk/src/VBox/Main/include/SessionImpl.h

    r4071 r5713  
    9999    STDMETHOD(OnUSBControllerChange)();
    100100    STDMETHOD(OnSharedFolderChange) (BOOL aGlobal);
    101     STDMETHOD(OnUSBDeviceAttach) (IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError);
     101    STDMETHOD(OnUSBDeviceAttach) (IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs);
    102102    STDMETHOD(OnUSBDeviceDetach) (INPTR GUIDPARAM aId, IVirtualBoxErrorInfo *aError);
    103103    STDMETHOD(OnShowWindow) (BOOL aCheck, BOOL *aCanShow, ULONG64 *aWinId);
  • trunk/src/VBox/Main/include/USBControllerImpl.h

    r5613 r5713  
    116116                                  BOOL aActiveChanged = FALSE);
    117117
    118     bool hasMatchingFilter (ComObjPtr <HostUSBDevice> &aDevice);
    119     bool hasMatchingFilter (IUSBDevice *aUSBDevice);
     118    bool hasMatchingFilter (const ComObjPtr <HostUSBDevice> &aDevice, ULONG *aMaskedIfs);
     119    bool hasMatchingFilter (IUSBDevice *aUSBDevice, ULONG *aMaskedIfs);
    120120
    121121    HRESULT notifyProxy (bool aInsertFilters);
  • trunk/src/VBox/Main/include/USBDeviceFilterImpl.h

    r4071 r5713  
    6969        typedef matching::Matchable <matching::ParsedBoolFilter> BOOLFilter;
    7070
    71         Data() : mActive (FALSE), mId (NULL) {}
     71        Data() : mActive (FALSE), mMaskedIfs (0), mId (NULL) {}
    7272#ifdef VBOX_WITH_USBFILTER
    7373        Data (const Data &aThat) : mName (aThat.mName), mActive (aThat.mActive),
    74             mRemote (aThat.mRemote), mId (NULL)
     74            mRemote (aThat.mRemote), mMaskedIfs (aThat.mMaskedIfs) , mId (aThat.mId)
    7575        {
    7676            USBFilterClone (&mUSBFilter, &aThat.mUSBFilter);
     
    9191                    mSerialNumber.string() == that. mSerialNumber.string() &&
    9292                    mPort.string() == that. mPort.string() &&
    93                     mRemote.string() == that. mRemote.string());
     93                    mRemote.string() == that. mRemote.string() &&
     94                    mMaskedIfs == that. mMaskedIfs);
    9495#else /* VBOX_WITH_USBFILTER */
    9596            return this == &that
    9697                || (    mName == that.mName
    9798                    &&  mActive == that.mActive
     99                    &&  mMaskedIfs == that.mMaskedIfs
    98100                    &&  USBFilterIsIdentical (&mUSBFilter, &that.mUSBFilter));
    99101#endif /* VBOX_WITH_USBFILTER */
     
    116118        BOOLFilter mRemote;
    117119
     120        /** Config value. */
     121        ULONG mMaskedIfs;
     122
    118123        /** Arbitrary ID field (not used by the class itself) */
    119124        void *mId;
     
    145150                  INPTR BSTR aManufacturer, INPTR BSTR aProduct,
    146151                  INPTR BSTR aSerialNumber,
    147                   INPTR BSTR aPort, INPTR BSTR aRemote);
     152                  INPTR BSTR aPort, INPTR BSTR aRemote,
     153                  ULONG aMaskedIfs);
    148154    HRESULT init (USBController *aParent, INPTR BSTR aName);
    149155    HRESULT init (USBController *aParent, USBDeviceFilter *aThat,
     
    173179    STDMETHOD(COMGETTER(Remote)) (BSTR *aRemote);
    174180    STDMETHOD(COMSETTER(Remote)) (INPTR BSTR aRemote);
     181    STDMETHOD(COMGETTER(MaskedInterfaces)) (ULONG *aMaskedIfs);
     182    STDMETHOD(COMSETTER(MaskedInterfaces)) (ULONG aMaskedIfs);
    175183
    176184    // public methods only for internal purposes
     
    290298    STDMETHOD(COMGETTER(Remote)) (BSTR *aRemote);
    291299    STDMETHOD(COMSETTER(Remote)) (INPTR BSTR aRemote);
     300    STDMETHOD(COMGETTER(MaskedInterfaces)) (ULONG *aMaskedIfs);
     301    STDMETHOD(COMSETTER(MaskedInterfaces)) (ULONG aMaskedIfs);
    292302
    293303    // IHostUSBDeviceFilter properties
  • trunk/src/VBox/Main/xml/VirtualBox-settings-common.xsd

    r5613 r5713  
    88
    99     Copyright (C) 2004-2007 innotek GmbH
    10    
     10
    1111     This file is part of VirtualBox Open Source Edition (OSE), as
    1212     available from http://www.virtualbox.org. This file is free software;
     
    302302  <xsd:attribute name="port" type="xsd:token"/>
    303303  <xsd:attribute name="remote" type="xsd:token"/>
     304  <xsd:attribute name="maskedInterfaces" type="xsd:unsignedInt"/>
    304305</xsd:complexType>
    305306
Note: See TracChangeset for help on using the changeset viewer.

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