VirtualBox

Changeset 7852 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Apr 9, 2008 5:17:24 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
29460
Message:

manual-cpp -DVBOX_WITH_USBFILTER. One worry, not sure why the Action setter call was omitted from the init. Hopefully just a left over.

Location:
trunk/src/VBox/Main
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/HostImpl.cpp

    r7847 r7852  
    10021002    {
    10031003        ComAssertRet (filter->id() == NULL, E_FAIL);
    1004 #ifndef VBOX_WITH_USBFILTER
    1005         filter->id() =
    1006             mUSBProxyService->insertFilter (ComPtr <IUSBDeviceFilter> (aFilter));
    1007 #else
    10081004        filter->id() = mUSBProxyService->insertFilter (&filter->data().mUSBFilter);
    1009 #endif
    10101005    }
    10111006
     
    10951090            {
    10961091                ComAssertRet (aFilter->id() == NULL, E_FAIL);
    1097 #ifndef VBOX_WITH_USBFILTER
    1098                 aFilter->id() =
    1099                     mUSBProxyService->insertFilter (ComPtr <IUSBDeviceFilter> (aFilter));
    1100 #else
    11011092                aFilter->id() = mUSBProxyService->insertFilter (&aFilter->data().mUSBFilter);
    1102 #endif
    11031093            }
    11041094            else
     
    11161106                ComAssertRet (aFilter->id() != NULL, E_FAIL);
    11171107                mUSBProxyService->removeFilter (aFilter->id());
    1118 #ifndef VBOX_WITH_USBFILTER
    1119                 aFilter->id() =
    1120                     mUSBProxyService->insertFilter (ComPtr <IUSBDeviceFilter> (aFilter));
    1121 #else
    11221108                aFilter->id() = mUSBProxyService->insertFilter (&aFilter->data().mUSBFilter);
    1123 #endif
    11241109            }
    11251110        }
     
    11861171        {
    11871172            HostUSBDeviceFilter *flt = filterObj; /* resolve ambiguity */
    1188 #ifndef VBOX_WITH_USBFILTER
    1189             flt->id() =
    1190                 mUSBProxyService->insertFilter (ComPtr <IUSBDeviceFilter> (flt));
    1191 #else
    11921173            flt->id() = mUSBProxyService->insertFilter (&filterObj->data().mUSBFilter);
    1193 #endif
    11941174        }
    11951175    }
     
    12241204        filter.setValue <Bstr> ("name", data.mName);
    12251205        filter.setValue <bool> ("active", !!data.mActive);
    1226 
    1227 #ifndef VBOX_WITH_USBFILTER
    1228 
    1229         /* all are optional */
    1230         if (data.mVendorId.string())
    1231             filter.setValue <Bstr> ("vendorId", data.mVendorId.string());
    1232         if (data.mProductId.string())
    1233             filter.setValue <Bstr> ("productId", data.mProductId.string());
    1234         if (data.mRevision.string())
    1235             filter.setValue <Bstr> ("revision", data.mRevision.string());
    1236         if (data.mManufacturer.string())
    1237             filter.setValue <Bstr> ("manufacturer", data.mManufacturer.string());
    1238         if (data.mProduct.string())
    1239             filter.setValue <Bstr> ("product", data.mProduct.string());
    1240         if (data.mSerialNumber.string())
    1241             filter.setValue <Bstr> ("serialNumber", data.mSerialNumber.string());
    1242         if (data.mPort.string())
    1243             filter.setValue <Bstr> ("port", data.mPort.string());
    1244 
    1245         /* action is mandatory */
    1246         if (data.mAction == USBDeviceFilterAction_Ignore)
    1247             filter.setStringValue ("action", "Ignore");
    1248         else
    1249         if (data.mAction == USBDeviceFilterAction_Hold)
    1250             filter.setStringValue ("action", "Hold");
    1251         else
    1252             AssertMsgFailed (("Invalid action: %d\n", data.mAction));
    1253 
    1254 #else  /* VBOX_WITH_USBFILTER */
    12551206
    12561207        /* all are optional */
     
    12931244        else
    12941245            AssertMsgFailed (("Invalid action: %d\n", action));
    1295 
    1296 #endif /* VBOX_WITH_USBFILTER */
    12971246
    12981247        ++ it;
     
    20882037        if (aDevice->isMatch (data))
    20892038        {
    2090 #ifndef VBOX_WITH_USBFILTER
    2091             USBDeviceFilterAction_T action = data.mAction;
    2092 #else
    20932039            USBDeviceFilterAction_T action = USBDeviceFilterAction_Null;
    20942040            (*it)->COMGETTER (Action) (&action);
    2095 #endif
    20962041            if (action == USBDeviceFilterAction_Ignore)
    20972042            {
  • trunk/src/VBox/Main/HostUSBDeviceImpl.cpp

    r7828 r7852  
    856856        return false;
    857857
    858 #ifndef VBOX_WITH_USBFILTER
    859     if (!aData.mVendorId.isMatch (mUsb->idVendor))
    860     {
    861         LogFlowThisFunc (("vendor not match %04X\n",
    862                           mUsb->idVendor));
    863         return false;
    864     }
    865     if (!aData.mProductId.isMatch (mUsb->idProduct))
    866     {
    867         LogFlowThisFunc (("product id not match %04X\n",
    868                           mUsb->idProduct));
    869         return false;
    870     }
    871     if (!aData.mRevision.isMatch (mUsb->bcdDevice))
    872     {
    873         LogFlowThisFunc (("rev not match %04X\n",
    874                           mUsb->bcdDevice));
    875         return false;
    876     }
    877 
    878 #if !defined (RT_OS_WINDOWS)
    879     // these filters are temporarily ignored on Win32
    880     if (!aData.mManufacturer.isMatch (Bstr (mUsb->pszManufacturer)))
    881         return false;
    882     if (!aData.mProduct.isMatch (Bstr (mUsb->pszProduct)))
    883         return false;
    884     if (!aData.mSerialNumber.isMatch (Bstr (mUsb->pszSerialNumber)))
    885         return false;
    886     /// @todo (dmik) pusPort is yet absent
    887 //    if (!aData.mPort.isMatch (Bstr (mUsb->pusPort)))
    888 //        return false;
    889 #endif
    890 
    891     // Host USB devices are local, so remote is always FALSE
    892     if (!aData.mRemote.isMatch (FALSE))
    893     {
    894         LogFlowMember (("Host::HostUSBDevice: remote not match FALSE\n"));
    895         return false;
    896     }
    897 
    898     /// @todo (dmik): bird, I assumed isMatch() is called only for devices
    899     //  that are suitable for holding/capturing (also assuming that when the device
    900     //  is just attached it first goes to our filter driver, and only after applying
    901     //  filters goes back to the system when appropriate). So the below
    902     //  doesn't look too correct; moreover, currently there is no determinable
    903     //  "any match" state for intervalic filters, and it will be not so easy
    904     //  to determine this state for an arbitrary regexp expression...
    905     //  For now, I just check that the string filter is empty (which doesn't
    906     //  actually reflect all possible "any match" filters).
    907     //
    908     // bird: This method was called for any device some weeks back, and it most certainly
    909     // should be called for 'busy' devices still. However, we do *not* want 'busy' devices
    910     // to match empty filters (because that will for instance capture all USB keyboards & mice).
    911     // You assumption about a filter driver is not correct on linux. We're racing with
    912     // everyone else in the system there - see your problem with usbfs access.
    913     //
    914     // The customer *requires* a way of matching all devices which the host isn't using,
    915     // if that is now difficult or the below method opens holes in the matching, this *must*
    916     // be addresses immediately.
    917 
    918     /*
    919      * If all the criteria is empty, devices which are used by the host will not match.
    920      */
    921     if (   mUsb->enmState == USBDEVICESTATE_USED_BY_HOST_CAPTURABLE
    922         && aData.mVendorId.string().isEmpty()
    923         && aData.mProductId.string().isEmpty()
    924         && aData.mRevision.string().isEmpty()
    925         && aData.mManufacturer.string().isEmpty()
    926         && aData.mProduct.string().isEmpty()
    927         && aData.mSerialNumber.string().isEmpty())
    928         return false;
    929 
    930 #else  /* VBOX_WITH_USBFILTER */
    931858    if (!USBFilterMatchDevice (&aData.mUSBFilter, mUsb))
    932859        return false;
     
    937864        &&  !USBFilterHasAnySubstatialCriteria (&aData.mUSBFilter))
    938865        return false;
    939 #endif /* VBOX_WITH_USBFILTER */
    940866
    941867    LogFlowThisFunc (("returns true\n"));
  • trunk/src/VBox/Main/Makefile.kmk

    r7850 r7852  
    120120endif
    121121ifdef VBOX_WITH_USB
    122 VBoxSVC_DEFS += VBOX_WITH_USB VBOX_WITH_USBFILTER
     122VBoxSVC_DEFS += VBOX_WITH_USB
    123123 ifdef VBOX_WITH_EHCI
    124124VBoxSVC_DEFS += VBOX_WITH_EHCI
  • trunk/src/VBox/Main/USBControllerImpl.cpp

    r7829 r7852  
    403403
    404404        ComAssertRet (filter->id() == NULL, E_FAIL);
    405 #ifndef VBOX_WITH_USBFILTER
    406         filter->id() = service->insertFilter (ComPtr <IUSBDeviceFilter> (aFilter));
    407 #else
    408405        filter->id() = service->insertFilter (&filter->data().mUSBFilter);
    409 #endif
    410406    }
    411407
     
    600596
    601597        /* all are optional */
    602 #ifndef VBOX_WITH_USBFILTER
    603 
    604         if (data.mVendorId.string())
    605             filter.setValue <Bstr> ("vendorId", data.mVendorId.string());
    606         if (data.mProductId.string())
    607             filter.setValue <Bstr> ("productId", data.mProductId.string());
    608         if (data.mRevision.string())
    609             filter.setValue <Bstr> ("revision", data.mRevision.string());
    610         if (data.mManufacturer.string())
    611             filter.setValue <Bstr> ("manufacturer", data.mManufacturer.string());
    612         if (data.mProduct.string())
    613             filter.setValue <Bstr> ("product", data.mProduct.string());
    614         if (data.mSerialNumber.string())
    615             filter.setValue <Bstr> ("serialNumber", data.mSerialNumber.string());
    616         if (data.mPort.string())
    617             filter.setValue <Bstr> ("port", data.mPort.string());
    618         if (data.mRemote.string())
    619             filter.setValue <Bstr> ("remote", data.mRemote.string());
    620 
    621 #else  /* VBOX_WITH_USBFILTER */
    622 
    623598        Bstr str;
    624599        (*it)->COMGETTER (VendorId) (str.asOutParam());
     
    652627        if (data.mRemote.string())
    653628            filter.setValue <Bstr> ("remote", data.mRemote.string());
    654 
    655 #endif /* VBOX_WITH_USBFILTER */
    656629
    657630        if (data.mMaskedIfs)
     
    828801                        USBDeviceFilter *flt = *it; /* resolve ambiguity */
    829802                        ComAssertRet (flt->id() == NULL, false);
    830 #ifndef VBOX_WITH_USBFILTER
    831                         flt->id() = service->insertFilter
    832                             (ComPtr <IUSBDeviceFilter> (flt));
    833 #else
    834803                        flt->id() = service->insertFilter (&flt->data().mUSBFilter);
    835 #endif
    836804                    }
    837805                }
     
    10561024            {
    10571025                ComAssertRet (aFilter->id() == NULL, E_FAIL);
    1058 #ifndef VBOX_WITH_USBFILTER
    1059                 aFilter->id() = service->insertFilter
    1060                     (ComPtr <IUSBDeviceFilter> (aFilter));
    1061 #else
    10621026                aFilter->id() = service->insertFilter (&aFilter->data().mUSBFilter);
    1063 #endif
    10641027            }
    10651028            else
     
    10771040                ComAssertRet (aFilter->id() != NULL, E_FAIL);
    10781041                service->removeFilter (aFilter->id());
    1079 #ifndef VBOX_WITH_USBFILTER
    1080                 aFilter->id() = service->insertFilter
    1081                     (ComPtr <IUSBDeviceFilter> (aFilter));
    1082 #else
    10831042                aFilter->id() = service->insertFilter (&aFilter->data().mUSBFilter);
    1084 #endif
    10851043            }
    10861044        }
     
    11531111
    11541112    /* query fields */
    1155 #ifdef VBOX_WITH_USBFILTER
    11561113    USBFILTER dev;
    11571114    USBFilterInit (&dev, USBFILTERTYPE_CAPTURE);
    1158 #endif
    11591115
    11601116    USHORT vendorId = 0;
     
    11621118    ComAssertComRCRet (rc, false);
    11631119    ComAssertRet (vendorId, false);
    1164 #ifdef VBOX_WITH_USBFILTER
    11651120    int vrc = USBFilterSetNumExact (&dev, USBFILTERIDX_VENDOR_ID, vendorId, true); AssertRC(vrc);
    1166 #endif
    11671121
    11681122    USHORT productId = 0;
     
    11701124    ComAssertComRCRet (rc, false);
    11711125    ComAssertRet (productId, false);
    1172 #ifdef VBOX_WITH_USBFILTER
    11731126    vrc = USBFilterSetNumExact (&dev, USBFILTERIDX_PRODUCT_ID, productId, true); AssertRC(vrc);
    1174 #endif
    11751127
    11761128    USHORT revision;
    11771129    rc = aUSBDevice->COMGETTER(Revision) (&revision);
    11781130    ComAssertComRCRet (rc, false);
    1179 #ifdef VBOX_WITH_USBFILTER
    11801131    vrc = USBFilterSetNumExact (&dev, USBFILTERIDX_DEVICE, revision, true); AssertRC(vrc);
    1181 #endif
    11821132
    11831133    Bstr manufacturer;
    11841134    rc = aUSBDevice->COMGETTER(Manufacturer) (manufacturer.asOutParam());
    11851135    ComAssertComRCRet (rc, false);
    1186 #ifdef VBOX_WITH_USBFILTER
    11871136    if (!manufacturer.isNull())
    11881137        USBFilterSetStringExact (&dev, USBFILTERIDX_MANUFACTURER_STR, Utf8Str(manufacturer), true);
    1189 #endif
    11901138
    11911139    Bstr product;
    11921140    rc = aUSBDevice->COMGETTER(Product) (product.asOutParam());
    11931141    ComAssertComRCRet (rc, false);
    1194 #ifdef VBOX_WITH_USBFILTER
    11951142    if (!product.isNull())
    11961143        USBFilterSetStringExact (&dev, USBFILTERIDX_PRODUCT_STR, Utf8Str(product), true);
    1197 #endif
    11981144
    11991145    Bstr serialNumber;
    12001146    rc = aUSBDevice->COMGETTER(SerialNumber) (serialNumber.asOutParam());
    12011147    ComAssertComRCRet (rc, false);
    1202 #ifdef VBOX_WITH_USBFILTER
    12031148    if (!serialNumber.isNull())
    12041149        USBFilterSetStringExact (&dev, USBFILTERIDX_SERIAL_NUMBER_STR, Utf8Str(serialNumber), true);
    1205 #endif
    12061150
    12071151    Bstr address;
     
    12121156    rc = aUSBDevice->COMGETTER(Port)(&port);
    12131157    ComAssertComRCRet (rc, false);
    1214 #ifdef VBOX_WITH_USBFILTER
    12151158    USBFilterSetNumExact (&dev, USBFILTERIDX_PORT, port, true);
    1216 #endif
    12171159
    12181160    BOOL remote = FALSE;
     
    12311173        const USBDeviceFilter::Data &aData = (*it)->data();
    12321174
    1233 
    12341175        if (!aData.mActive)
    12351176            continue;
    12361177        if (!aData.mRemote.isMatch (remote))
    12371178            continue;
    1238 
    1239 #ifndef VBOX_WITH_USBFILTER
    1240         if (!aData.mVendorId.isMatch (vendorId))
    1241             continue;
    1242         if (!aData.mProductId.isMatch (productId))
    1243             continue;
    1244         if (!aData.mRevision.isMatch (revision))
    1245             continue;
    1246 
    1247 # if !defined (RT_OS_WINDOWS)
    1248         /* these filters are 'temporarily' ignored on Win32 */
    1249         if (!aData.mManufacturer.isMatch (manufacturer))
    1250             continue;
    1251         if (!aData.mProduct.isMatch (product))
    1252             continue;
    1253         if (!aData.mSerialNumber.isMatch (serialNumber))
    1254             continue;
    1255         if (!aData.mPort.isMatch (port))
    1256             continue;
    1257 # endif
    1258 
    1259 #else  /* VBOX_WITH_USBFILTER */
    12601179        if (!USBFilterMatch (&aData.mUSBFilter, &dev))
    12611180            continue;
    1262 #endif /* VBOX_WITH_USBFILTER */
    12631181
    12641182        match = true;
     
    13041222            {
    13051223                AssertReturn (flt->id() == NULL, E_FAIL);
    1306 #ifndef VBOX_WITH_USBFILTER
    1307                 flt->id() = service->insertFilter
    1308                     (ComPtr <IUSBDeviceFilter> (flt));
    1309 #else
    13101224                flt->id() = service->insertFilter (&flt->data().mUSBFilter);
    1311 #endif
    13121225            }
    13131226            else
  • trunk/src/VBox/Main/USBDeviceFilterImpl.cpp

    r7836 r7852  
     1/* $Id:$ */
    12/** @file
    2  *
    33 * Implementation of VirtualBox COM components:
    44 * USBDeviceFilter and HostUSBDeviceFilter
     
    2525#include <iprt/cpputils.h>
    2626
    27 #ifdef VBOX_WITH_USBFILTER
     27
    2828////////////////////////////////////////////////////////////////////////////////
    2929// Internal Helpers
     
    141141    return S_OK;
    142142}
    143 #endif /* VBOX_WITH_USBFILTER */
    144143
    145144
     
    201200
    202201    /* initialize all filters to any match using null string */
    203 #ifndef VBOX_WITH_USBFILTER
    204     mData->mVendorId = NULL;
    205     mData->mProductId = NULL;
    206     mData->mRevision = NULL;
    207     mData->mManufacturer = NULL;
    208     mData->mProduct = NULL;
    209     mData->mSerialNumber = NULL;
    210     mData->mPort = NULL;
    211 #else  /* VBOX_WITH_USBFILTER */
    212202    USBFilterInit(&mData->mUSBFilter, USBFILTERTYPE_CAPTURE);
    213 #endif /* VBOX_WITH_USBFILTER */
    214203    mData->mRemote = NULL;
    215204
     
    279268
    280269    /* initialize all filters to any match using null string */
    281 #ifndef VBOX_WITH_USBFILTER
    282     mData->mVendorId = NULL;
    283     mData->mProductId = NULL;
    284     mData->mRevision = NULL;
    285     mData->mManufacturer = NULL;
    286     mData->mProduct = NULL;
    287     mData->mSerialNumber = NULL;
    288     mData->mPort = NULL;
    289 #else  /* VBOX_WITH_USBFILTER */
    290270    USBFilterInit (&mData->mUSBFilter, USBFILTERTYPE_CAPTURE);
    291 #endif /* VBOX_WITH_USBFILTER */
    292271    mData->mRemote = NULL;
    293272
     
    519498STDMETHODIMP USBDeviceFilter::COMGETTER(VendorId) (BSTR *aVendorId)
    520499{
    521 #ifndef VBOX_WITH_USBFILTER
    522     if (!aVendorId)
    523         return E_POINTER;
    524 
    525     AutoCaller autoCaller (this);
    526     CheckComRCReturnRC (autoCaller.rc());
    527 
    528     AutoReaderLock alock (this);
    529 
    530     mData->mVendorId.string().cloneTo (aVendorId);
    531 
    532     return S_OK;
    533 #else
    534500    return usbFilterFieldGetter (USBFILTERIDX_VENDOR_ID, aVendorId);
    535 #endif
    536501}
    537502
    538503STDMETHODIMP USBDeviceFilter::COMSETTER(VendorId) (INPTR BSTR aVendorId)
    539504{
    540 #ifndef VBOX_WITH_USBFILTER
    541     AutoCaller autoCaller (this);
    542     CheckComRCReturnRC (autoCaller.rc());
    543 
    544     /* the machine needs to be mutable */
    545     Machine::AutoMutableStateDependency adep (mParent->parent());
    546     CheckComRCReturnRC (adep.rc());
    547 
    548     AutoLock alock (this);
    549 
    550     if (mData->mVendorId.string() != aVendorId)
    551     {
    552         Data::USHORTFilter flt = aVendorId;
    553         ComAssertRet (!flt.isNull(), E_FAIL);
    554         if (!flt.isValid())
    555             return setError (E_INVALIDARG,
    556                 tr ("Vendor ID filter string '%ls' is not valid (error at position %d)"),
    557                 aVendorId, flt.errorPosition() + 1);
    558 #if defined (RT_OS_WINDOWS)
    559         // intervalic filters are temporarily disabled
    560         if (!flt.first().isNull() && flt.first().isValid())
    561             return setError (E_INVALIDARG,
    562                 tr ("'%ls': Intervalic filters are not currently available on this platform"),
    563                 aVendorId);
    564 #endif
    565 
    566         mData.backup();
    567         mData->mVendorId = flt;
    568 
    569         /* leave the lock before informing callbacks */
    570         alock.unlock();
    571 
    572         return mParent->onDeviceFilterChange (this);
    573     }
    574 
    575     return S_OK;
    576 #else  /* VBOX_WITH_USBFILTER */
    577505    return usbFilterFieldSetter (USBFILTERIDX_VENDOR_ID, aVendorId, tr ("Vendor ID"));
    578 #endif /* VBOX_WITH_USBFILTER */
    579506}
    580507
    581508STDMETHODIMP USBDeviceFilter::COMGETTER(ProductId) (BSTR *aProductId)
    582509{
    583 #ifndef VBOX_WITH_USBFILTER
    584     if (!aProductId)
    585         return E_POINTER;
    586 
    587     AutoCaller autoCaller (this);
    588     CheckComRCReturnRC (autoCaller.rc());
    589 
    590     AutoReaderLock alock (this);
    591 
    592     mData->mProductId.string().cloneTo (aProductId);
    593 
    594     return S_OK;
    595 #else
    596510    return usbFilterFieldGetter (USBFILTERIDX_PRODUCT_ID, aProductId);
    597 #endif
    598511}
    599512
    600513STDMETHODIMP USBDeviceFilter::COMSETTER(ProductId) (INPTR BSTR aProductId)
    601514{
    602 #ifndef VBOX_WITH_USBFILTER
    603     AutoCaller autoCaller (this);
    604     CheckComRCReturnRC (autoCaller.rc());
    605 
    606     /* the machine needs to be mutable */
    607     Machine::AutoMutableStateDependency adep (mParent->parent());
    608     CheckComRCReturnRC (adep.rc());
    609 
    610     AutoLock alock (this);
    611 
    612     if (mData->mProductId.string() != aProductId)
    613     {
    614         Data::USHORTFilter flt = aProductId;
    615         ComAssertRet (!flt.isNull(), E_FAIL);
    616         if (!flt.isValid())
    617             return setError (E_INVALIDARG,
    618                 tr ("Product ID filter string '%ls' is not valid (error at position %d)"),
    619                 aProductId, flt.errorPosition() + 1);
    620 #if defined (RT_OS_WINDOWS)
    621         // intervalic filters are temporarily disabled
    622         if (!flt.first().isNull() && flt.first().isValid())
    623             return setError (E_INVALIDARG,
    624                 tr ("'%ls': Intervalic filters are not currently available on this platform"),
    625                 aProductId);
    626 #endif
    627 
    628         mData.backup();
    629         mData->mProductId = flt;
    630 
    631         /* leave the lock before informing callbacks */
    632         alock.unlock();
    633 
    634         return mParent->onDeviceFilterChange (this);
    635     }
    636 
    637     return S_OK;
    638 #else  /* VBOX_WITH_USBFILTER */
    639515    return usbFilterFieldSetter (USBFILTERIDX_PRODUCT_ID, aProductId, tr ("Product ID"));
    640 #endif /* VBOX_WITH_USBFILTER */
    641516 }
    642517
    643518STDMETHODIMP USBDeviceFilter::COMGETTER(Revision) (BSTR *aRevision)
    644519{
    645 #ifndef VBOX_WITH_USBFILTER
    646     if (!aRevision)
    647         return E_POINTER;
    648 
    649     AutoCaller autoCaller (this);
    650     CheckComRCReturnRC (autoCaller.rc());
    651 
    652     AutoReaderLock alock (this);
    653 
    654     mData->mRevision.string().cloneTo (aRevision);
    655 
    656     return S_OK;
    657 #else
    658520    return usbFilterFieldGetter (USBFILTERIDX_DEVICE, aRevision);
    659 #endif
    660521}
    661522
    662523STDMETHODIMP USBDeviceFilter::COMSETTER(Revision) (INPTR BSTR aRevision)
    663524{
    664 #ifndef VBOX_WITH_USBFILTER
    665     AutoCaller autoCaller (this);
    666     CheckComRCReturnRC (autoCaller.rc());
    667 
    668     /* the machine needs to be mutable */
    669     Machine::AutoMutableStateDependency adep (mParent->parent());
    670     CheckComRCReturnRC (adep.rc());
    671 
    672     AutoLock alock (this);
    673 
    674     if (mData->mRevision.string() != aRevision)
    675     {
    676         Data::USHORTFilter flt = aRevision;
    677         ComAssertRet (!flt.isNull(), E_FAIL);
    678         if (!flt.isValid())
    679             return setError (E_INVALIDARG,
    680                 tr ("Revision filter string '%ls' is not valid (error at position %d)"),
    681                 aRevision, flt.errorPosition() + 1);
    682 #if defined (RT_OS_WINDOWS)
    683         // intervalic filters are temporarily disabled
    684         if (!flt.first().isNull() && flt.first().isValid())
    685             return setError (E_INVALIDARG,
    686                 tr ("'%ls': Intervalic filters are not currently available on this platform"),
    687                 aRevision);
    688 #endif
    689 
    690         mData.backup();
    691         mData->mRevision = flt;
    692 
    693         /* leave the lock before informing callbacks */
    694         alock.unlock();
    695 
    696         return mParent->onDeviceFilterChange (this);
    697     }
    698 
    699     return S_OK;
    700 #else  /* VBOX_WITH_USBFILTER */
    701525    return usbFilterFieldSetter (USBFILTERIDX_DEVICE, aRevision, tr ("Revision"));
    702 #endif /* VBOX_WITH_USBFILTER */
    703526}
    704527
    705528STDMETHODIMP USBDeviceFilter::COMGETTER(Manufacturer) (BSTR *aManufacturer)
    706529{
    707 #ifndef VBOX_WITH_USBFILTER
    708     if (!aManufacturer)
    709         return E_POINTER;
    710 
    711     AutoCaller autoCaller (this);
    712     CheckComRCReturnRC (autoCaller.rc());
    713 
    714     AutoReaderLock alock (this);
    715 
    716     mData->mManufacturer.string().cloneTo (aManufacturer);
    717 
    718     return S_OK;
    719 #else
    720530    return usbFilterFieldGetter (USBFILTERIDX_MANUFACTURER_STR, aManufacturer);
    721 #endif
    722531}
    723532
    724533STDMETHODIMP USBDeviceFilter::COMSETTER(Manufacturer) (INPTR BSTR aManufacturer)
    725534{
    726 #ifndef VBOX_WITH_USBFILTER
    727     AutoCaller autoCaller (this);
    728     CheckComRCReturnRC (autoCaller.rc());
    729 
    730     /* the machine needs to be mutable */
    731     Machine::AutoMutableStateDependency adep (mParent->parent());
    732     CheckComRCReturnRC (adep.rc());
    733 
    734     AutoLock alock (this);
    735 
    736     if (mData->mManufacturer.string() != aManufacturer)
    737     {
    738         Data::BstrFilter flt = aManufacturer;
    739         ComAssertRet (!flt.isNull(), E_FAIL);
    740         if (!flt.isValid())
    741             return setError (E_INVALIDARG,
    742                 tr ("Manufacturer filter string '%ls' is not valid (error at position %d)"),
    743                 aManufacturer, flt.errorPosition() + 1);
    744 
    745         mData.backup();
    746         mData->mManufacturer = flt;
    747 
    748         /* leave the lock before informing callbacks */
    749         alock.unlock();
    750 
    751         return mParent->onDeviceFilterChange (this);
    752     }
    753 
    754     return S_OK;
    755 #else  /* VBOX_WITH_USBFILTER */
    756535    return usbFilterFieldSetter (USBFILTERIDX_MANUFACTURER_STR, aManufacturer, tr ("Manufacturer"));
    757 #endif /* VBOX_WITH_USBFILTER */
    758536}
    759537
    760538STDMETHODIMP USBDeviceFilter::COMGETTER(Product) (BSTR *aProduct)
    761539{
    762 #ifndef VBOX_WITH_USBFILTER
    763     if (!aProduct)
    764         return E_POINTER;
    765 
    766     AutoCaller autoCaller (this);
    767     CheckComRCReturnRC (autoCaller.rc());
    768 
    769     AutoReaderLock alock (this);
    770 
    771     mData->mProduct.string().cloneTo (aProduct);
    772 
    773     return S_OK;
    774 #else
    775540    return usbFilterFieldGetter (USBFILTERIDX_PRODUCT_STR, aProduct);
    776 #endif
    777541}
    778542
    779543STDMETHODIMP USBDeviceFilter::COMSETTER(Product) (INPTR BSTR aProduct)
    780544{
    781 #ifndef VBOX_WITH_USBFILTER
    782     AutoCaller autoCaller (this);
    783     CheckComRCReturnRC (autoCaller.rc());
    784 
    785     /* the machine needs to be mutable */
    786     Machine::AutoMutableStateDependency adep (mParent->parent());
    787     CheckComRCReturnRC (adep.rc());
    788 
    789     AutoLock alock (this);
    790 
    791     if (mData->mProduct.string() != aProduct)
    792     {
    793         Data::BstrFilter flt = aProduct;
    794         ComAssertRet (!flt.isNull(), E_FAIL);
    795         if (!flt.isValid())
    796             return setError (E_INVALIDARG,
    797                 tr ("Product filter string '%ls' is not valid (error at position %d)"),
    798                 aProduct, flt.errorPosition() + 1);
    799 
    800         mData.backup();
    801         mData->mProduct = flt;
    802 
    803         /* leave the lock before informing callbacks */
    804         alock.unlock();
    805 
    806         return mParent->onDeviceFilterChange (this);
    807     }
    808 
    809     return S_OK;
    810 #else  /* VBOX_WITH_USBFILTER */
    811545    return usbFilterFieldSetter (USBFILTERIDX_PRODUCT_STR, aProduct, tr ("Product"));
    812 #endif /* VBOX_WITH_USBFILTER */
    813546}
    814547
    815548STDMETHODIMP USBDeviceFilter::COMGETTER(SerialNumber) (BSTR *aSerialNumber)
    816549{
    817 #ifndef VBOX_WITH_USBFILTER
    818     if (!aSerialNumber)
    819         return E_POINTER;
    820 
    821     AutoCaller autoCaller (this);
    822     CheckComRCReturnRC (autoCaller.rc());
    823 
    824     AutoReaderLock alock (this);
    825 
    826     mData->mSerialNumber.string().cloneTo (aSerialNumber);
    827 
    828     return S_OK;
    829 #else
    830550    return usbFilterFieldGetter (USBFILTERIDX_SERIAL_NUMBER_STR, aSerialNumber);
    831 #endif
    832551}
    833552
    834553STDMETHODIMP USBDeviceFilter::COMSETTER(SerialNumber) (INPTR BSTR aSerialNumber)
    835554{
    836 #ifndef VBOX_WITH_USBFILTER
    837     AutoCaller autoCaller (this);
    838     CheckComRCReturnRC (autoCaller.rc());
    839 
    840     /* the machine needs to be mutable */
    841     Machine::AutoMutableStateDependency adep (mParent->parent());
    842     CheckComRCReturnRC (adep.rc());
    843 
    844     AutoLock alock (this);
    845 
    846     if (mData->mSerialNumber.string() != aSerialNumber)
    847     {
    848         Data::BstrFilter flt = aSerialNumber;
    849         ComAssertRet (!flt.isNull(), E_FAIL);
    850         if (!flt.isValid())
    851             return setError (E_INVALIDARG,
    852                 tr ("Serial number filter string '%ls' is not valid (error at position %d)"),
    853                 aSerialNumber, flt.errorPosition() + 1);
    854 
    855         mData.backup();
    856         mData->mSerialNumber = flt;
    857 
    858         /* leave the lock before informing callbacks */
    859         alock.unlock();
    860 
    861         return mParent->onDeviceFilterChange (this);
    862     }
    863 
    864     return S_OK;
    865 #else  /* VBOX_WITH_USBFILTER */
    866555    return usbFilterFieldSetter (USBFILTERIDX_SERIAL_NUMBER_STR, aSerialNumber, tr ("Serial number"));
    867 #endif /* VBOX_WITH_USBFILTER */
    868556}
    869557
    870558STDMETHODIMP USBDeviceFilter::COMGETTER(Port) (BSTR *aPort)
    871559{
    872 #ifndef VBOX_WITH_USBFILTER
    873     if (!aPort)
    874         return E_POINTER;
    875 
    876     AutoCaller autoCaller (this);
    877     CheckComRCReturnRC (autoCaller.rc());
    878 
    879     AutoReaderLock alock (this);
    880 
    881     mData->mPort.string().cloneTo (aPort);
    882 
    883     return S_OK;
    884 #else
    885560    return usbFilterFieldGetter (USBFILTERIDX_PORT, aPort);
    886 #endif
    887561}
    888562
    889563STDMETHODIMP USBDeviceFilter::COMSETTER(Port) (INPTR BSTR aPort)
    890564{
    891 #ifndef VBOX_WITH_USBFILTER
    892     AutoCaller autoCaller (this);
    893     CheckComRCReturnRC (autoCaller.rc());
    894 
    895     /* the machine needs to be mutable */
    896     Machine::AutoMutableStateDependency adep (mParent->parent());
    897     CheckComRCReturnRC (adep.rc());
    898 
    899     AutoLock alock (this);
    900 
    901     if (mData->mPort.string() != aPort)
    902     {
    903         Data::USHORTFilter flt = aPort;
    904         ComAssertRet (!flt.isNull(), E_FAIL);
    905         if (!flt.isValid())
    906             return setError (E_INVALIDARG,
    907                 tr ("Port number filter string '%ls' is not valid (error at position %d)"),
    908                 aPort, flt.errorPosition() + 1);
    909 #if defined (RT_OS_WINDOWS)
    910         // intervalic filters are temporarily disabled
    911         if (!flt.first().isNull() && flt.first().isValid())
    912             return setError (E_INVALIDARG,
    913                 tr ("'%ls': Intervalic filters are not currently available on this platform"),
    914                 aPort);
    915 #endif
    916 
    917         mData.backup();
    918         mData->mPort = flt;
    919 
    920         /* leave the lock before informing callbacks */
    921         alock.unlock();
    922 
    923         return mParent->onDeviceFilterChange (this);
    924     }
    925 
    926     return S_OK;
    927 #else  /* VBOX_WITH_USBFILTER */
    928565    return usbFilterFieldSetter (USBFILTERIDX_PORT, aPort, tr ("Port number"));
    929 #endif /* VBOX_WITH_USBFILTER */
    930566}
    931567
     
    1104740}
    1105741
    1106 #ifdef VBOX_WITH_USBFILTER
    1107742/**
    1108743 *  Generic USB filter field getter.
     
    1170805    return S_OK;
    1171806}
    1172 #endif /* VBOX_WITH_USBFILTER */
     807
    1173808
    1174809////////////////////////////////////////////////////////////////////////////////
     
    1225860    mData->mName = aName;
    1226861    mData->mActive = aActive;
    1227 #ifndef VBOX_WITH_USBFILTER
    1228     mData->mAction = aAction;
    1229 
    1230     /* initialize all filters to any match using null string */
    1231     mData->mVendorId = NULL;
    1232     mData->mProductId = NULL;
    1233     mData->mRevision = NULL;
    1234     mData->mManufacturer = NULL;
    1235     mData->mProduct = NULL;
    1236     mData->mSerialNumber = NULL;
    1237     mData->mPort = NULL;
    1238 #else  /* VBOX_WITH_USBFILTER */
    1239862    USBFilterInit (&mData->mUSBFilter, USBFILTERTYPE_IGNORE);
    1240 #endif /* VBOX_WITH_USBFILTER */
    1241863    mData->mRemote = NULL;
    1242864    mData->mMaskedIfs = 0;
     
    1250872    do
    1251873    {
    1252 #ifndef VBOX_WITH_USBFILTER
    1253874        rc = COMSETTER(Action) (aAction);
    1254875        CheckComRCBreakRC (rc);
    1255 #endif /* VBOX_WITH_USBFILTER */
    1256876        rc = COMSETTER(VendorId) (aVendorId);
    1257877        CheckComRCBreakRC (rc);
     
    1303923    mData->mName = aName;
    1304924    mData->mActive = FALSE;
    1305 #ifndef VBOX_WITH_USBFILTER
    1306     mData->mAction = USBDeviceFilterAction_Ignore;
    1307 #endif /* !VBOX_WITH_USBFILTER */
    1308 
    1309925    mInList = false;
    1310 
    1311 #ifndef VBOX_WITH_USBFILTER
    1312     /* initialize all filters to any match using null string */
    1313     mData->mVendorId = NULL;
    1314     mData->mProductId = NULL;
    1315     mData->mRevision = NULL;
    1316     mData->mManufacturer = NULL;
    1317     mData->mProduct = NULL;
    1318     mData->mSerialNumber = NULL;
    1319     mData->mPort = NULL;
    1320 #else  /* VBOX_WITH_USBFILTER */
    1321926    USBFilterInit (&mData->mUSBFilter, USBFILTERTYPE_IGNORE);
    1322 #endif /* VBOX_WITH_USBFILTER */
    1323927    mData->mRemote = NULL;
    1324928    mData->mMaskedIfs = 0;
     
    14301034STDMETHODIMP HostUSBDeviceFilter::COMGETTER(VendorId) (BSTR *aVendorId)
    14311035{
    1432 #ifndef VBOX_WITH_USBFILTER
    1433     if (!aVendorId)
    1434         return E_POINTER;
    1435 
    1436     AutoCaller autoCaller (this);
    1437     CheckComRCReturnRC (autoCaller.rc());
    1438 
    1439     AutoReaderLock alock (this);
    1440 
    1441     mData->mVendorId.string().cloneTo (aVendorId);
    1442 
    1443     return S_OK;
    1444 #else
    14451036    return usbFilterFieldGetter (USBFILTERIDX_VENDOR_ID, aVendorId);
    1446 #endif
    14471037}
    14481038
    14491039STDMETHODIMP HostUSBDeviceFilter::COMSETTER(VendorId) (INPTR BSTR aVendorId)
    14501040{
    1451 #ifndef VBOX_WITH_USBFILTER
    1452     AutoCaller autoCaller (this);
    1453     CheckComRCReturnRC (autoCaller.rc());
    1454 
    1455     AutoLock alock (this);
    1456 
    1457     if (mData->mVendorId.string() != aVendorId)
    1458     {
    1459         Data::USHORTFilter flt = aVendorId;
    1460         ComAssertRet (!flt.isNull(), E_FAIL);
    1461         if (!flt.isValid())
    1462             return setError (E_INVALIDARG,
    1463                 tr ("Vendor ID filter string '%ls' is not valid (error at position %d)"),
    1464                 aVendorId, flt.errorPosition() + 1);
    1465 #if defined (RT_OS_WINDOWS)
    1466         // intervalic filters are temporarily disabled
    1467         if (!flt.first().isNull() && flt.first().isValid())
    1468             return setError (E_INVALIDARG,
    1469                 tr ("'%ls': Intervalic filters are not currently available on this platform"),
    1470                 aVendorId);
    1471 #endif
    1472 
    1473         mData->mVendorId = flt;
    1474 
    1475         /* leave the lock before informing callbacks */
    1476         alock.unlock();
    1477 
    1478         return mParent->onUSBDeviceFilterChange (this);
    1479     }
    1480 
    1481     return S_OK;
    1482 #else  /* VBOX_WITH_USBFILTER */
    14831041    return usbFilterFieldSetter (USBFILTERIDX_VENDOR_ID, aVendorId, tr ("Vendor ID"));
    1484 #endif /* VBOX_WITH_USBFILTER */
    14851042}
    14861043
    14871044STDMETHODIMP HostUSBDeviceFilter::COMGETTER(ProductId) (BSTR *aProductId)
    14881045{
    1489 #ifndef VBOX_WITH_USBFILTER
    1490     if (!aProductId)
    1491         return E_POINTER;
    1492 
    1493     AutoCaller autoCaller (this);
    1494     CheckComRCReturnRC (autoCaller.rc());
    1495 
    1496     AutoReaderLock alock (this);
    1497 
    1498     mData->mProductId.string().cloneTo (aProductId);
    1499 
    1500     return S_OK;
    1501 #else
    15021046    return usbFilterFieldGetter (USBFILTERIDX_PRODUCT_ID, aProductId);
    1503 #endif
    15041047}
    15051048
    15061049STDMETHODIMP HostUSBDeviceFilter::COMSETTER(ProductId) (INPTR BSTR aProductId)
    15071050{
    1508 #ifndef VBOX_WITH_USBFILTER
    1509     AutoCaller autoCaller (this);
    1510     CheckComRCReturnRC (autoCaller.rc());
    1511 
    1512     AutoLock alock (this);
    1513 
    1514     if (mData->mProductId.string() != aProductId)
    1515     {
    1516         Data::USHORTFilter flt = aProductId;
    1517         ComAssertRet (!flt.isNull(), E_FAIL);
    1518         if (!flt.isValid())
    1519             return setError (E_INVALIDARG,
    1520                 tr ("Product ID filter string '%ls' is not valid (error at position %d)"),
    1521                 aProductId, flt.errorPosition() + 1);
    1522 #if defined (RT_OS_WINDOWS)
    1523         // intervalic filters are temporarily disabled
    1524         if (!flt.first().isNull() && flt.first().isValid())
    1525             return setError (E_INVALIDARG,
    1526                 tr ("'%ls': Intervalic filters are not currently available on this platform"),
    1527                 aProductId);
    1528 #endif
    1529 
    1530         mData->mProductId = flt;
    1531 
    1532         /* leave the lock before informing callbacks */
    1533         alock.unlock();
    1534 
    1535         return mParent->onUSBDeviceFilterChange (this);
    1536     }
    1537 
    1538     return S_OK;
    1539 #else  /* VBOX_WITH_USBFILTER */
    15401051    return usbFilterFieldSetter (USBFILTERIDX_PRODUCT_ID, aProductId, tr ("Product ID"));
    1541 #endif /* VBOX_WITH_USBFILTER */
    15421052}
    15431053
    15441054STDMETHODIMP HostUSBDeviceFilter::COMGETTER(Revision) (BSTR *aRevision)
    15451055{
    1546 #ifndef VBOX_WITH_USBFILTER
    1547     if (!aRevision)
    1548         return E_POINTER;
    1549 
    1550     AutoCaller autoCaller (this);
    1551     CheckComRCReturnRC (autoCaller.rc());
    1552 
    1553     AutoReaderLock alock (this);
    1554 
    1555     mData->mRevision.string().cloneTo (aRevision);
    1556 
    1557     return S_OK;
    1558 #else
    15591056    return usbFilterFieldGetter (USBFILTERIDX_DEVICE, aRevision);
    1560 #endif
    15611057}
    15621058
    15631059STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Revision) (INPTR BSTR aRevision)
    15641060{
    1565 #ifndef VBOX_WITH_USBFILTER
    1566     AutoCaller autoCaller (this);
    1567     CheckComRCReturnRC (autoCaller.rc());
    1568 
    1569     AutoLock alock (this);
    1570 
    1571     if (mData->mRevision.string() != aRevision)
    1572     {
    1573         Data::USHORTFilter flt = aRevision;
    1574         ComAssertRet (!flt.isNull(), E_FAIL);
    1575         if (!flt.isValid())
    1576             return setError (E_INVALIDARG,
    1577                 tr ("Revision filter string '%ls' is not valid (error at position %d)"),
    1578                 aRevision, flt.errorPosition() + 1);
    1579 #if defined (RT_OS_WINDOWS)
    1580         // intervalic filters are temporarily disabled
    1581         if (!flt.first().isNull() && flt.first().isValid())
    1582             return setError (E_INVALIDARG,
    1583                 tr ("'%ls': Intervalic filters are not currently available on this platform"),
    1584                 aRevision);
    1585 #endif
    1586 
    1587         mData->mRevision = flt;
    1588 
    1589         /* leave the lock before informing callbacks */
    1590         alock.unlock();
    1591 
    1592         return mParent->onUSBDeviceFilterChange (this);
    1593     }
    1594 
    1595     return S_OK;
    1596 #else  /* VBOX_WITH_USBFILTER */
    15971061    return usbFilterFieldSetter (USBFILTERIDX_DEVICE, aRevision, tr ("Revision"));
    1598 #endif /* VBOX_WITH_USBFILTER */
    15991062}
    16001063
    16011064STDMETHODIMP HostUSBDeviceFilter::COMGETTER(Manufacturer) (BSTR *aManufacturer)
    16021065{
    1603 #ifndef VBOX_WITH_USBFILTER
    1604     if (!aManufacturer)
    1605         return E_POINTER;
    1606 
    1607     AutoCaller autoCaller (this);
    1608     CheckComRCReturnRC (autoCaller.rc());
    1609 
    1610     AutoReaderLock alock (this);
    1611 
    1612     mData->mManufacturer.string().cloneTo (aManufacturer);
    1613 
    1614     return S_OK;
    1615 #else
    16161066    return usbFilterFieldGetter (USBFILTERIDX_MANUFACTURER_STR, aManufacturer);
    1617 #endif
    16181067}
    16191068
    16201069STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Manufacturer) (INPTR BSTR aManufacturer)
    16211070{
    1622 #ifndef VBOX_WITH_USBFILTER
    1623     AutoCaller autoCaller (this);
    1624     CheckComRCReturnRC (autoCaller.rc());
    1625 
    1626     AutoLock alock (this);
    1627 
    1628     if (mData->mManufacturer.string() != aManufacturer)
    1629     {
    1630         Data::BstrFilter flt = aManufacturer;
    1631         ComAssertRet (!flt.isNull(), E_FAIL);
    1632         if (!flt.isValid())
    1633             return setError (E_INVALIDARG,
    1634                 tr ("Manufacturer filter string '%ls' is not valid (error at position %d)"),
    1635                 aManufacturer, flt.errorPosition() + 1);
    1636 
    1637         mData->mManufacturer = flt;
    1638 
    1639         /* leave the lock before informing callbacks */
    1640         alock.unlock();
    1641 
    1642         return mParent->onUSBDeviceFilterChange (this);
    1643     }
    1644 
    1645     return S_OK;
    1646 #else  /* VBOX_WITH_USBFILTER */
    16471071    return usbFilterFieldSetter (USBFILTERIDX_MANUFACTURER_STR, aManufacturer, tr ("Manufacturer"));
    1648 #endif /* VBOX_WITH_USBFILTER */
    16491072}
    16501073
    16511074STDMETHODIMP HostUSBDeviceFilter::COMGETTER(Product) (BSTR *aProduct)
    16521075{
    1653 #ifndef VBOX_WITH_USBFILTER
    1654     if (!aProduct)
    1655         return E_POINTER;
    1656 
    1657     AutoCaller autoCaller (this);
    1658     CheckComRCReturnRC (autoCaller.rc());
    1659 
    1660     AutoReaderLock alock (this);
    1661 
    1662     mData->mProduct.string().cloneTo (aProduct);
    1663 
    1664     return S_OK;
    1665 #else
    16661076    return usbFilterFieldGetter (USBFILTERIDX_PRODUCT_STR, aProduct);
    1667 #endif
    16681077}
    16691078
    16701079STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Product) (INPTR BSTR aProduct)
    16711080{
    1672 #ifndef VBOX_WITH_USBFILTER
    1673     AutoCaller autoCaller (this);
    1674     CheckComRCReturnRC (autoCaller.rc());
    1675 
    1676     AutoLock alock (this);
    1677 
    1678     if (mData->mProduct.string() != aProduct)
    1679     {
    1680         Data::BstrFilter flt = aProduct;
    1681         ComAssertRet (!flt.isNull(), E_FAIL);
    1682         if (!flt.isValid())
    1683             return setError (E_INVALIDARG,
    1684                 tr ("Product filter string '%ls' is not valid (error at position %d)"),
    1685                 aProduct, flt.errorPosition() + 1);
    1686 
    1687         mData->mProduct = flt;
    1688 
    1689         /* leave the lock before informing callbacks */
    1690         alock.unlock();
    1691 
    1692         return mParent->onUSBDeviceFilterChange (this);
    1693     }
    1694 
    1695     return S_OK;
    1696 #else  /* VBOX_WITH_USBFILTER */
    16971081    return usbFilterFieldSetter (USBFILTERIDX_PRODUCT_STR, aProduct, tr ("Product"));
    1698 #endif /* VBOX_WITH_USBFILTER */
    16991082}
    17001083
    17011084STDMETHODIMP HostUSBDeviceFilter::COMGETTER(SerialNumber) (BSTR *aSerialNumber)
    17021085{
    1703 #ifndef VBOX_WITH_USBFILTER
    1704     if (!aSerialNumber)
    1705         return E_POINTER;
    1706 
    1707     AutoCaller autoCaller (this);
    1708     CheckComRCReturnRC (autoCaller.rc());
    1709 
    1710     AutoReaderLock alock (this);
    1711 
    1712     mData->mSerialNumber.string().cloneTo (aSerialNumber);
    1713 
    1714     return S_OK;
    1715 #else   /* VBOX_WITH_USBFILTER */
    17161086    return usbFilterFieldGetter (USBFILTERIDX_SERIAL_NUMBER_STR, aSerialNumber);
    1717 #endif  /* VBOX_WITH_USBFILTER */
    17181087}
    17191088
    17201089STDMETHODIMP HostUSBDeviceFilter::COMSETTER(SerialNumber) (INPTR BSTR aSerialNumber)
    17211090{
    1722 #ifndef VBOX_WITH_USBFILTER
    1723     AutoCaller autoCaller (this);
    1724     CheckComRCReturnRC (autoCaller.rc());
    1725 
    1726     AutoLock alock (this);
    1727 
    1728     if (mData->mSerialNumber.string() != aSerialNumber)
    1729     {
    1730         Data::BstrFilter flt = aSerialNumber;
    1731         ComAssertRet (!flt.isNull(), E_FAIL);
    1732         if (!flt.isValid())
    1733             return setError (E_INVALIDARG,
    1734                 tr ("Serial number filter string '%ls' is not valid (error at position %d)"),
    1735                 aSerialNumber, flt.errorPosition() + 1);
    1736 
    1737         mData->mSerialNumber = flt;
    1738 
    1739         /* leave the lock before informing callbacks */
    1740         alock.unlock();
    1741 
    1742         return mParent->onUSBDeviceFilterChange (this);
    1743     }
    1744 
    1745     return S_OK;
    1746 #else  /* VBOX_WITH_USBFILTER */
    17471091    return usbFilterFieldSetter (USBFILTERIDX_SERIAL_NUMBER_STR, aSerialNumber, tr ("Serial number"));
    1748 #endif /* VBOX_WITH_USBFILTER */
    17491092}
    17501093
    17511094STDMETHODIMP HostUSBDeviceFilter::COMGETTER(Port) (BSTR *aPort)
    17521095{
    1753 #ifndef VBOX_WITH_USBFILTER
    1754     if (!aPort)
    1755         return E_POINTER;
    1756 
    1757     AutoCaller autoCaller (this);
    1758     CheckComRCReturnRC (autoCaller.rc());
    1759 
    1760     AutoReaderLock alock (this);
    1761 
    1762     mData->mPort.string().cloneTo (aPort);
    1763 
    1764     return S_OK;
    1765 #else  /* VBOX_WITH_USBFILTER */
    17661096    return usbFilterFieldGetter (USBFILTERIDX_PORT, aPort);
    1767 #endif  /* VBOX_WITH_USBFILTER */
    17681097}
    17691098
    17701099STDMETHODIMP HostUSBDeviceFilter::COMSETTER(Port) (INPTR BSTR aPort)
    17711100{
    1772 #ifndef VBOX_WITH_USBFILTER
    1773     AutoCaller autoCaller (this);
    1774     CheckComRCReturnRC (autoCaller.rc());
    1775 
    1776     AutoLock alock (this);
    1777 
    1778     if (mData->mPort.string() != aPort)
    1779     {
    1780         Data::USHORTFilter flt = aPort;
    1781         ComAssertRet (!flt.isNull(), E_FAIL);
    1782         if (!flt.isValid())
    1783             return setError (E_INVALIDARG,
    1784                 tr ("Port number filter string '%ls' is not valid (error at position %d)"),
    1785                 aPort, flt.errorPosition() + 1);
    1786 #if defined (RT_OS_WINDOWS)
    1787         // intervalic filters are temporarily disabled
    1788         if (!flt.first().isNull() && flt.first().isValid())
    1789             return setError (E_INVALIDARG,
    1790                 tr ("'%ls': Intervalic filters are not currently available on this platform"),
    1791                 aPort);
    1792 #endif
    1793 
    1794         mData->mPort = flt;
    1795 
    1796         /* leave the lock before informing callbacks */
    1797         alock.unlock();
    1798 
    1799         return mParent->onUSBDeviceFilterChange (this);
    1800     }
    1801 
    1802     return S_OK;
    1803 #else  /* VBOX_WITH_USBFILTER */
    18041101    return usbFilterFieldSetter (USBFILTERIDX_PORT, aPort, tr ("Port number"));
    1805 #endif /* VBOX_WITH_USBFILTER */
    18061102}
    18071103
     
    18621158    AutoReaderLock alock (this);
    18631159
    1864 #ifndef VBOX_WITH_USBFILTER
    1865     *aAction = mData->mAction;
    1866 #else   /* VBOX_WITH_USBFILTER */
    18671160    switch (USBFilterGetFilterType (&mData->mUSBFilter))
    18681161    {
     
    18711164        default:                     *aAction = USBDeviceFilterAction_Null; break;
    18721165    }
    1873 #endif  /* VBOX_WITH_USBFILTER */
    18741166
    18751167    return S_OK;
     
    18831175    AutoLock alock (this);
    18841176
    1885 #ifndef VBOX_WITH_USBFILTER
    1886     if (mData->mAction != aAction)
    1887     {
    1888         mData->mAction = aAction;
    1889 
    1890         /* leave the lock before informing callbacks */
    1891         alock.unlock();
    1892 
    1893         return mParent->onUSBDeviceFilterChange (this);
    1894     }
    1895 
    1896 #else   /* VBOX_WITH_USBFILTER */
    18971177    USBFILTERTYPE filterType;
    18981178    switch (aAction)
     
    19211201        return mParent->onUSBDeviceFilterChange (this);
    19221202    }
    1923 #endif  /* VBOX_WITH_USBFILTER */
    1924 
    1925     return S_OK;
    1926 }
    1927 
    1928 
    1929 #ifdef VBOX_WITH_USBFILTER
     1203
     1204    return S_OK;
     1205}
     1206
    19301207/**
    19311208 *  Generic USB filter field getter.
     
    19501227    return S_OK;
    19511228}
    1952 
    19531229
    19541230/**
     
    19901266    return S_OK;
    19911267}
    1992 #endif /* VBOX_WITH_USBFILTER */
    1993 
     1268
  • trunk/src/VBox/Main/USBProxyService.cpp

    r7207 r7852  
    463463
    464464
    465 #ifdef VBOX_WITH_USBFILTER
    466465/*static*/ void USBProxyService::initFilterFromDevice (PUSBFILTER aFilter, HostUSBDevice *aDevice)
    467466{
     
    493492    }
    494493}
    495 #endif /* VBOX_WITH_USBFILTER */
    496494
    497495
     
    579577 *  for those subclasses that don't reimplement this method.
    580578 */
    581 #ifndef VBOX_WITH_USBFILTER
    582 void *USBProxyService::insertFilter (IUSBDeviceFilter * /* aFilter */)
    583 #else
    584579void *USBProxyService::insertFilter (PCUSBFILTER /* aFilter */)
    585 #endif
    586580{
    587581    // return non-NULL to prevent failed assertions in Main
  • trunk/src/VBox/Main/include/USBDeviceFilterImpl.h

    r7829 r7852  
    2424
    2525#include "Matching.h"
    26 #ifdef VBOX_WITH_USBFILTER
    27 # include <VBox/usbfilter.h>
    28 #endif /* VBOX_WITH_USBFILTER */
     26#include <VBox/usbfilter.h>
    2927
    3028class USBController;
     
    4442    struct Data
    4543    {
    46 #ifndef VBOX_WITH_USBFILTER
    47         struct ConvForRegexp
    48         {
    49             inline static Bstr toBstr (const USHORT &aValue)
    50             {
    51                 return Bstr (Utf8StrFmt ("%04X", aValue));
    52             }
    53 
    54             inline static const Bstr &toBstr (const Bstr &aValue)
    55             {
    56                 return aValue;
    57             }
    58         };
    59 
    60         typedef matching::Matchable
    61             <matching::TwoParsedFilters <matching::ParsedIntervalFilter <USHORT>,
    62                                          matching::ParsedRegexpFilter <ConvForRegexp, true, 4, 4> > >
    63             USHORTFilter;
    64 
    65         typedef matching::Matchable
    66             <matching::ParsedRegexpFilter <ConvForRegexp, false> > BstrFilter;
    67 #endif /* !VBOX_WITH_USBFILTER */
    68 
    6944        typedef matching::Matchable <matching::ParsedBoolFilter> BOOLFilter;
    7045
    7146        Data() : mActive (FALSE), mMaskedIfs (0), mId (NULL) {}
    72 #ifdef VBOX_WITH_USBFILTER
    7347        Data (const Data &aThat) : mName (aThat.mName), mActive (aThat.mActive),
    7448            mRemote (aThat.mRemote), mMaskedIfs (aThat.mMaskedIfs) , mId (aThat.mId)
     
    7650            USBFilterClone (&mUSBFilter, &aThat.mUSBFilter);
    7751        }
    78 #endif /* VBOX_WITH_USBFILTER */
    7952
    8053        bool operator== (const Data &that) const
    8154        {
    82 #ifndef VBOX_WITH_USBFILTER
    83             return this == &that ||
    84                    (mName == that.mName &&
    85                     mActive == that.mActive &&
    86                     mVendorId.string() == that. mVendorId.string() &&
    87                     mProductId.string() == that. mProductId.string() &&
    88                     mRevision.string() == that. mRevision.string() &&
    89                     mManufacturer.string() == that. mManufacturer.string() &&
    90                     mProduct.string() == that. mProduct.string() &&
    91                     mSerialNumber.string() == that. mSerialNumber.string() &&
    92                     mPort.string() == that. mPort.string() &&
    93                     mRemote.string() == that. mRemote.string() &&
    94                     mMaskedIfs == that. mMaskedIfs);
    95 #else /* VBOX_WITH_USBFILTER */
    9655            return this == &that
    9756                || (    mName == that.mName
     
    9958                    &&  mMaskedIfs == that.mMaskedIfs
    10059                    &&  USBFilterIsIdentical (&mUSBFilter, &that.mUSBFilter));
    101 #endif /* VBOX_WITH_USBFILTER */
    10260        }
    10361
     62        /** The filter name. */
    10463        Bstr mName;
     64        /** Indicates whether the filter is active or not. */
    10565        BOOL mActive;
    106 
    107 #ifndef VBOX_WITH_USBFILTER
    108         USHORTFilter mVendorId;
    109         USHORTFilter mProductId;
    110         USHORTFilter mRevision;
    111         BstrFilter mManufacturer;
    112         BstrFilter mProduct;
    113         BstrFilter mSerialNumber;
    114         USHORTFilter mPort;
    115 #else /* VBOX_WITH_USBFILTER */
     66        /** Remote or local matching criterion. */
     67        BOOLFilter mRemote;
     68        /** The filter data blob. */
    11669        USBFILTER mUSBFilter;
    117 #endif /* VBOX_WITH_USBFILTER */
    118         BOOLFilter mRemote;
    119 
    120         /** Config value. */
     70
     71        /** Interface masking bit mask that should be applied to matching devices. */
    12172        ULONG mMaskedIfs;
    12273
     
    202153    static const wchar_t *getComponentName() { return L"USBDeviceFilter"; }
    203154
    204 #ifdef VBOX_WITH_USBFILTER
    205155    // tr() wants to belong to a class it seems, thus this one here.
    206156    static HRESULT usbFilterFieldFromString (PUSBFILTER aFilter, USBFILTERIDX aIdx, INPTR BSTR aStr, const char *aName, Utf8Str &aErrStr);
    207 #endif
    208157
    209158private:
    210 #ifdef VBOX_WITH_USBFILTER
    211159    HRESULT usbFilterFieldGetter (USBFILTERIDX aIdx, BSTR *aStr);
    212160    HRESULT usbFilterFieldSetter (USBFILTERIDX aIdx, Bstr aStr, Utf8Str aName);
    213 #endif
    214161
    215162    const ComObjPtr <USBController, ComWeakRef> mParent;
     
    238185    struct Data : public USBDeviceFilter::Data
    239186    {
    240 #ifndef VBOX_WITH_USBFILTER
    241         Data() : mAction (USBDeviceFilterAction_Ignore) {}
    242         USBDeviceFilterAction_T mAction;
    243 #else  /* VBOX_WITH_USBFILTER */
    244187        Data() {}
    245 #endif /* VBOX_WITH_USBFILTER */
    246188    };
    247189
     
    318260
    319261private:
    320 #ifdef VBOX_WITH_USBFILTER
    321262    HRESULT usbFilterFieldGetter (USBFILTERIDX aIdx, BSTR *aStr);
    322263    HRESULT usbFilterFieldSetter (USBFILTERIDX aIdx, Bstr aStr, Utf8Str aName);
    323 #endif
    324264
    325265    const ComObjPtr <Host, ComWeakRef> mParent;
  • trunk/src/VBox/Main/include/USBProxyService.h

    r7851 r7852  
    3838     * @return  ID of the inserted filter
    3939     */
    40 #ifdef VBOX_WITH_USBFILTER
    4140    virtual void *insertFilter (PCUSBFILTER aFilter);
    42 #else
    43     virtual void *insertFilter (IUSBDeviceFilter *aFilter);
    44 #endif
    4541
    4642    /**
     
    126122    static uint64_t calcSerialHash (const char *aSerial);
    127123
    128 #ifdef VBOX_WITH_USBFILTER
    129124    /**
    130125     * Initializes a filter with the data from the specified device.
     
    134129     */
    135130    static void initFilterFromDevice (PUSBFILTER aFilter, HostUSBDevice *aDevice);
    136 #endif
    137131
    138132protected:
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