Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't get GVD a second time to check if camera is locked #12528

Merged
merged 2 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let delete the other function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted unused functions

{
_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
Loading