Changeset 17684 in vbox
- Timestamp:
- Mar 11, 2009 12:15:33 PM (16 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 1 deleted
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r17553 r17684 583 583 ComPtr <IHost> host; 584 584 CHECK_ERROR_BREAK (a->virtualBox, COMGETTER(Host) (host.asOutParam())); 585 ComPtr <IHostUSBDeviceCollection> coll;586 CHECK_ERROR_BREAK (host, COMGETTER(USBDevices) ( coll.asOutParam()));585 SafeIfaceArray <IHostUSBDevice> coll; 586 CHECK_ERROR_BREAK (host, COMGETTER(USBDevices) (ComSafeArrayAsOutParam(coll))); 587 587 ComPtr <IHostUSBDevice> dev; 588 CHECK_ERROR_BREAK ( coll, FindByAddress (Bstr (a->argv [2]), dev.asOutParam()));588 CHECK_ERROR_BREAK (host, FindUSBDeviceByAddress (Bstr (a->argv [2]), dev.asOutParam())); 589 589 CHECK_ERROR_BREAK (dev, COMGETTER(Id) (usbId.asOutParam())); 590 590 } -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r17669 r17684 1214 1214 RTPrintf("Available remote USB devices:\n\n"); 1215 1215 1216 ComPtr<IHostUSBDeviceCollection> coll; 1217 CHECK_ERROR_RET (console, COMGETTER(RemoteUSBDevices) (coll.asOutParam()), rc); 1218 1219 ComPtr <IHostUSBDeviceEnumerator> en; 1220 CHECK_ERROR_RET (coll, Enumerate (en.asOutParam()), rc); 1221 1222 BOOL more = FALSE; 1223 ASSERT(SUCCEEDED(rc = en->HasMore(&more))); 1224 if (FAILED(rc)) 1225 return rc; 1226 1227 if (!more) 1216 SafeIfaceArray <IHostUSBDevice> coll; 1217 CHECK_ERROR_RET (console, COMGETTER(RemoteUSBDevices) (ComSafeArrayAsOutParam(coll)), rc); 1218 1219 if (coll.size() == 0) 1228 1220 { 1229 1221 if (details != VMINFO_MACHINEREADABLE) … … 1231 1223 } 1232 1224 else 1233 while (more)1234 1225 { 1235 ComPtr <IHostUSBDevice> dev; 1236 ASSERT(SUCCEEDED(rc = en->GetNext (dev.asOutParam()))); 1237 if (FAILED(rc)) 1238 return rc; 1239 1240 /* Query info. */ 1241 Guid id; 1242 CHECK_ERROR_RET (dev, COMGETTER(Id)(id.asOutParam()), rc); 1243 USHORT usVendorId; 1244 CHECK_ERROR_RET (dev, COMGETTER(VendorId)(&usVendorId), rc); 1245 USHORT usProductId; 1246 CHECK_ERROR_RET (dev, COMGETTER(ProductId)(&usProductId), rc); 1247 USHORT bcdRevision; 1248 CHECK_ERROR_RET (dev, COMGETTER(Revision)(&bcdRevision), rc); 1249 1250 if (details == VMINFO_MACHINEREADABLE) 1251 RTPrintf("USBRemoteUUID%d=\"%S\"\n" 1252 "USBRemoteVendorId%d=\"%#06x\"\n" 1253 "USBRemoteProductId%d=\"%#06x\"\n" 1254 "USBRemoteRevision%d=\"%#04x%02x\"\n", 1255 index + 1, id.toString().raw(), 1256 index + 1, usVendorId, 1257 index + 1, usProductId, 1258 index + 1, bcdRevision >> 8, bcdRevision & 0xff); 1259 else 1260 RTPrintf("UUID: %S\n" 1261 "VendorId: 0x%04x (%04X)\n" 1262 "ProductId: 0x%04x (%04X)\n" 1263 "Revision: %u.%u (%02u%02u)\n", 1264 id.toString().raw(), 1265 usVendorId, usVendorId, usProductId, usProductId, 1266 bcdRevision >> 8, bcdRevision & 0xff, 1267 bcdRevision >> 8, bcdRevision & 0xff); 1268 1269 /* optional stuff. */ 1270 Bstr bstr; 1271 CHECK_ERROR_RET (dev, COMGETTER(Manufacturer)(bstr.asOutParam()), rc); 1272 if (!bstr.isEmpty()) 1226 for (index = 0; index < coll.size(); ++index) 1273 1227 { 1228 ComPtr <IHostUSBDevice> dev = coll[index]; 1229 1230 /* Query info. */ 1231 Guid id; 1232 CHECK_ERROR_RET (dev, COMGETTER(Id)(id.asOutParam()), rc); 1233 USHORT usVendorId; 1234 CHECK_ERROR_RET (dev, COMGETTER(VendorId)(&usVendorId), rc); 1235 USHORT usProductId; 1236 CHECK_ERROR_RET (dev, COMGETTER(ProductId)(&usProductId), rc); 1237 USHORT bcdRevision; 1238 CHECK_ERROR_RET (dev, COMGETTER(Revision)(&bcdRevision), rc); 1239 1274 1240 if (details == VMINFO_MACHINEREADABLE) 1275 RTPrintf("USBRemoteManufacturer%d=\"%lS\"\n", index + 1, bstr.raw()); 1241 RTPrintf("USBRemoteUUID%zu=\"%S\"\n" 1242 "USBRemoteVendorId%zu=\"%#06x\"\n" 1243 "USBRemoteProductId%zu=\"%#06x\"\n" 1244 "USBRemoteRevision%zu=\"%#04x%02x\"\n", 1245 index + 1, id.toString().raw(), 1246 index + 1, usVendorId, 1247 index + 1, usProductId, 1248 index + 1, bcdRevision >> 8, bcdRevision & 0xff); 1276 1249 else 1277 RTPrintf("Manufacturer: %lS\n", bstr.raw()); 1250 RTPrintf("UUID: %S\n" 1251 "VendorId: 0x%04x (%04X)\n" 1252 "ProductId: 0x%04x (%04X)\n" 1253 "Revision: %u.%u (%02u%02u)\n", 1254 id.toString().raw(), 1255 usVendorId, usVendorId, usProductId, usProductId, 1256 bcdRevision >> 8, bcdRevision & 0xff, 1257 bcdRevision >> 8, bcdRevision & 0xff); 1258 1259 /* optional stuff. */ 1260 Bstr bstr; 1261 CHECK_ERROR_RET (dev, COMGETTER(Manufacturer)(bstr.asOutParam()), rc); 1262 if (!bstr.isEmpty()) 1263 { 1264 if (details == VMINFO_MACHINEREADABLE) 1265 RTPrintf("USBRemoteManufacturer%zu=\"%lS\"\n", index + 1, bstr.raw()); 1266 else 1267 RTPrintf("Manufacturer: %lS\n", bstr.raw()); 1268 } 1269 CHECK_ERROR_RET (dev, COMGETTER(Product)(bstr.asOutParam()), rc); 1270 if (!bstr.isEmpty()) 1271 { 1272 if (details == VMINFO_MACHINEREADABLE) 1273 RTPrintf("USBRemoteProduct%zu=\"%lS\"\n", index + 1, bstr.raw()); 1274 else 1275 RTPrintf("Product: %lS\n", bstr.raw()); 1276 } 1277 CHECK_ERROR_RET (dev, COMGETTER(SerialNumber)(bstr.asOutParam()), rc); 1278 if (!bstr.isEmpty()) 1279 { 1280 if (details == VMINFO_MACHINEREADABLE) 1281 RTPrintf("USBRemoteSerialNumber%zu=\"%lS\"\n", index + 1, bstr.raw()); 1282 else 1283 RTPrintf("SerialNumber: %lS\n", bstr.raw()); 1284 } 1285 CHECK_ERROR_RET (dev, COMGETTER(Address)(bstr.asOutParam()), rc); 1286 if (!bstr.isEmpty()) 1287 { 1288 if (details == VMINFO_MACHINEREADABLE) 1289 RTPrintf("USBRemoteAddress%zu=\"%lS\"\n", index + 1, bstr.raw()); 1290 else 1291 RTPrintf("Address: %lS\n", bstr.raw()); 1292 } 1293 1294 if (details != VMINFO_MACHINEREADABLE) 1295 RTPrintf("\n"); 1278 1296 } 1279 CHECK_ERROR_RET (dev, COMGETTER(Product)(bstr.asOutParam()), rc);1280 if (!bstr.isEmpty())1281 {1282 if (details == VMINFO_MACHINEREADABLE)1283 RTPrintf("USBRemoteProduct%d=\"%lS\"\n", index + 1, bstr.raw());1284 else1285 RTPrintf("Product: %lS\n", bstr.raw());1286 }1287 CHECK_ERROR_RET (dev, COMGETTER(SerialNumber)(bstr.asOutParam()), rc);1288 if (!bstr.isEmpty())1289 {1290 if (details == VMINFO_MACHINEREADABLE)1291 RTPrintf("USBRemoteSerialNumber%d=\"%lS\"\n", index + 1, bstr.raw());1292 else1293 RTPrintf("SerialNumber: %lS\n", bstr.raw());1294 }1295 CHECK_ERROR_RET (dev, COMGETTER(Address)(bstr.asOutParam()), rc);1296 if (!bstr.isEmpty())1297 {1298 if (details == VMINFO_MACHINEREADABLE)1299 RTPrintf("USBRemoteAddress%d=\"%lS\"\n", index + 1, bstr.raw());1300 else1301 RTPrintf("Address: %lS\n", bstr.raw());1302 }1303 1304 if (details != VMINFO_MACHINEREADABLE)1305 RTPrintf("\n");1306 1307 ASSERT(SUCCEEDED(rc = en->HasMore (&more)));1308 if (FAILED(rc))1309 return rc;1310 1311 index ++;1312 1297 } 1313 1298 } -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp
r17613 r17684 586 586 CHECK_ERROR_RET (a->virtualBox, COMGETTER(Host)(Host.asOutParam()), 1); 587 587 588 ComPtr<IHostUSBDeviceCollection> CollPtr; 589 CHECK_ERROR_RET (Host, COMGETTER(USBDevices)(CollPtr.asOutParam()), 1); 590 591 ComPtr<IHostUSBDeviceEnumerator> EnumPtr; 592 CHECK_ERROR_RET (CollPtr, Enumerate(EnumPtr.asOutParam()), 1); 588 SafeIfaceArray <IHostUSBDevice> CollPtr; 589 CHECK_ERROR_RET (Host, COMGETTER(USBDevices)(ComSafeArrayAsOutParam(CollPtr)), 1); 593 590 594 591 RTPrintf("Host USB Devices:\n\n"); 595 592 596 BOOL fMore = FALSE; 597 ASSERT(SUCCEEDED(rc = EnumPtr->HasMore (&fMore))); 598 if (FAILED(rc)) 599 return rc; 600 601 if (!fMore) 593 if (CollPtr.size() == 0) 602 594 { 603 595 RTPrintf("<none>\n\n"); 604 596 } 605 597 else 606 while (fMore) 607 { 608 ComPtr <IHostUSBDevice> dev; 609 ASSERT(SUCCEEDED(rc = EnumPtr->GetNext (dev.asOutParam()))); 610 if (FAILED(rc)) 611 return rc; 612 613 /* Query info. */ 614 Guid id; 615 CHECK_ERROR_RET (dev, COMGETTER(Id)(id.asOutParam()), 1); 616 USHORT usVendorId; 617 CHECK_ERROR_RET (dev, COMGETTER(VendorId)(&usVendorId), 1); 618 USHORT usProductId; 619 CHECK_ERROR_RET (dev, COMGETTER(ProductId)(&usProductId), 1); 620 USHORT bcdRevision; 621 CHECK_ERROR_RET (dev, COMGETTER(Revision)(&bcdRevision), 1); 622 623 RTPrintf("UUID: %S\n" 624 "VendorId: 0x%04x (%04X)\n" 625 "ProductId: 0x%04x (%04X)\n" 626 "Revision: %u.%u (%02u%02u)\n", 627 id.toString().raw(), 628 usVendorId, usVendorId, usProductId, usProductId, 629 bcdRevision >> 8, bcdRevision & 0xff, 630 bcdRevision >> 8, bcdRevision & 0xff); 631 632 /* optional stuff. */ 633 Bstr bstr; 634 CHECK_ERROR_RET (dev, COMGETTER(Manufacturer)(bstr.asOutParam()), 1); 635 if (!bstr.isEmpty()) 636 RTPrintf("Manufacturer: %lS\n", bstr.raw()); 637 CHECK_ERROR_RET (dev, COMGETTER(Product)(bstr.asOutParam()), 1); 638 if (!bstr.isEmpty()) 639 RTPrintf("Product: %lS\n", bstr.raw()); 640 CHECK_ERROR_RET (dev, COMGETTER(SerialNumber)(bstr.asOutParam()), 1); 641 if (!bstr.isEmpty()) 642 RTPrintf("SerialNumber: %lS\n", bstr.raw()); 643 CHECK_ERROR_RET (dev, COMGETTER(Address)(bstr.asOutParam()), 1); 644 if (!bstr.isEmpty()) 645 RTPrintf("Address: %lS\n", bstr.raw()); 646 647 /* current state */ 648 USBDeviceState_T state; 649 CHECK_ERROR_RET (dev, COMGETTER(State)(&state), 1); 650 const char *pszState = "?"; 651 switch (state) 652 { 653 case USBDeviceState_NotSupported: 654 pszState = "Not supported"; break; 655 case USBDeviceState_Unavailable: 656 pszState = "Unavailable"; break; 657 case USBDeviceState_Busy: 658 pszState = "Busy"; break; 659 case USBDeviceState_Available: 660 pszState = "Available"; break; 661 case USBDeviceState_Held: 662 pszState = "Held"; break; 663 case USBDeviceState_Captured: 664 pszState = "Captured"; break; 665 default: 666 ASSERT (false); 667 break; 668 } 669 RTPrintf("Current State: %s\n\n", pszState); 670 671 ASSERT(SUCCEEDED(rc = EnumPtr->HasMore (&fMore))); 672 if (FAILED(rc)) 673 return rc; 598 { 599 for (size_t i = 0; i < CollPtr.size(); ++i) 600 { 601 ComPtr <IHostUSBDevice> dev = CollPtr[i]; 602 603 /* Query info. */ 604 Guid id; 605 CHECK_ERROR_RET (dev, COMGETTER(Id)(id.asOutParam()), 1); 606 USHORT usVendorId; 607 CHECK_ERROR_RET (dev, COMGETTER(VendorId)(&usVendorId), 1); 608 USHORT usProductId; 609 CHECK_ERROR_RET (dev, COMGETTER(ProductId)(&usProductId), 1); 610 USHORT bcdRevision; 611 CHECK_ERROR_RET (dev, COMGETTER(Revision)(&bcdRevision), 1); 612 613 RTPrintf("UUID: %S\n" 614 "VendorId: 0x%04x (%04X)\n" 615 "ProductId: 0x%04x (%04X)\n" 616 "Revision: %u.%u (%02u%02u)\n", 617 id.toString().raw(), 618 usVendorId, usVendorId, usProductId, usProductId, 619 bcdRevision >> 8, bcdRevision & 0xff, 620 bcdRevision >> 8, bcdRevision & 0xff); 621 622 /* optional stuff. */ 623 Bstr bstr; 624 CHECK_ERROR_RET (dev, COMGETTER(Manufacturer)(bstr.asOutParam()), 1); 625 if (!bstr.isEmpty()) 626 RTPrintf("Manufacturer: %lS\n", bstr.raw()); 627 CHECK_ERROR_RET (dev, COMGETTER(Product)(bstr.asOutParam()), 1); 628 if (!bstr.isEmpty()) 629 RTPrintf("Product: %lS\n", bstr.raw()); 630 CHECK_ERROR_RET (dev, COMGETTER(SerialNumber)(bstr.asOutParam()), 1); 631 if (!bstr.isEmpty()) 632 RTPrintf("SerialNumber: %lS\n", bstr.raw()); 633 CHECK_ERROR_RET (dev, COMGETTER(Address)(bstr.asOutParam()), 1); 634 if (!bstr.isEmpty()) 635 RTPrintf("Address: %lS\n", bstr.raw()); 636 637 /* current state */ 638 USBDeviceState_T state; 639 CHECK_ERROR_RET (dev, COMGETTER(State)(&state), 1); 640 const char *pszState = "?"; 641 switch (state) 642 { 643 case USBDeviceState_NotSupported: 644 pszState = "Not supported"; break; 645 case USBDeviceState_Unavailable: 646 pszState = "Unavailable"; break; 647 case USBDeviceState_Busy: 648 pszState = "Busy"; break; 649 case USBDeviceState_Available: 650 pszState = "Available"; break; 651 case USBDeviceState_Held: 652 pszState = "Held"; break; 653 case USBDeviceState_Captured: 654 pszState = "Captured"; break; 655 default: 656 ASSERT (false); 657 break; 658 } 659 RTPrintf("Current State: %s\n\n", pszState); 660 } 674 661 } 675 662 } -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
r17669 r17684 5549 5549 CHost host = vboxGlobal().virtualBox().GetHost(); 5550 5550 5551 bool isUSBEmpty = host.GetUSBDevices(). GetCount() == 0;5551 bool isUSBEmpty = host.GetUSBDevices().size() == 0; 5552 5552 if (isUSBEmpty) 5553 5553 { … … 5559 5559 else 5560 5560 { 5561 CHostUSBDevice Enumerator en = host.GetUSBDevices().Enumerate();5562 while (en.HasMore())5563 { 5564 CHostUSBDevice dev = en.GetNext();5561 CHostUSBDeviceVector devvec = host.GetUSBDevices(); 5562 for (int i = 0; i < devvec.size(); ++i) 5563 { 5564 CHostUSBDevice dev = devvec[i]; 5565 5565 CUSBDevice usb (dev); 5566 5566 QAction *action = addAction (vboxGlobal().details (usb)); -
trunk/src/VBox/Main/ConsoleImpl.cpp
r17675 r17684 1255 1255 } 1256 1256 1257 STDMETHODIMP Console::COMGETTER(RemoteUSBDevices) ( IHostUSBDeviceCollection **aRemoteUSBDevices)1258 { 1259 CheckComArgOut PointerValid(aRemoteUSBDevices);1257 STDMETHODIMP Console::COMGETTER(RemoteUSBDevices) (ComSafeArrayOut (IHostUSBDevice *, aRemoteUSBDevices)) 1258 { 1259 CheckComArgOutSafeArrayPointerValid(aRemoteUSBDevices); 1260 1260 1261 1261 AutoCaller autoCaller (this); … … 1264 1264 AutoReadLock alock (this); 1265 1265 1266 ComObjPtr <RemoteUSBDeviceCollection> collection; 1267 collection.createObject(); 1268 collection->init (mRemoteUSBDevices); 1269 collection.queryInterfaceTo (aRemoteUSBDevices); 1266 SafeIfaceArray <IHostUSBDevice> collection (mRemoteUSBDevices); 1267 collection.detachTo (ComSafeArrayOutArg(aRemoteUSBDevices)); 1270 1268 1271 1269 return S_OK; -
trunk/src/VBox/Main/HostImpl.cpp
r17679 r17684 1082 1082 } 1083 1083 1084 STDMETHODIMP Host::COMGETTER(USBDevices)( IHostUSBDeviceCollection **aUSBDevices)1084 STDMETHODIMP Host::COMGETTER(USBDevices)(ComSafeArrayOut (IHostUSBDevice *, aUSBDevices)) 1085 1085 { 1086 1086 #ifdef VBOX_WITH_USB 1087 CheckComArgOut PointerValid(aUSBDevices);1087 CheckComArgOutSafeArrayPointerValid(aUSBDevices); 1088 1088 1089 1089 AutoWriteLock alock (this); … … 1093 1093 CheckComRCReturnRC (rc); 1094 1094 1095 return mUSBProxyService->getDeviceCollection ( aUSBDevices);1095 return mUSBProxyService->getDeviceCollection (ComSafeArrayOutArg(aUSBDevices)); 1096 1096 1097 1097 #else … … 2502 2502 } 2503 2503 2504 STDMETHODIMP Host::FindUSBDeviceByAddress (IN_BSTR aAddress, IHostUSBDevice **aDevice) 2505 { 2506 #ifdef VBOX_WITH_USB 2507 CheckComArgNotNull(aAddress); 2508 CheckComArgOutPointerValid(aDevice); 2509 2510 *aDevice = NULL; 2511 2512 SafeIfaceArray <IHostUSBDevice> devsvec; 2513 HRESULT rc = COMGETTER(USBDevices) (ComSafeArrayAsOutParam(devsvec)); 2514 CheckComRCReturnRC (rc); 2515 2516 for (size_t i = 0; i < devsvec.size(); ++i) 2517 { 2518 Bstr address; 2519 rc = devsvec[i]->COMGETTER(Address) (address.asOutParam()); 2520 CheckComRCReturnRC (rc); 2521 if (address == aAddress) 2522 { 2523 return ComObjPtr<IHostUSBDevice> (devsvec[i]).queryInterfaceTo (aDevice); 2524 } 2525 } 2526 2527 return setErrorNoLog (VBOX_E_OBJECT_NOT_FOUND, tr ( 2528 "Could not find a USB device with address '%ls'"), 2529 aAddress); 2530 2531 #else /* !VBOX_WITH_USB */ 2532 return E_NOTIMPL; 2533 #endif /* !VBOX_WITH_USB */ 2534 } 2535 2536 STDMETHODIMP Host::FindUSBDeviceById (IN_GUID aId, IHostUSBDevice **aDevice) 2537 { 2538 #ifdef VBOX_WITH_USB 2539 CheckComArgExpr(aId, Guid (aId).isEmpty() == false); 2540 CheckComArgOutPointerValid(aDevice); 2541 2542 *aDevice = NULL; 2543 2544 SafeIfaceArray <IHostUSBDevice> devsvec; 2545 HRESULT rc = COMGETTER(USBDevices) (ComSafeArrayAsOutParam(devsvec)); 2546 CheckComRCReturnRC (rc); 2547 2548 for (size_t i = 0; i < devsvec.size(); ++i) 2549 { 2550 Guid id; 2551 rc = devsvec[i]->COMGETTER(Id) (id.asOutParam()); 2552 CheckComRCReturnRC (rc); 2553 if (id == aId) 2554 { 2555 return ComObjPtr<IHostUSBDevice> (devsvec[i]).queryInterfaceTo (aDevice); 2556 } 2557 } 2558 2559 return setErrorNoLog (VBOX_E_OBJECT_NOT_FOUND, tr ( 2560 "Could not find a USB device with uuid {%RTuuid}"), 2561 Guid (aId).raw()); 2562 2563 #else /* !VBOX_WITH_USB */ 2564 return E_NOTIMPL; 2565 #endif /* !VBOX_WITH_USB */ 2566 } 2567 2504 2568 2505 2569 /* vi: set tabstop=4 shiftwidth=4 expandtab: */ -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r17679 r17684 5600 5600 <interface 5601 5601 name="IConsole" extends="$unknown" 5602 uuid=" 3d458cf1-d8aa-4593-84db-41de9e7242d8"5602 uuid="9511bc54-15ee-4ddf-808e-472aba03809c" 5603 5603 wsmap="managed" 5604 5604 > … … 5692 5692 </attribute> 5693 5693 5694 <attribute name="remoteUSBDevices" type="IHostUSBDevice Collection" readonly="yes">5694 <attribute name="remoteUSBDevices" type="IHostUSBDevice" readonly="yes" safearray="yes"> 5695 5695 <desc> 5696 5696 List of USB devices currently attached to the remote VRDP client. … … 6609 6609 <interface 6610 6610 name="IHost" extends="$unknown" 6611 uuid=" 651f04ec-b2a6-4008-b979-3a01c0fc72cc"6611 uuid="926469ca-9091-42ef-928e-582d78b66c70" 6612 6612 wsmap="managed" 6613 6613 > … … 6632 6632 </attribute> 6633 6633 6634 <attribute name="USBDevices" type="IHostUSBDevice Collection" readonly="yes">6634 <attribute name="USBDevices" type="IHostUSBDevice" readonly="yes" safearray="yes"> 6635 6635 <desc> 6636 6636 List of USB devices currently attached to the host. … … 6971 6971 </param> 6972 6972 </method> 6973 6974 <method name="findUSBDeviceById"> 6975 <desc> 6976 Searches for a USB device with the given UUID. 6977 6978 <result name="VBOX_E_OBJECT_NOT_FOUND"> 6979 Given @id does not correspond to any USB device. 6980 </result> 6981 6982 <see>IHostUSBDevice::id</see> 6983 </desc> 6984 <param name="id" type="uuid" dir="in"> 6985 <desc>UUID of the USB device to search for.</desc> 6986 </param> 6987 <param name="device" type="IHostUSBDevice" dir="return"> 6988 <desc>Found USB device object.</desc> 6989 </param> 6990 </method> 6991 6992 <method name="findUSBDeviceByAddress"> 6993 <desc> 6994 Searches for a USB device with the given host address. 6995 6996 <result name="VBOX_E_OBJECT_NOT_FOUND"> 6997 Given @c name does not correspond to any USB device. 6998 </result> 6999 7000 <see>IHostUSBDevice::address</see> 7001 </desc> 7002 <param name="name" type="wstring" dir="in"> 7003 <desc> 7004 Address of the USB device (as assigned by the host) to 7005 search for. 7006 </desc> 7007 </param> 7008 <param name="device" type="IHostUSBDevice" dir="return"> 7009 <desc>Found USB device object.</desc> 7010 </param> 7011 </method> 7012 6973 7013 </interface> 6974 7014 … … 11410 11450 </enum> 11411 11451 11412 <enumerator11413 name="IHostUSBDeviceEnumerator" type="IHostUSBDevice"11414 uuid="a0c55136-939f-4d20-b9d3-4d406f08bfa5"11415 />11416 11417 <collection11418 name="IHostUSBDeviceCollection" type="IHostUSBDevice"11419 enumerator="IHostUSBDeviceEnumerator"11420 uuid="f9d3f96d-b027-4994-b589-70bb9ee0d364"11421 readonly="yes"11422 >11423 <method name="findById">11424 <desc>11425 Searches this collection for a USB device with the given UUID.11426 <note>11427 The method returns an error if the given UUID does not11428 correspond to any USB device in the collection.11429 </note>11430 <see>IHostUSBDevice::id</see>11431 </desc>11432 <param name="id" type="uuid" dir="in">11433 <desc>UUID of the USB device to search for.</desc>11434 </param>11435 <param name="device" type="IHostUSBDevice" dir="return">11436 <desc>Found USB device object.</desc>11437 </param>11438 </method>11439 11440 <method name="findByAddress">11441 <desc>11442 Searches this collection for a USB device with the given11443 host address.11444 <note>11445 The method returns an error if the given address does not11446 correspond to any USB device in the collection.11447 </note>11448 <see>IHostUSBDevice::address</see>11449 </desc>11450 <param name="name" type="wstring" dir="in">11451 <desc>11452 Address of the USB device (as assigned by the host) to11453 search for.11454 </desc>11455 </param>11456 <param name="device" type="IHostUSBDevice" dir="return">11457 <desc>Found USB device object.</desc>11458 </param>11459 </method>11460 11461 </collection>11462 11463 11452 <interface 11464 11453 name="IHostUSBDevice" extends="IUSBDevice" -
trunk/src/VBox/Main/include/ConsoleImpl.h
r17669 r17684 116 116 STDMETHOD(COMGETTER(Debugger)) (IMachineDebugger **aDebugger); 117 117 STDMETHOD(COMGETTER(USBDevices)) (ComSafeArrayOut (IUSBDevice *, aUSBDevices)); 118 STDMETHOD(COMGETTER(RemoteUSBDevices)) ( IHostUSBDeviceCollection **aRemoteUSBDevices);118 STDMETHOD(COMGETTER(RemoteUSBDevices)) (ComSafeArrayOut (IHostUSBDevice *, aRemoteUSBDevices)); 119 119 STDMETHOD(COMGETTER(RemoteDisplayInfo)) (IRemoteDisplayInfo **aRemoteDisplayInfo); 120 120 STDMETHOD(COMGETTER(SharedFolders)) (ComSafeArrayOut (ISharedFolder *, aSharedFolders)); -
trunk/src/VBox/Main/include/GuestOSTypeImpl.h
r16971 r17684 24 24 25 25 #include "VirtualBoxBase.h" 26 #include "Collection.h"27 26 #include "Global.h" 28 27 -
trunk/src/VBox/Main/include/HostImpl.h
r17679 r17684 79 79 STDMETHOD(COMGETTER(DVDDrives))(ComSafeArrayOut (IHostDVDDrive*, drives)); 80 80 STDMETHOD(COMGETTER(FloppyDrives))(ComSafeArrayOut (IHostFloppyDrive*, drives)); 81 STDMETHOD(COMGETTER(USBDevices))( IHostUSBDeviceCollection **aUSBDevices);81 STDMETHOD(COMGETTER(USBDevices))(ComSafeArrayOut (IHostUSBDevice *, aUSBDevices)); 82 82 STDMETHOD(COMGETTER(USBDeviceFilters))(ComSafeArrayOut (IHostUSBDeviceFilter *, aUSBDeviceFilters)); 83 83 STDMETHOD(COMGETTER(NetworkInterfaces))(ComSafeArrayOut (IHostNetworkInterface *, aNetworkInterfaces)); … … 111 111 STDMETHOD(FindHostNetworkInterfaceById) (IN_GUID id, IHostNetworkInterface **networkInterface); 112 112 STDMETHOD(FindHostNetworkInterfacesOfType) (HostNetworkInterfaceType_T type, ComSafeArrayOut (IHostNetworkInterface *, aNetworkInterfaces)); 113 STDMETHOD(FindUSBDeviceByAddress) (IN_BSTR aAddress, IHostUSBDevice **aDevice); 114 STDMETHOD(FindUSBDeviceById) (IN_GUID aId, IHostUSBDevice **aDevice); 113 115 114 116 // public methods only for internal purposes -
trunk/src/VBox/Main/include/HostNetworkInterfaceImpl.h
r17613 r17684 7 7 8 8 /* 9 * Copyright (C) 2006-200 8Sun Microsystems, Inc.9 * Copyright (C) 2006-2009 Sun Microsystems, Inc. 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 26 26 27 27 #include "VirtualBoxBase.h" 28 #include "Collection.h"29 28 #include "VirtualBoxImpl.h" 30 29 -
trunk/src/VBox/Main/include/MachineImpl.h
r17673 r17684 7 7 8 8 /* 9 * Copyright (C) 2006-200 7Sun Microsystems, Inc.9 * Copyright (C) 2006-2009 Sun Microsystems, Inc. 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 32 32 #include "FloppyDriveImpl.h" 33 33 #include "HardDiskAttachmentImpl.h" 34 #include "Collection.h"35 34 #include "NetworkAdapterImpl.h" 36 35 #include "AudioAdapterImpl.h" -
trunk/src/VBox/Main/include/NetworkAdapterImpl.h
r17387 r17684 7 7 8 8 /* 9 * Copyright (C) 2006-200 7Sun Microsystems, Inc.9 * Copyright (C) 2006-2009 Sun Microsystems, Inc. 10 10 * 11 11 * This file is part of VirtualBox Open Source Edition (OSE), as … … 26 26 27 27 #include "VirtualBoxBase.h" 28 #include "Collection.h"29 28 30 29 class Machine; -
trunk/src/VBox/Main/include/ProgressImpl.h
r16707 r17684 6 6 7 7 /* 8 * Copyright (C) 2006-200 8Sun Microsystems, Inc.8 * Copyright (C) 2006-2009 Sun Microsystems, Inc. 9 9 * 10 10 * This file is part of VirtualBox Open Source Edition (OSE), as … … 25 25 26 26 #include "VirtualBoxBase.h" 27 #include "Collection.h"28 27 29 28 #include <VBox/com/SupportErrorInfo.h> -
trunk/src/VBox/Main/include/RemoteUSBDeviceImpl.h
r15051 r17684 8 8 9 9 /* 10 * Copyright (C) 2006-200 8Sun Microsystems, Inc.10 * Copyright (C) 2006-2009 Sun Microsystems, Inc. 11 11 * 12 12 * This file is part of VirtualBox Open Source Edition (OSE), as … … 27 27 28 28 #include "VirtualBoxBase.h" 29 #include "Collection.h"30 29 31 30 struct _VRDPUSBDEVICEDESC; … … 138 137 }; 139 138 140 COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_BEGIN (ComObjPtr <RemoteUSBDevice>, IHostUSBDevice, RemoteUSBDevice)141 142 STDMETHOD(FindById) (IN_GUID aId, IHostUSBDevice **aDevice)143 {144 Guid idToFind = aId;145 if (idToFind.isEmpty())146 return E_INVALIDARG;147 if (!aDevice)148 return E_POINTER;149 150 *aDevice = NULL;151 Vector::value_type found;152 Vector::iterator it = vec.begin();153 while (!found && it != vec.end())154 {155 Guid id;156 (*it)->COMGETTER(Id) (id.asOutParam());157 if (id == idToFind)158 found = *it;159 ++ it;160 }161 162 if (!found)163 return setError (E_INVALIDARG, RemoteUSBDeviceCollection::tr (164 "Could not find a USB device with UUID {%s}"),165 idToFind.toString().raw());166 167 return found.queryInterfaceTo (aDevice);168 }169 170 STDMETHOD(FindByAddress) (IN_BSTR aAddress, IHostUSBDevice **aDevice)171 {172 if (!aAddress)173 return E_INVALIDARG;174 if (!aDevice)175 return E_POINTER;176 177 *aDevice = NULL;178 Vector::value_type found;179 Vector::iterator it = vec.begin();180 while (!found && it != vec.end())181 {182 Bstr address;183 (*it)->COMGETTER(Address) (address.asOutParam());184 if (address == aAddress)185 found = *it;186 ++ it;187 }188 189 if (!found)190 return setError (E_INVALIDARG, RemoteUSBDeviceCollection::tr (191 "Could not find a USB device with address '%ls'"),192 aAddress);193 194 return found.queryInterfaceTo (aDevice);195 }196 197 COM_DECL_READONLY_ENUM_AND_COLLECTION_EX_END (ComObjPtr <RemoteUSBDevice>, IHostUSBDevice, RemoteUSBDevice)198 199 200 139 #endif // ____H_REMOTEUSBDEVICEIMPL 201 140 /* vi: set tabstop=4 shiftwidth=4 expandtab: */ -
trunk/src/VBox/Main/include/SharedFolderImpl.h
r16966 r17684 5 5 6 6 /* 7 * Copyright (C) 2006-200 7Sun 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 … … 24 24 25 25 #include "VirtualBoxBase.h" 26 #include "Collection.h"27 26 #include <VBox/shflsvc.h> 28 27 -
trunk/src/VBox/Main/include/SnapshotImpl.h
r17260 r17684 5 5 6 6 /* 7 * Copyright (C) 2006-200 7Sun 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 … … 24 24 25 25 #include "VirtualBoxBase.h" 26 #include "Collection.h"27 26 28 27 #include <iprt/time.h> -
trunk/src/VBox/Main/xpcom/module.cpp
r17553 r17684 83 83 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(Console, IConsole) 84 84 85 COM_IMPL_READONLY_ENUM_AND_COLLECTION_EX(ComObjPtr <RemoteUSBDevice>, IHostUSBDevice, RemoteUSBDevice)86 87 85 /** 88 86 * Singleton class factory that holds a reference to the created instance -
trunk/src/VBox/Main/xpcom/server.cpp
r17669 r17684 118 118 #include <AudioAdapterImpl.h> 119 119 #include <SystemPropertiesImpl.h> 120 #include <Collection.h>121 120 122 121 /* implement nsISupports parts of our objects with support for nsIClassInfo */ … … 239 238 NS_DECL_CLASSINFO(BIOSSettings) 240 239 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(BIOSSettings, IBIOSSettings) 241 242 /* collections and enumerators */243 244 #ifdef VBOX_WITH_USB245 COM_IMPL_READONLY_ENUM_AND_COLLECTION(HostUSBDevice)246 #endif247 240 248 241 ////////////////////////////////////////////////////////////////////////////////
Note:
See TracChangeset
for help on using the changeset viewer.