Skip to content

Commit

Permalink
PR #12528 from OhadMeir: Don't get GVD a second time to check if came…
Browse files Browse the repository at this point in the history
…ra is locked
  • Loading branch information
Nir-Az authored Dec 20, 2023
2 parents 509dbd9 + e7aecfe commit ab04b1e
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/ds/d400/d400-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ namespace librealsense

if (_fw_version >= firmware_version("5.6.3.0"))
{
_is_locked = _ds_device_common->is_locked(GVD, is_camera_locked_offset);
_is_locked = _ds_device_common->is_locked( gvd_buff.data(), is_camera_locked_offset );
}

if (_fw_version >= firmware_version("5.5.8.0"))
Expand Down
2 changes: 1 addition & 1 deletion src/ds/d500/d500-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ namespace librealsense

pid_hex_str = rsutils::string::from() << std::uppercase << rsutils::string::hexdump( _pid );

_is_locked = _ds_device_common->is_locked(GVD, is_camera_locked_offset);
_is_locked = _ds_device_common->is_locked( gvd_buff.data(), is_camera_locked_offset );

depth_sensor.register_option(RS2_OPTION_OUTPUT_TRIGGER_ENABLED,
std::make_shared<uvc_xu_option<uint8_t>>(raw_depth_sensor, depth_xu, DS5_EXT_TRIGGER,
Expand Down
4 changes: 2 additions & 2 deletions src/ds/ds-device-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ namespace librealsense
throw std::runtime_error("device not referenced in the product line");
}

bool ds_device_common::is_locked(uint8_t gvd_cmd, uint32_t offset)
bool ds_device_common::is_locked( const uint8_t * gvd_buff, uint32_t offset )
{
_is_locked = _hw_monitor->is_camera_locked(gvd_cmd, offset);
std::memcpy( &_is_locked, gvd_buff + offset, 1 );
return _is_locked;
}

Expand Down
4 changes: 2 additions & 2 deletions src/ds/ds-device-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ namespace librealsense
ds_device_common(device* ds_device, std::shared_ptr<hw_monitor> hwm) :
_owner(ds_device),
_hw_monitor(hwm),
_is_locked(false)
_is_locked(true)
{}

void enter_update_state() const;
std::vector<uint8_t> backup_flash( rs2_update_progress_callback_sptr callback);
void update_flash(const std::vector<uint8_t>& image, rs2_update_progress_callback_sptr callback, int update_mode);

bool is_camera_in_advanced_mode() const;
bool is_locked(uint8_t gvd_cmd, uint32_t offset);
bool is_locked( const uint8_t * gvd_buff, uint32_t offset );
void get_fw_details( const std::vector<uint8_t> &gvd_buff, std::string& optic_serial, std::string& asic_serial, std::string& fwv ) const;

private:
Expand Down
9 changes: 0 additions & 9 deletions src/hw-monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,4 @@ namespace librealsense
auto minSize = std::min(sz, data.size());
std::memcpy( gvd, data.data(), minSize );
}

bool hw_monitor::is_camera_locked(uint8_t gvd_cmd, uint32_t offset) const
{
std::vector<unsigned char> gvd(HW_MONITOR_BUFFER_SIZE);
get_gvd(gvd.size(), gvd.data(), gvd_cmd);
bool value;
std::memcpy( &value, gvd.data() + offset, 1 );
return value;
}
}
1 change: 0 additions & 1 deletion src/hw-monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@ namespace librealsense
}

static std::string get_module_serial_string(const std::vector<uint8_t>& buff, size_t index, size_t length = 6);
bool is_camera_locked(uint8_t gvd_cmd, uint32_t offset) const;

template <typename T>
T get_gvd_field(const std::vector<uint8_t>& data, size_t index)
Expand Down

0 comments on commit ab04b1e

Please sign in to comment.