- Timestamp:
- Mar 5, 2009 12:48:15 PM (16 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp
r17333 r17394 683 683 CHECK_ERROR_RET (a->virtualBox, COMGETTER(Host) (host.asOutParam()), 1); 684 684 685 ComPtr<IHostUSBDeviceFilterCollection> coll; 686 CHECK_ERROR_RET (host, COMGETTER (USBDeviceFilters)(coll.asOutParam()), 1); 687 688 ComPtr<IHostUSBDeviceFilterEnumerator> en; 689 CHECK_ERROR_RET (coll, Enumerate(en.asOutParam()), 1); 690 691 ULONG index = 0; 692 BOOL more = FALSE; 693 ASSERT(SUCCEEDED(rc = en->HasMore (&more))); 694 if (FAILED(rc)) 695 return rc; 696 697 if (!more) 685 SafeIfaceArray <IHostUSBDeviceFilter> coll; 686 CHECK_ERROR_RET (host, COMGETTER (USBDeviceFilters)(ComSafeArrayAsOutParam(coll)), 1); 687 688 if (coll.size() == 0) 698 689 { 699 690 RTPrintf("<none>\n\n"); 700 691 } 701 692 else 702 while (more) 703 { 704 ComPtr<IHostUSBDeviceFilter> flt; 705 ASSERT(SUCCEEDED(rc = en->GetNext (flt.asOutParam()))); 706 if (FAILED(rc)) 707 return rc; 708 709 /* Query info. */ 710 711 RTPrintf("Index: %lu\n", index); 712 713 BOOL active = FALSE; 714 CHECK_ERROR_RET (flt, COMGETTER (Active) (&active), 1); 715 RTPrintf("Active: %s\n", active ? "yes" : "no"); 716 717 USBDeviceFilterAction_T action; 718 CHECK_ERROR_RET (flt, COMGETTER (Action) (&action), 1); 719 const char *pszAction = "<invalid>"; 720 switch (action) 721 { 722 case USBDeviceFilterAction_Ignore: 723 pszAction = "Ignore"; 724 break; 725 case USBDeviceFilterAction_Hold: 726 pszAction = "Hold"; 727 break; 728 default: 729 break; 730 } 731 RTPrintf("Action: %s\n", pszAction); 732 733 Bstr bstr; 734 CHECK_ERROR_RET (flt, COMGETTER (Name) (bstr.asOutParam()), 1); 735 RTPrintf("Name: %lS\n", bstr.raw()); 736 CHECK_ERROR_RET (flt, COMGETTER (VendorId) (bstr.asOutParam()), 1); 737 RTPrintf("VendorId: %lS\n", bstr.raw()); 738 CHECK_ERROR_RET (flt, COMGETTER (ProductId) (bstr.asOutParam()), 1); 739 RTPrintf("ProductId: %lS\n", bstr.raw()); 740 CHECK_ERROR_RET (flt, COMGETTER (Revision) (bstr.asOutParam()), 1); 741 RTPrintf("Revision: %lS\n", bstr.raw()); 742 CHECK_ERROR_RET (flt, COMGETTER (Manufacturer) (bstr.asOutParam()), 1); 743 RTPrintf("Manufacturer: %lS\n", bstr.raw()); 744 CHECK_ERROR_RET (flt, COMGETTER (Product) (bstr.asOutParam()), 1); 745 RTPrintf("Product: %lS\n", bstr.raw()); 746 CHECK_ERROR_RET (flt, COMGETTER (SerialNumber) (bstr.asOutParam()), 1); 747 RTPrintf("Serial Number: %lS\n\n", bstr.raw()); 748 749 ASSERT(SUCCEEDED(rc = en->HasMore (&more))); 750 if (FAILED(rc)) 751 return rc; 752 753 index ++; 693 { 694 for (size_t index = 0; index < coll.size(); ++index) 695 { 696 ComPtr<IHostUSBDeviceFilter> flt = coll[index]; 697 698 /* Query info. */ 699 700 RTPrintf("Index: %zu\n", index); 701 702 BOOL active = FALSE; 703 CHECK_ERROR_RET (flt, COMGETTER (Active) (&active), 1); 704 RTPrintf("Active: %s\n", active ? "yes" : "no"); 705 706 USBDeviceFilterAction_T action; 707 CHECK_ERROR_RET (flt, COMGETTER (Action) (&action), 1); 708 const char *pszAction = "<invalid>"; 709 switch (action) 710 { 711 case USBDeviceFilterAction_Ignore: 712 pszAction = "Ignore"; 713 break; 714 case USBDeviceFilterAction_Hold: 715 pszAction = "Hold"; 716 break; 717 default: 718 break; 719 } 720 RTPrintf("Action: %s\n", pszAction); 721 722 Bstr bstr; 723 CHECK_ERROR_RET (flt, COMGETTER (Name) (bstr.asOutParam()), 1); 724 RTPrintf("Name: %lS\n", bstr.raw()); 725 CHECK_ERROR_RET (flt, COMGETTER (VendorId) (bstr.asOutParam()), 1); 726 RTPrintf("VendorId: %lS\n", bstr.raw()); 727 CHECK_ERROR_RET (flt, COMGETTER (ProductId) (bstr.asOutParam()), 1); 728 RTPrintf("ProductId: %lS\n", bstr.raw()); 729 CHECK_ERROR_RET (flt, COMGETTER (Revision) (bstr.asOutParam()), 1); 730 RTPrintf("Revision: %lS\n", bstr.raw()); 731 CHECK_ERROR_RET (flt, COMGETTER (Manufacturer) (bstr.asOutParam()), 1); 732 RTPrintf("Manufacturer: %lS\n", bstr.raw()); 733 CHECK_ERROR_RET (flt, COMGETTER (Product) (bstr.asOutParam()), 1); 734 RTPrintf("Product: %lS\n", bstr.raw()); 735 CHECK_ERROR_RET (flt, COMGETTER (SerialNumber) (bstr.asOutParam()), 1); 736 RTPrintf("Serial Number: %lS\n\n", bstr.raw()); 737 } 754 738 } 755 739 } -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageUSB.cpp
r17336 r17394 472 472 if (cmd.mGlobal) 473 473 { 474 ComPtr <IHostUSBDeviceFilterCollection> coll;475 CHECK_ERROR_BREAK (host, COMGETTER(USBDeviceFilters) ( coll.asOutParam()));476 ComPtr <IHostUSBDeviceFilter> flt; 477 C HECK_ERROR_BREAK (coll, GetItemAt (cmd.mIndex, flt.asOutParam()));474 SafeIfaceArray <IHostUSBDeviceFilter> coll; 475 CHECK_ERROR_BREAK (host, COMGETTER(USBDeviceFilters) (ComSafeArrayAsOutParam(coll))); 476 477 ComPtr <IHostUSBDeviceFilter> flt = coll[cmd.mIndex]; 478 478 479 479 if (!f.mName.isNull()) … … 552 552 return SUCCEEDED (rc) ? 0 : 1; 553 553 } 554 554 /* vi: set tabstop=4 shiftwidth=4 expandtab: */ -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxSettingsDialogSpecific.cpp
r14398 r17394 187 187 { 188 188 CHost host = vboxGlobal().virtualBox().GetHost(); 189 CHostUSBDeviceFilterCollection coll = host.GetUSBDeviceFilters();190 189 191 190 /* Show an error message (if there is any). … … 194 193 vboxProblem().cannotAccessUSB (host); 195 194 196 if (coll.isNull())197 {195 CHostUSBDeviceFilterVector coll = host.GetUSBDeviceFilters(); 196 if (host.lastRC() == E_NOTIMPL) { 198 197 /* Disable the USB controller category if the USB controller is 199 * not available (i.e. in VirtualBox OSE) */198 * not available (i.e. in VirtualBox OSE). */ 200 199 mSelector->setVisibleById (USBId, false); 201 200 } -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsUSB.cpp
r17336 r17394 135 135 mGbUSB->setVisible (false); 136 136 137 CHostUSBDeviceFilter Enumerator en= vboxGlobal().virtualBox().GetHost()138 .GetUSBDeviceFilters() .Enumerate();139 while (en.HasMore())140 { 141 CHostUSBDeviceFilter hostFilter = en.GetNext();137 CHostUSBDeviceFilterVector filtvec = vboxGlobal().virtualBox().GetHost() 138 .GetUSBDeviceFilters(); 139 for (int i = 0; i < filtvec.size(); ++i) 140 { 141 CHostUSBDeviceFilter hostFilter = filtvec[i]; 142 142 CUSBDeviceFilter filter (hostFilter); 143 143 addUSBFilter (filter, false /* isNew */); … … 155 155 { 156 156 /* First, remove all old filters */ 157 for (ulong count = host.GetUSBDeviceFilters(). GetCount(); count; -- count)157 for (ulong count = host.GetUSBDeviceFilters().size(); count; -- count) 158 158 host.RemoveUSBDeviceFilter (0); 159 159 … … 165 165 checkState (0) == Qt::Checked); 166 166 CHostUSBDeviceFilter insertedFilter (filter); 167 host.InsertUSBDeviceFilter (host.GetUSBDeviceFilters(). GetCount(),167 host.InsertUSBDeviceFilter (host.GetUSBDeviceFilters().size(), 168 168 insertedFilter); 169 169 } -
trunk/src/VBox/Main/HostImpl.cpp
r17280 r17394 1094 1094 } 1095 1095 1096 STDMETHODIMP Host::COMGETTER(USBDeviceFilters) ( IHostUSBDeviceFilterCollection **aUSBDeviceFilters)1096 STDMETHODIMP Host::COMGETTER(USBDeviceFilters) (ComSafeArrayOut (IHostUSBDeviceFilter *, aUSBDeviceFilters)) 1097 1097 { 1098 1098 #ifdef VBOX_WITH_USB 1099 CheckComArgOut PointerValid(aUSBDeviceFilters);1099 CheckComArgOutSafeArrayPointerValid(aUSBDeviceFilters); 1100 1100 1101 1101 AutoWriteLock alock (this); … … 1105 1105 CheckComRCReturnRC (rc); 1106 1106 1107 ComObjPtr <HostUSBDeviceFilterCollection> collection; 1108 collection.createObject(); 1109 collection->init (mUSBDeviceFilters); 1110 collection.queryInterfaceTo (aUSBDeviceFilters); 1107 SafeIfaceArray <IHostUSBDeviceFilter> collection (mUSBDeviceFilters); 1108 collection.detachTo (ComSafeArrayOutArg (aUSBDeviceFilters)); 1111 1109 1112 1110 return rc; -
trunk/src/VBox/Main/USBControllerImpl.cpp
r17341 r17394 362 362 STDMETHODIMP USBController::COMGETTER(DeviceFilters) (ComSafeArrayOut(IUSBDeviceFilter *, aDevicesFilters)) 363 363 { 364 #ifdef VBOX_WITH_USB 364 365 CheckComArgOutSafeArrayPointerValid(aDevicesFilters); 365 366 … … 369 370 AutoReadLock alock (this); 370 371 371 #ifdef VBOX_WITH_USB372 372 SafeIfaceArray <IUSBDeviceFilter> collection (*mDeviceFilters.data()); 373 collection.detachTo (ComSafeArrayOutArg (aDevicesFilters)); 374 375 return S_OK; 373 376 #else 374 SafeIfaceArray <IUSBDeviceFilter> collection;377 ReturnComNotImplemented(); 375 378 #endif 376 collection.detachTo (ComSafeArrayOutArg (aDevicesFilters));377 378 return S_OK;379 379 } 380 380 -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r17387 r17394 6556 6556 <interface 6557 6557 name="IHost" extends="$unknown" 6558 uuid=" 96128709-69b5-43cc-9393-b3895f3b866a"6558 uuid="378cf146-6cd6-4dbc-bc60-cbd2004d99c5" 6559 6559 wsmap="managed" 6560 6560 > … … 6595 6595 </attribute> 6596 6596 6597 <attribute name="USBDeviceFilters" type="IHostUSBDeviceFilter Collection" readonly="yes">6597 <attribute name="USBDeviceFilters" type="IHostUSBDeviceFilter" readonly="yes" safearray="yes"> 6598 6598 <desc> 6599 6599 List of USB device filters in action. … … 11504 11504 </enum> 11505 11505 11506 <enumerator11507 name="IHostUSBDeviceFilterEnumerator" type="IHostUSBDeviceFilter"11508 uuid="ff735211-903e-4642-9c37-189eb44579fe"11509 />11510 11511 <collection11512 name="IHostUSBDeviceFilterCollection" type="IHostUSBDeviceFilter"11513 enumerator="IHostUSBDeviceFilterEnumerator"11514 uuid="1a80458b-87f1-4a74-995d-04e2330119e0"11515 readonly="yes"11516 />11517 11518 11506 <interface 11519 11507 name="IHostUSBDeviceFilter" extends="IUSBDeviceFilter" -
trunk/src/VBox/Main/include/HostImpl.h
r17280 r17394 84 84 STDMETHOD(COMGETTER(FloppyDrives))(ComSafeArrayOut (IHostFloppyDrive*, drives)); 85 85 STDMETHOD(COMGETTER(USBDevices))(IHostUSBDeviceCollection **aUSBDevices); 86 STDMETHOD(COMGETTER(USBDeviceFilters))( IHostUSBDeviceFilterCollection ** aUSBDeviceFilters);86 STDMETHOD(COMGETTER(USBDeviceFilters))(ComSafeArrayOut (IHostUSBDeviceFilter *, aUSBDeviceFilters)); 87 87 STDMETHOD(COMGETTER(NetworkInterfaces))(ComSafeArrayOut (IHostNetworkInterface *, aNetworkInterfaces)); 88 88 STDMETHOD(COMGETTER(ProcessorCount))(ULONG *count); -
trunk/src/VBox/Main/xpcom/server.cpp
r17336 r17394 244 244 #ifdef VBOX_WITH_USB 245 245 COM_IMPL_READONLY_ENUM_AND_COLLECTION(HostUSBDevice) 246 COM_IMPL_READONLY_ENUM_AND_COLLECTION(HostUSBDeviceFilter)247 246 #endif 248 247
Note:
See TracChangeset
for help on using the changeset viewer.