VirtualBox

Changeset 60089 in vbox for trunk/src/VBox/Main/include


Ignore:
Timestamp:
Mar 18, 2016 10:51:02 AM (9 years ago)
Author:
vboxsync
Message:

Main,VBoxManage: Add API to IHost for adding and removing USB device sources in addition to the default host one (only USB/IP backend supported so far which will be used in the future for automatic USB testing). Add support for it in VBoxManage

Location:
trunk/src/VBox/Main/include
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/HostImpl.h

    r60068 r60089  
    145145    HRESULT generateMACAddress(com::Utf8Str &aAddress);
    146146
     147    HRESULT addUSBDeviceSource(const com::Utf8Str &aBackend, const com::Utf8Str &aId, const com::Utf8Str &aAddress,
     148                               const std::vector<com::Utf8Str> &aPropertyNames, const std::vector<com::Utf8Str> &aPropertyValues);
     149
     150    HRESULT removeUSBDeviceSource(const com::Utf8Str &aId);
     151
    147152    // Internal Methods.
    148153
  • trunk/src/VBox/Main/include/USBProxyBackend.h

    r60068 r60089  
    3030#include "VirtualBoxImpl.h"
    3131#include "HostUSBDeviceImpl.h"
     32#include "USBProxyBackendWrap.h"
    3233class USBProxyService;
    3334
     
    3536 * Base class for the USB Proxy Backend.
    3637 */
    37 class USBProxyBackend
    38     : public VirtualBoxTranslatable
    39 {
    40 public:
    41     USBProxyBackend(USBProxyService *pUsbProxyService);
    42     virtual int init(void);
    43     virtual ~USBProxyBackend();
    44 
    45     /**
    46      * Override of the default locking class to be used for validating lock
    47      * order with the standard member lock handle.
    48      */
    49     virtual VBoxLockingClass getLockingClass() const
    50     {
    51         // the USB proxy service uses the Host object lock, so return the
    52         // same locking class as the host
    53         return LOCKCLASS_HOSTOBJECT;
    54     }
     38class ATL_NO_VTABLE USBProxyBackend
     39    : public USBProxyBackendWrap
     40{
     41public:
     42
     43    DECLARE_EMPTY_CTOR_DTOR (USBProxyBackend)
     44
     45    HRESULT FinalConstruct();
     46    void FinalRelease();
     47
     48    // public initializer/uninitializer for internal purposes only
     49    virtual int init(USBProxyService *pUsbProxyService, const com::Utf8Str &strId, const com::Utf8Str &strAddress);
     50    virtual void uninit();
    5551
    5652    bool isActive(void);
    57 
    58     RWLockHandle *lockHandle() const;
     53    const com::Utf8Str &i_getId();
     54    uint32_t i_getRefCount();
    5955
    6056    /** @name Interface for the USBController and the Host object.
     
    9692    virtual PUSBDEVICE getDevices(void);
    9793    bool updateDeviceStateFake(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters, SessionMachine **aIgnoreMachine);
     94    uint32_t incRef();
     95    uint32_t decRef();
    9896
    9997    static HRESULT setError(HRESULT aResultCode, const char *aText, ...);
     
    104102private:
    105103
     104    // wrapped IUSBProxyBackend properties
     105    HRESULT getName(com::Utf8Str &aName);
     106    HRESULT getType(com::Utf8Str &aType);
     107
    106108    static DECLCALLBACK(int) serviceThread(RTTHREAD Thread, void *pvUser);
    107109
    108110protected:
    109111    /** Pointer to the owning USB Proxy Service object. */
    110     USBProxyService *m_pUsbProxyService;
     112    USBProxyService   *m_pUsbProxyService;
    111113    /** Thread handle of the service thread. */
    112     RTTHREAD         mThread;
     114    RTTHREAD           mThread;
    113115    /** Flag which stop() sets to cause serviceThread to return. */
    114     bool volatile    mTerminate;
     116    bool volatile      mTerminate;
     117    /** Id of the instance. */
     118    const com::Utf8Str m_strId;
     119    /** Reference counter which prevents the backend instance from being removed. */
     120    uint32_t           m_cRefs;
    115121};
    116122
     
    130136{
    131137public:
    132     USBProxyBackendDarwin(USBProxyService *pUsbProxyService);
    133     int init(void);
    134     ~USBProxyBackendDarwin();
     138    DECLARE_EMPTY_CTOR_DTOR (USBProxyBackendDarwin)
     139
     140    int init(USBProxyService *pUsbProxyService, const com::Utf8Str &strId, const com::Utf8Str &strAddress);
     141    void uninit();
    135142
    136143    virtual void *insertFilter(PCUSBFILTER aFilter);
     
    179186{
    180187public:
    181     USBProxyBackendLinux(USBProxyService *pUsbProxyService);
    182     int init(void);
    183     ~USBProxyBackendLinux();
     188    DECLARE_EMPTY_CTOR_DTOR (USBProxyBackendLinux)
     189
     190    int init(USBProxyService *pUsbProxyService, const com::Utf8Str &strId, const com::Utf8Str &strAddress);
     191    void uninit();
    184192
    185193    virtual int captureDevice(HostUSBDevice *aDevice);
     
    230238{
    231239public:
    232     USBProxyBackendOs2 (USBProxyService *pUsbProxyService);
    233     /// @todo virtual int init(void);
    234     ~USBProxyBackendOs2();
     240    DECLARE_EMPTY_CTOR_DTOR (USBProxyBackend)
    235241
    236242    virtual int captureDevice (HostUSBDevice *aDevice);
     
    272278{
    273279public:
    274     USBProxyBackendSolaris(USBProxyService *pUsbProxyService);
    275     int init(void);
    276     ~USBProxyBackendSolaris();
     280    DECLARE_EMPTY_CTOR_DTOR (USBProxyBackendSolaris)
     281
     282    int init(USBProxyService *pUsbProxyService, const com::Utf8Str &strId, const com::Utf8Str &strAddress);
     283    void uninit();
    277284
    278285    virtual void *insertFilter (PCUSBFILTER aFilter);
     
    305312{
    306313public:
    307     USBProxyBackendWindows(USBProxyService *pUsbProxyService);
    308     int init(void);
    309     ~USBProxyBackendWindows();
     314    DECLARE_EMPTY_CTOR_DTOR (USBProxyBackendWindows)
     315
     316    int init(USBProxyService *pUsbProxyService, const com::Utf8Str &strId, const com::Utf8Str &strAddress);
     317    void uninit();
    310318
    311319    virtual void *insertFilter (PCUSBFILTER aFilter);
     
    334342{
    335343public:
    336     USBProxyBackendFreeBSD(USBProxyService *pUsbProxyService);
    337     int init(void);
    338     ~USBProxyBackendFreeBSD();
     344    DECLARE_EMPTY_CTOR_DTOR (USBProxyBackendFreeBSD)
     345
     346    int init(USBProxyService *pUsbProxyService, const com::Utf8Str &strId, const com::Utf8Str &strAddress);
     347    void uninit();
    339348
    340349    virtual int captureDevice(HostUSBDevice *aDevice);
     
    369378    /** Waiting for the complete reception of a UsbIpExportedDevice structure. */
    370379    kUsbIpRecvState_ExportedDevice,
    371     /** Waiting for a complete reception a UsbIpDeviceInterface strucutre to skip. */
     380    /** Waiting for a complete reception of a UsbIpDeviceInterface structure to skip. */
    372381    kUsbIpRecvState_DeviceInterface,
    373382    /** 32bit hack. */
     
    385394{
    386395public:
    387     USBProxyBackendUsbIp(USBProxyService *pUsbProxyService);
    388     int init(void);
    389     ~USBProxyBackendUsbIp();
     396    DECLARE_EMPTY_CTOR_DTOR (USBProxyBackendUsbIp)
     397
     398    int init(USBProxyService *pUsbProxyService, const com::Utf8Str &strId, const com::Utf8Str &strAddress);
     399    void uninit();
    390400
    391401    virtual int captureDevice(HostUSBDevice *aDevice);
  • trunk/src/VBox/Main/include/USBProxyService.h

    r60068 r60089  
    5151    }
    5252
     53    void uninit(void);
     54
    5355    bool isActive(void);
    5456    int getLastError(void);
     
    6567     * @{ */
    6668    HRESULT getDeviceCollection(std::vector<ComPtr<IHostUSBDevice> > &aUSBDevices);
     69    HRESULT addUSBDeviceSource(const com::Utf8Str &aBackend, const com::Utf8Str &aId, const com::Utf8Str &aAddress,
     70                               const std::vector<com::Utf8Str> &aPropertyNames, const std::vector<com::Utf8Str> &aPropertyValues);
     71    HRESULT removeUSBDeviceSource(const com::Utf8Str &aId);
    6772    /** @} */
    6873
     
    7883
    7984    void i_updateDeviceList(USBProxyBackend *pUsbProxyBackend, PUSBDEVICE pDevices);
    80     void i_getUSBFilters(USBDeviceFilterList *pGlobalFiltes);
     85    void i_getUSBFilters(USBDeviceFilterList *pGlobalFilters);
    8186
    8287protected:
     
    8489
    8590    static HRESULT setError(HRESULT aResultCode, const char *aText, ...);
     91
     92    USBProxyBackend *findUsbProxyBackendById(const com::Utf8Str &strId);
    8693
    8794private:
     
    94101    HostUSBDeviceList mDevices;
    95102    /** List of USBProxyBackend pointers. */
    96     typedef std::list<USBProxyBackend *> USBProxyBackendList;
     103    typedef std::list<ComObjPtr<USBProxyBackend> > USBProxyBackendList;
    97104    /** List of active USB backends. */
    98105    USBProxyBackendList mBackends;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette