diff options
Diffstat (limited to 'src/VBox/Frontends/VBoxManage/VBoxManageUSB.cpp')
| -rw-r--r-- | src/VBox/Frontends/VBoxManage/VBoxManageUSB.cpp | 51 |
1 files changed, 19 insertions, 32 deletions
diff --git a/src/VBox/Frontends/VBoxManage/VBoxManageUSB.cpp b/src/VBox/Frontends/VBoxManage/VBoxManageUSB.cpp index 91d98781..08f0d433 100644 --- a/src/VBox/Frontends/VBoxManage/VBoxManageUSB.cpp +++ b/src/VBox/Frontends/VBoxManage/VBoxManageUSB.cpp @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2010 Oracle Corporation + * Copyright (C) 2006-2014 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -21,25 +21,12 @@ #include <VBox/com/array.h> #include <VBox/com/ErrorInfo.h> #include <VBox/com/errorprint.h> -#include <VBox/com/EventQueue.h> - #include <VBox/com/VirtualBox.h> #include "VBoxManage.h" #include <iprt/asm.h> -/* missing XPCOM <-> COM wrappers */ -#ifndef STDMETHOD_ -# define STDMETHOD_(ret, meth) NS_IMETHOD_(ret) meth -#endif -#ifndef NS_GET_IID -# define NS_GET_IID(I) IID_##I -#endif -#ifndef RT_OS_WINDOWS -#define IUnknown nsISupports -#endif - using namespace com; /** @@ -72,13 +59,13 @@ public: STDMETHOD(QueryInterface)(const IID &iid, void **ppvObject) { Guid guid(iid); - if (guid == Guid(NS_GET_IID(IUnknown))) + if (guid == Guid(COM_IIDOF(IUnknown))) *ppvObject = (IUnknown *)this; #ifdef RT_OS_WINDOWS - else if (guid == Guid(NS_GET_IID(IDispatch))) + else if (guid == Guid(COM_IIDOF(IDispatch))) *ppvObject = (IDispatch *)this; #endif - else if (guid == Guid(NS_GET_IID(IUSBDevice))) + else if (guid == Guid(COM_IIDOF(IUSBDevice))) *ppvObject = (IUSBDevice *)this; else return E_NOINTERFACE; @@ -400,18 +387,18 @@ int handleUSBFilter(HandlerArg *a) USBFilterCmd::USBFilter &f = cmd.mFilter; - ComPtr <IHost> host; - ComPtr <IUSBController> ctl; + ComPtr<IHost> host; + ComPtr<IUSBDeviceFilters> flts; if (cmd.mGlobal) CHECK_ERROR_RET(a->virtualBox, COMGETTER(Host)(host.asOutParam()), 1); else { /* open a session for the VM */ - CHECK_ERROR_RET(cmd.mMachine, LockMachine(a->session, LockType_Write), 1); + CHECK_ERROR_RET(cmd.mMachine, LockMachine(a->session, LockType_Shared), 1); /* get the mutable session machine */ a->session->COMGETTER(Machine)(cmd.mMachine.asOutParam()); - /* and get the USB controller */ - CHECK_ERROR_RET(cmd.mMachine, COMGETTER(USBController)(ctl.asOutParam()), 1); + /* and get the USB device filters */ + CHECK_ERROR_RET(cmd.mMachine, COMGETTER(USBDeviceFilters)(flts.asOutParam()), 1); } switch (cmd.mAction) @@ -420,7 +407,7 @@ int handleUSBFilter(HandlerArg *a) { if (cmd.mGlobal) { - ComPtr <IHostUSBDeviceFilter> flt; + ComPtr<IHostUSBDeviceFilter> flt; CHECK_ERROR_BREAK(host, CreateUSBDeviceFilter(f.mName.raw(), flt.asOutParam())); @@ -446,8 +433,8 @@ int handleUSBFilter(HandlerArg *a) } else { - ComPtr <IUSBDeviceFilter> flt; - CHECK_ERROR_BREAK(ctl, CreateDeviceFilter(f.mName.raw(), + ComPtr<IUSBDeviceFilter> flt; + CHECK_ERROR_BREAK(flts, CreateDeviceFilter(f.mName.raw(), flt.asOutParam())); if (!f.mActive.isNull()) @@ -467,7 +454,7 @@ int handleUSBFilter(HandlerArg *a) if (!f.mMaskedInterfaces.isNull()) CHECK_ERROR_BREAK(flt, COMSETTER(MaskedInterfaces)(f.mMaskedInterfaces)); - CHECK_ERROR_BREAK(ctl, InsertDeviceFilter(cmd.mIndex, flt)); + CHECK_ERROR_BREAK(flts, InsertDeviceFilter(cmd.mIndex, flt)); } break; } @@ -478,7 +465,7 @@ int handleUSBFilter(HandlerArg *a) SafeIfaceArray <IHostUSBDeviceFilter> coll; CHECK_ERROR_BREAK(host, COMGETTER(USBDeviceFilters)(ComSafeArrayAsOutParam(coll))); - ComPtr <IHostUSBDeviceFilter> flt = coll[cmd.mIndex]; + ComPtr<IHostUSBDeviceFilter> flt = coll[cmd.mIndex]; if (!f.mName.isEmpty()) CHECK_ERROR_BREAK(flt, COMSETTER(Name)(f.mName.raw())); @@ -503,9 +490,9 @@ int handleUSBFilter(HandlerArg *a) else { SafeIfaceArray <IUSBDeviceFilter> coll; - CHECK_ERROR_BREAK(ctl, COMGETTER(DeviceFilters)(ComSafeArrayAsOutParam(coll))); + CHECK_ERROR_BREAK(flts, COMGETTER(DeviceFilters)(ComSafeArrayAsOutParam(coll))); - ComPtr <IUSBDeviceFilter> flt = coll[cmd.mIndex]; + ComPtr<IUSBDeviceFilter> flt = coll[cmd.mIndex]; if (!f.mName.isEmpty()) CHECK_ERROR_BREAK(flt, COMSETTER(Name)(f.mName.raw())); @@ -532,13 +519,13 @@ int handleUSBFilter(HandlerArg *a) { if (cmd.mGlobal) { - ComPtr <IHostUSBDeviceFilter> flt; + ComPtr<IHostUSBDeviceFilter> flt; CHECK_ERROR_BREAK(host, RemoveUSBDeviceFilter(cmd.mIndex)); } else { - ComPtr <IUSBDeviceFilter> flt; - CHECK_ERROR_BREAK(ctl, RemoveDeviceFilter(cmd.mIndex, flt.asOutParam())); + ComPtr<IUSBDeviceFilter> flt; + CHECK_ERROR_BREAK(flts, RemoveDeviceFilter(cmd.mIndex, flt.asOutParam())); } break; } |
