VirtualBox

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


Ignore:
Timestamp:
Apr 28, 2016 1:55:03 PM (9 years ago)
Author:
vboxsync
Message:

Main/USBProxy{Service|Backend}: Rework interaction between thos two to be more sane than it currently is (calling into each other back and forth)

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

Legend:

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

    r60108 r60742  
    6767    virtual int captureDevice(HostUSBDevice *aDevice);
    6868    virtual void captureDeviceCompleted(HostUSBDevice *aDevice, bool aSuccess);
    69     /** @todo unused */
    70     virtual void detachingDevice(HostUSBDevice *aDevice);
    7169    virtual int releaseDevice(HostUSBDevice *aDevice);
    7270    virtual void releaseDeviceCompleted(HostUSBDevice *aDevice, bool aSuccess);
     
    7472
    7573    static void freeDevice(PUSBDEVICE pDevice);
    76 
    77     HRESULT runAllFiltersOnDevice(ComObjPtr<HostUSBDevice> &aDevice,
    78                                   SessionMachinesList &llOpenedMachines,
    79                                   SessionMachine *aIgnoreMachine);
    80     bool runMachineFilters(SessionMachine *aMachine, ComObjPtr<HostUSBDevice> &aDevice);
    81 
    82     virtual void deviceAdded(ComObjPtr<HostUSBDevice> &aDevice, SessionMachinesList &llOpenedMachines, PUSBDEVICE aUSBDevice);
    83     virtual void deviceRemoved(ComObjPtr<HostUSBDevice> &aDevice);
    84     virtual void deviceChanged(ComObjPtr<HostUSBDevice> &aDevice, SessionMachinesList *pllOpenedMachines, SessionMachine *aIgnoreMachine);
    85     virtual bool updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters, SessionMachine **aIgnoreMachine);
    8674
    8775protected:
     
    9482    virtual int interruptWait(void);
    9583    virtual PUSBDEVICE getDevices(void);
    96     bool updateDeviceStateFake(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters, SessionMachine **aIgnoreMachine);
    9784    uint32_t incRef();
    9885    uint32_t decRef();
     
    10289    static void initFilterFromDevice(PUSBFILTER aFilter, HostUSBDevice *aDevice);
    10390    static void freeDeviceMembers(PUSBDEVICE pDevice);
     91
     92    /**
     93     * Backend specific callback when a device was added.
     94     * (Currently only Linux uses it to adjust the udev polling).
     95     */
     96    virtual void deviceAdded(ComObjPtr<HostUSBDevice> &aDevice, PUSBDEVICE pDev);
    10497
    10598private:
     
    110103
    111104    static DECLCALLBACK(int) serviceThread(RTTHREAD Thread, void *pvUser);
     105
     106    void updateDeviceList(PUSBDEVICE pDevices);
    112107
    113108protected:
     
    126121    /** Reference counter which prevents the backend instance from being removed. */
    127122    uint32_t           m_cRefs;
     123    /** List of smart HostUSBDevice pointers. */
     124    typedef std::list<ComObjPtr<HostUSBDevice> > HostUSBDeviceList;
     125    /** List of the known USB devices for this backend. */
     126    HostUSBDeviceList  m_llDevices;
    128127};
    129128
     
    153152    virtual int captureDevice(HostUSBDevice *aDevice);
    154153    virtual void captureDeviceCompleted(HostUSBDevice *aDevice, bool aSuccess);
    155     /** @todo unused */
    156     virtual void detachingDevice(HostUSBDevice *aDevice);
    157154    virtual int releaseDevice(HostUSBDevice *aDevice);
    158155    virtual void releaseDeviceCompleted(HostUSBDevice *aDevice, bool aSuccess);
     
    164161    virtual void serviceThreadInit (void);
    165162    virtual void serviceThreadTerm (void);
    166     virtual bool updateDeviceState (HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters, SessionMachine **aIgnoreMachine);
    167163
    168164private:
     
    208204    virtual int interruptWait(void);
    209205    virtual PUSBDEVICE getDevices(void);
    210     virtual void deviceAdded(ComObjPtr<HostUSBDevice> &aDevice, SessionMachinesList &llOpenedMachines, PUSBDEVICE aUSBDevice);
    211     virtual bool updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters, SessionMachine **aIgnoreMachine);
     206    virtual void deviceAdded(ComObjPtr<HostUSBDevice> &aDevice, PUSBDEVICE aUSBDevice);
    212207
    213208private:
     
    255250    virtual PUSBDEVICE getDevices(void);
    256251    int addDeviceToChain(PUSBDEVICE pDev, PUSBDEVICE *ppFirst, PUSBDEVICE **pppNext, int rc);
    257     virtual bool updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters, SessionMachine **aIgnoreMachine);
    258252
    259253private:
     
    302296    virtual int interruptWait(void);
    303297    virtual PUSBDEVICE getDevices(void);
    304     virtual bool updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters, SessionMachine **aIgnoreMachine);
    305298
    306299private:
     
    334327    virtual int interruptWait(void);
    335328    virtual PUSBDEVICE getDevices(void);
    336     virtual bool updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters, SessionMachine **aIgnoreMachine);
    337329
    338330private:
     
    365357    int addDeviceToChain(PUSBDEVICE pDev, PUSBDEVICE *ppFirst, PUSBDEVICE **pppNext, int rc);
    366358    virtual void deviceAdded(ComObjPtr<HostUSBDevice> &aDevice, SessionMachinesList &llOpenedMachines, PUSBDEVICE aUSBDevice);
    367     virtual bool updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters, SessionMachine **aIgnoreMachine);
    368359
    369360private:
     
    413404    virtual int interruptWait(void);
    414405    virtual PUSBDEVICE getDevices(void);
    415     virtual bool updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters, SessionMachine **aIgnoreMachine);
    416406
    417407private:
  • trunk/src/VBox/Main/include/USBProxyService.h

    r60107 r60742  
    8383    typedef std::list< ComObjPtr<HostUSBDeviceFilter> > USBDeviceFilterList;
    8484
    85     void i_updateDeviceList(USBProxyBackend *pUsbProxyBackend, PUSBDEVICE pDevices);
    86     void i_getUSBFilters(USBDeviceFilterList *pGlobalFilters);
    87 
    8885    HRESULT i_loadSettings(const settings::USBDeviceSourcesList &llUSBDeviceSources);
    8986    HRESULT i_saveSettings(settings::USBDeviceSourcesList &llUSBDeviceSources);
     87
     88    void i_deviceAdded(ComObjPtr<HostUSBDevice> &aDevice, PUSBDEVICE aUSBDevice);
     89    void i_deviceRemoved(ComObjPtr<HostUSBDevice> &aDevice);
     90    void i_updateDeviceState(ComObjPtr<HostUSBDevice> &aDevice, PUSBDEVICE aUSBDevice, bool fFakeUpdate);
    9091
    9192protected:
     
    101102
    102103private:
     104
     105    HRESULT runAllFiltersOnDevice(ComObjPtr<HostUSBDevice> &aDevice,
     106                                  SessionMachinesList &llOpenedMachines,
     107                                  SessionMachine *aIgnoreMachine);
     108    bool runMachineFilters(SessionMachine *aMachine, ComObjPtr<HostUSBDevice> &aDevice);
     109
     110    void deviceChanged(ComObjPtr<HostUSBDevice> &aDevice, bool fRunFilters, SessionMachine *aIgnoreMachine);
    103111
    104112    /** Pointer to the Host object. */
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