diff --git a/src/linux/backend-v4l2.h b/src/linux/backend-v4l2.h index bc24df144e..034e3ace4e 100644 --- a/src/linux/backend-v4l2.h +++ b/src/linux/backend-v4l2.h @@ -355,6 +355,7 @@ namespace librealsense void set_power_state(power_state state) override; power_state get_power_state() const override { return _state; } + void register_xu( platform::extension_unit && xu ) override {} void init_xu(const extension_unit&) override {} bool set_xu(const extension_unit& xu, uint8_t control, const uint8_t* data, int size) override; bool get_xu(const extension_unit& xu, uint8_t control, uint8_t* data, int size) const override; diff --git a/src/mf/mf-uvc.cpp b/src/mf/mf-uvc.cpp index 305cfab412..6e985c462e 100644 --- a/src/mf/mf-uvc.cpp +++ b/src/mf/mf-uvc.cpp @@ -885,6 +885,9 @@ namespace librealsense CHECK_HR(MFCreateSourceReaderFromMediaSource(_source, _reader_attrs, &_reader)); CHECK_HR(_reader->SetStreamSelection(static_cast(MF_SOURCE_READER_ALL_STREAMS), TRUE)); _power_state = D0; + + for( auto && xu : _xus ) + init_xu( xu ); } void wmf_uvc_device::set_d3() diff --git a/src/mf/mf-uvc.h b/src/mf/mf-uvc.h index 1ae61ab5a0..d2025c74ee 100644 --- a/src/mf/mf-uvc.h +++ b/src/mf/mf-uvc.h @@ -79,6 +79,7 @@ namespace librealsense static bool is_connected(const uvc_device_info& info); static void foreach_uvc_device(enumeration_callback action); + void register_xu( platform::extension_unit && xu ) override { _xus.push_back( std::move( xu ) ); } void init_xu(const extension_unit& xu) override; bool set_xu(const extension_unit& xu, uint8_t ctrl, const uint8_t* data, int len) override; bool get_xu(const extension_unit& xu, uint8_t ctrl, uint8_t* data, int len) const override; @@ -146,6 +147,7 @@ namespace librealsense bool _streaming = false; std::atomic _is_started = false; std::wstring _device_id; + std::vector< platform::extension_unit > _xus; }; class source_reader_callback : public IMFSourceReaderCallback diff --git a/src/platform/uvc-device.h b/src/platform/uvc-device.h index b6267990f0..5b21ea042b 100644 --- a/src/platform/uvc-device.h +++ b/src/platform/uvc-device.h @@ -128,6 +128,7 @@ class uvc_device virtual void set_power_state( power_state state ) = 0; virtual power_state get_power_state() const = 0; + virtual void register_xu( platform::extension_unit && xu ) = 0; virtual void init_xu( const extension_unit & xu ) = 0; virtual bool set_xu( const extension_unit & xu, uint8_t ctrl, const uint8_t * data, int len ) = 0; virtual bool get_xu( const extension_unit & xu, uint8_t ctrl, uint8_t * data, int len ) const = 0; @@ -183,6 +184,8 @@ class retry_controls_work_around : public uvc_device power_state get_power_state() const override { return _dev->get_power_state(); } + void register_xu( platform::extension_unit && xu ) override { _dev->register_xu( std::move( xu ) ); } + void init_xu( const extension_unit & xu ) override { _dev->init_xu( xu ); } bool set_xu( const extension_unit & xu, uint8_t ctrl, const uint8_t * data, int len ) override @@ -313,6 +316,8 @@ class multi_pins_uvc_device : public uvc_device power_state get_power_state() const override { return _dev.front()->get_power_state(); } + void register_xu( platform::extension_unit && xu ) override { _dev.front()->register_xu( std::move( xu ) ); } + void init_xu( const extension_unit & xu ) override { _dev.front()->init_xu( xu ); } bool set_xu( const extension_unit & xu, uint8_t ctrl, const uint8_t * data, int len ) override diff --git a/src/uvc-sensor.cpp b/src/uvc-sensor.cpp index fab565af0f..c617c165ca 100644 --- a/src/uvc-sensor.cpp +++ b/src/uvc-sensor.cpp @@ -372,7 +372,7 @@ void uvc_sensor::finished_bulk_operation() void uvc_sensor::register_xu( platform::extension_unit xu ) { - _xus.push_back( std::move( xu ) ); + _device->register_xu( std::move( xu ) ); } @@ -419,8 +419,6 @@ void uvc_sensor::acquire_power() try { _device->set_power_state( platform::D0 ); - for( auto && xu : _xus ) - _device->init_xu( xu ); } catch( std::exception const & e ) { diff --git a/src/uvc-sensor.h b/src/uvc-sensor.h index f2370d56b0..ffc63dc3b7 100644 --- a/src/uvc-sensor.h +++ b/src/uvc-sensor.h @@ -104,7 +104,6 @@ class uvc_sensor : public raw_sensor_base std::atomic< int > _user_count; std::mutex _power_lock; std::mutex _configure_lock; - std::vector< platform::extension_unit > _xus; std::unique_ptr< power > _power; std::unique_ptr< frame_timestamp_reader > _timestamp_reader; }; diff --git a/src/uvc/uvc-device.h b/src/uvc/uvc-device.h index aa9b6c93d1..6441f44c48 100644 --- a/src/uvc/uvc-device.h +++ b/src/uvc/uvc-device.h @@ -51,6 +51,7 @@ namespace librealsense virtual void set_power_state(power_state state) override; virtual power_state get_power_state() const override; + void register_xu( platform::extension_unit && xu ) override {} // Not supported virtual void init_xu(const extension_unit& xu) override; virtual bool set_xu(const extension_unit& xu, uint8_t ctrl, const uint8_t* data, int len) override; virtual bool get_xu(const extension_unit& xu, uint8_t ctrl, uint8_t* data, int len) const override;