- Timestamp:
- Mar 4, 2009 9:27:24 AM (16 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r17323 r17336 5 5 6 6 /* 7 * Copyright (C) 2006-200 8Sun Microsystems, Inc.7 * Copyright (C) 2006-2009 Sun Microsystems, Inc. 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 1120 1120 RTPrintf("\nUSB Device Filters:\n\n"); 1121 1121 1122 ComPtr<IUSBDeviceFilterCollection> Coll; 1123 CHECK_ERROR_RET (USBCtl, COMGETTER(DeviceFilters)(Coll.asOutParam()), rc); 1124 1125 ComPtr<IUSBDeviceFilterEnumerator> Enum; 1126 CHECK_ERROR_RET (Coll, Enumerate(Enum.asOutParam()), rc); 1127 1128 ULONG index = 0; 1129 BOOL fMore = FALSE; 1130 ASSERT(SUCCEEDED(rc = Enum->HasMore (&fMore))); 1131 if (FAILED(rc)) 1132 return rc; 1133 1134 if (!fMore) 1122 SafeIfaceArray <IUSBDeviceFilter> Coll; 1123 CHECK_ERROR_RET (USBCtl, COMGETTER(DeviceFilters)(ComSafeArrayAsOutParam(Coll)), rc); 1124 1125 size_t index = 0; // Also used after the "for" below. 1126 1127 if (Coll.size() == 0) 1135 1128 { 1136 1129 if (details != VMINFO_MACHINEREADABLE) … … 1138 1131 } 1139 1132 else 1140 while (fMore) 1141 { 1142 ComPtr<IUSBDeviceFilter> DevPtr; 1143 ASSERT(SUCCEEDED(rc = Enum->GetNext(DevPtr.asOutParam()))); 1144 if (FAILED(rc)) 1145 return rc; 1146 1147 /* Query info. */ 1148 1149 if (details != VMINFO_MACHINEREADABLE) 1150 RTPrintf("Index: %lu\n", index); 1151 1152 BOOL bActive = FALSE; 1153 CHECK_ERROR_RET (DevPtr, COMGETTER (Active) (&bActive), rc); 1154 if (details == VMINFO_MACHINEREADABLE) 1155 RTPrintf("USBFilterActive%d=\"%s\"\n", index + 1, bActive ? "on" : "off"); 1156 else 1157 RTPrintf("Active: %s\n", bActive ? "yes" : "no"); 1158 1159 Bstr bstr; 1160 CHECK_ERROR_RET (DevPtr, COMGETTER (Name) (bstr.asOutParam()), rc); 1161 if (details == VMINFO_MACHINEREADABLE) 1162 RTPrintf("USBFilterName%d=\"%lS\"\n", index + 1, bstr.raw()); 1163 else 1164 RTPrintf("Name: %lS\n", bstr.raw()); 1165 CHECK_ERROR_RET (DevPtr, COMGETTER (VendorId) (bstr.asOutParam()), rc); 1166 if (details == VMINFO_MACHINEREADABLE) 1167 RTPrintf("USBFilterVendorId%d=\"%lS\"\n", index + 1, bstr.raw()); 1168 else 1169 RTPrintf("VendorId: %lS\n", bstr.raw()); 1170 CHECK_ERROR_RET (DevPtr, COMGETTER (ProductId) (bstr.asOutParam()), rc); 1171 if (details == VMINFO_MACHINEREADABLE) 1172 RTPrintf("USBFilterProductId%d=\"%lS\"\n", index + 1, bstr.raw()); 1173 else 1174 RTPrintf("ProductId: %lS\n", bstr.raw()); 1175 CHECK_ERROR_RET (DevPtr, COMGETTER (Revision) (bstr.asOutParam()), rc); 1176 if (details == VMINFO_MACHINEREADABLE) 1177 RTPrintf("USBFilterRevision%d=\"%lS\"\n", index + 1, bstr.raw()); 1178 else 1179 RTPrintf("Revision: %lS\n", bstr.raw()); 1180 CHECK_ERROR_RET (DevPtr, COMGETTER (Manufacturer) (bstr.asOutParam()), rc); 1181 if (details == VMINFO_MACHINEREADABLE) 1182 RTPrintf("USBFilterManufacturer%d=\"%lS\"\n", index + 1, bstr.raw()); 1183 else 1184 RTPrintf("Manufacturer: %lS\n", bstr.raw()); 1185 CHECK_ERROR_RET (DevPtr, COMGETTER (Product) (bstr.asOutParam()), rc); 1186 if (details == VMINFO_MACHINEREADABLE) 1187 RTPrintf("USBFilterProduct%d=\"%lS\"\n", index + 1, bstr.raw()); 1188 else 1189 RTPrintf("Product: %lS\n", bstr.raw()); 1190 CHECK_ERROR_RET (DevPtr, COMGETTER (Remote) (bstr.asOutParam()), rc); 1191 if (details == VMINFO_MACHINEREADABLE) 1192 RTPrintf("USBFilterRemote%d=\"%lS\"\n", index + 1, bstr.raw()); 1193 else 1194 RTPrintf("Remote: %lS\n", bstr.raw()); 1195 CHECK_ERROR_RET (DevPtr, COMGETTER (SerialNumber) (bstr.asOutParam()), rc); 1196 if (details == VMINFO_MACHINEREADABLE) 1197 RTPrintf("USBFilterSerialNumber%d=\"%lS\"\n", index + 1, bstr.raw()); 1198 else 1199 RTPrintf("Serial Number: %lS\n", bstr.raw()); 1200 if (details != VMINFO_MACHINEREADABLE) 1201 { 1202 ULONG fMaskedIfs; 1203 CHECK_ERROR_RET (DevPtr, COMGETTER (MaskedInterfaces) (&fMaskedIfs), rc); 1204 if (fMaskedIfs) 1205 RTPrintf("Masked Interfaces: 0x%08x\n", fMaskedIfs); 1206 RTPrintf("\n"); 1207 } 1208 1209 ASSERT(SUCCEEDED(rc = Enum->HasMore (&fMore))); 1210 if (FAILED(rc)) 1211 return rc; 1212 1213 index ++; 1133 { 1134 for (; index < Coll.size(); ++index) 1135 { 1136 ComPtr<IUSBDeviceFilter> DevPtr = Coll[index]; 1137 1138 /* Query info. */ 1139 1140 if (details != VMINFO_MACHINEREADABLE) 1141 RTPrintf("Index: %zu\n", index); 1142 1143 BOOL bActive = FALSE; 1144 CHECK_ERROR_RET (DevPtr, COMGETTER (Active) (&bActive), rc); 1145 if (details == VMINFO_MACHINEREADABLE) 1146 RTPrintf("USBFilterActive%zu=\"%s\"\n", index + 1, bActive ? "on" : "off"); 1147 else 1148 RTPrintf("Active: %s\n", bActive ? "yes" : "no"); 1149 1150 Bstr bstr; 1151 CHECK_ERROR_RET (DevPtr, COMGETTER (Name) (bstr.asOutParam()), rc); 1152 if (details == VMINFO_MACHINEREADABLE) 1153 RTPrintf("USBFilterName%zu=\"%lS\"\n", index + 1, bstr.raw()); 1154 else 1155 RTPrintf("Name: %lS\n", bstr.raw()); 1156 CHECK_ERROR_RET (DevPtr, COMGETTER (VendorId) (bstr.asOutParam()), rc); 1157 if (details == VMINFO_MACHINEREADABLE) 1158 RTPrintf("USBFilterVendorId%zu=\"%lS\"\n", index + 1, bstr.raw()); 1159 else 1160 RTPrintf("VendorId: %lS\n", bstr.raw()); 1161 CHECK_ERROR_RET (DevPtr, COMGETTER (ProductId) (bstr.asOutParam()), rc); 1162 if (details == VMINFO_MACHINEREADABLE) 1163 RTPrintf("USBFilterProductId%zu=\"%lS\"\n", index + 1, bstr.raw()); 1164 else 1165 RTPrintf("ProductId: %lS\n", bstr.raw()); 1166 CHECK_ERROR_RET (DevPtr, COMGETTER (Revision) (bstr.asOutParam()), rc); 1167 if (details == VMINFO_MACHINEREADABLE) 1168 RTPrintf("USBFilterRevision%zu=\"%lS\"\n", index + 1, bstr.raw()); 1169 else 1170 RTPrintf("Revision: %lS\n", bstr.raw()); 1171 CHECK_ERROR_RET (DevPtr, COMGETTER (Manufacturer) (bstr.asOutParam()), rc); 1172 if (details == VMINFO_MACHINEREADABLE) 1173 RTPrintf("USBFilterManufacturer%zu=\"%lS\"\n", index + 1, bstr.raw()); 1174 else 1175 RTPrintf("Manufacturer: %lS\n", bstr.raw()); 1176 CHECK_ERROR_RET (DevPtr, COMGETTER (Product) (bstr.asOutParam()), rc); 1177 if (details == VMINFO_MACHINEREADABLE) 1178 RTPrintf("USBFilterProduct%zu=\"%lS\"\n", index + 1, bstr.raw()); 1179 else 1180 RTPrintf("Product: %lS\n", bstr.raw()); 1181 CHECK_ERROR_RET (DevPtr, COMGETTER (Remote) (bstr.asOutParam()), rc); 1182 if (details == VMINFO_MACHINEREADABLE) 1183 RTPrintf("USBFilterRemote%zu=\"%lS\"\n", index + 1, bstr.raw()); 1184 else 1185 RTPrintf("Remote: %lS\n", bstr.raw()); 1186 CHECK_ERROR_RET (DevPtr, COMGETTER (SerialNumber) (bstr.asOutParam()), rc); 1187 if (details == VMINFO_MACHINEREADABLE) 1188 RTPrintf("USBFilterSerialNumber%zu=\"%lS\"\n", index + 1, bstr.raw()); 1189 else 1190 RTPrintf("Serial Number: %lS\n", bstr.raw()); 1191 if (details != VMINFO_MACHINEREADABLE) 1192 { 1193 ULONG fMaskedIfs; 1194 CHECK_ERROR_RET (DevPtr, COMGETTER (MaskedInterfaces) (&fMaskedIfs), rc); 1195 if (fMaskedIfs) 1196 RTPrintf("Masked Interfaces: 0x%08x\n", fMaskedIfs); 1197 RTPrintf("\n"); 1198 } 1199 } 1214 1200 } 1215 1201 … … 1962 1948 1963 1949 #endif /* !VBOX_ONLY_DOCS */ 1964 1950 /* vi: set tabstop=4 shiftwidth=4 expandtab: */ -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageUSB.cpp
r17104 r17336 499 499 else 500 500 { 501 ComPtr <IUSBDeviceFilterCollection> coll; 502 CHECK_ERROR_BREAK (ctl, COMGETTER(DeviceFilters) (coll.asOutParam())); 503 504 ComPtr <IUSBDeviceFilter> flt; 505 CHECK_ERROR_BREAK (coll, GetItemAt (cmd.mIndex, flt.asOutParam())); 501 SafeIfaceArray <IUSBDeviceFilter> coll; 502 CHECK_ERROR_BREAK (ctl, COMGETTER(DeviceFilters) (ComSafeArrayAsOutParam(coll))); 503 504 ComPtr <IUSBDeviceFilter> flt = coll[cmd.mIndex]; 506 505 507 506 if (!f.mName.isNull()) -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
r17275 r17336 2517 2517 if (ctl.GetEnabled()) 2518 2518 { 2519 CUSBDeviceFilterCollection coll = ctl.GetDeviceFilters(); 2520 CUSBDeviceFilterEnumerator en = coll.Enumerate(); 2519 CUSBDeviceFilterVector coll = ctl.GetDeviceFilters(); 2521 2520 uint active = 0; 2522 while (en.HasMore())2523 if ( en.GetNext().GetActive())2521 for (int i = 0; i < coll.size(); ++i) 2522 if (coll[i].GetActive()) 2524 2523 active ++; 2525 2524 … … 2527 2526 .arg (tr ("Device Filters", "details report (USB)"), 2528 2527 tr ("%1 (%2 active)", "details report (USB)") 2529 .arg (coll. GetCount()).arg (active));2528 .arg (coll.size()).arg (active)); 2530 2529 } 2531 2530 else -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMSettingsUSB.cpp
r13580 r17336 184 184 if (!ctl.isNull()) 185 185 { 186 CUSBDeviceFilter Enumerator en = ctl.GetDeviceFilters().Enumerate();187 while (en.HasMore())188 addUSBFilter ( en.GetNext(), false /* isNew */);186 CUSBDeviceFilterVector filtvec = ctl.GetDeviceFilters(); 187 for (int i = 0; i < filtvec.size(); ++i) 188 addUSBFilter (filtvec[i], false /* isNew */); 189 189 } 190 190 … … 204 204 { 205 205 /* First, remove all old filters */ 206 for (ulong count = ctl.GetDeviceFilters(). GetCount(); count; -- count)206 for (ulong count = ctl.GetDeviceFilters().size(); count; -- count) 207 207 ctl.RemoveDeviceFilter (0); 208 208 -
trunk/src/VBox/Main/USBControllerImpl.cpp
r16560 r17336 362 362 363 363 364 STDMETHODIMP USBController::COMGETTER(DeviceFilters) ( IUSBDeviceFilterCollection **aDevicesFilters)365 { 366 CheckComArgOut PointerValid(aDevicesFilters);364 STDMETHODIMP USBController::COMGETTER(DeviceFilters) (ComSafeArrayOut(IUSBDeviceFilter *, aDevicesFilters)) 365 { 366 CheckComArgOutSafeArrayPointerValid(aDevicesFilters); 367 367 368 368 AutoCaller autoCaller (this); … … 371 371 AutoReadLock alock (this); 372 372 373 ComObjPtr <USBDeviceFilterCollection> collection; 374 collection.createObject();375 # ifdef VBOX_WITH_USB376 collection->init (*mDeviceFilters.data());373 #ifdef VBOX_WITH_USB 374 SafeIfaceArray <IUSBDeviceFilter> collection (*mDeviceFilters.data()); 375 #else 376 SafeIfaceArray <IUSBDeviceFilter> collection; 377 377 #endif 378 collection. queryInterfaceTo (aDevicesFilters);378 collection.detachTo (ComSafeArrayOutArg (aDevicesFilters)); 379 379 380 380 return S_OK; -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r17333 r17336 10811 10811 <interface 10812 10812 name="IUSBController" extends="$unknown" 10813 uuid=" f4c2d3dc-f109-4da7-93b1-ec28973ac89f"10813 uuid="238540fa-4b73-435a-a38e-4e1d9eab5c17" 10814 10814 wsmap="managed" 10815 10815 > … … 10840 10840 </attribute> 10841 10841 10842 <attribute name="deviceFilters" type="IUSBDeviceFilter Collection" readonly="yes">10842 <attribute name="deviceFilters" type="IUSBDeviceFilter" readonly="yes" safearray="yes"> 10843 10843 <desc> 10844 10844 List of USB device filters associated with the machine. … … 11100 11100 ///////////////////////////////////////////////////////////////////////// 11101 11101 --> 11102 11103 <enumerator11104 name="IUSBDeviceFilterEnumerator" type="IUSBDeviceFilter"11105 uuid="d5109c61-93e7-4726-926b-0dee1020da56"11106 />11107 11108 <collection11109 name="IUSBDeviceFilterCollection" type="IUSBDeviceFilter"11110 enumerator="IUSBDeviceFilterEnumerator"11111 uuid="4fa3fc99-ceb1-4bf5-a9cb-e962d825c1ef"11112 readonly="yes"11113 />11114 11102 11115 11103 <interface -
trunk/src/VBox/Main/include/USBControllerImpl.h
r15157 r17336 99 99 STDMETHOD(COMSETTER(EnabledEhci)) (BOOL aEnabled); 100 100 STDMETHOD(COMGETTER(USBStandard)) (USHORT *aUSBStandard); 101 STDMETHOD(COMGETTER(DeviceFilters)) ( IUSBDeviceFilterCollection **aDevicesFilters);101 STDMETHOD(COMGETTER(DeviceFilters)) (ComSafeArrayOut (IUSBDeviceFilter *, aDevicesFilters)); 102 102 103 103 // IUSBController methods -
trunk/src/VBox/Main/xpcom/server.cpp
r17333 r17336 245 245 COM_IMPL_READONLY_ENUM_AND_COLLECTION(HostUSBDevice) 246 246 COM_IMPL_READONLY_ENUM_AND_COLLECTION(HostUSBDeviceFilter) 247 COM_IMPL_READONLY_ENUM_AND_COLLECTION(USBDeviceFilter)248 247 #endif 249 248
Note:
See TracChangeset
for help on using the changeset viewer.