Skip to content

Commit

Permalink
PR #11474 from Nir-Az: Move FW version & serial numbers parsing to ds…
Browse files Browse the repository at this point in the history
…-common
  • Loading branch information
Nir-Az authored Feb 23, 2023
2 parents 97f88f7 + cc11eec commit 3818cb3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
12 changes: 5 additions & 7 deletions src/ds/d400/d400-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,9 @@ namespace librealsense
return {};
}

ds::d400_caps d400_device::parse_device_capabilities() const
ds::d400_caps d400_device::parse_device_capabilities( const std::vector<uint8_t> &gvd_buf ) const
{
using namespace ds;
std::array<unsigned char,HW_MONITOR_BUFFER_SIZE> gvd_buf;
_hw_monitor->get_gvd(gvd_buf.size(), gvd_buf.data(), GVD);

// Opaque retrieval
d400_caps val{d400_caps::CAP_UNDEFINED};
Expand Down Expand Up @@ -584,14 +582,14 @@ namespace librealsense

_hw_monitor->get_gvd(gvd_buff.size(), gvd_buff.data(), GVD);

optic_serial = _hw_monitor->get_module_serial_string(gvd_buff, module_serial_offset);
asic_serial = _hw_monitor->get_module_serial_string(gvd_buff, module_asic_serial_offset);
auto fwv = _hw_monitor->get_firmware_version_string(gvd_buff, camera_fw_version_offset);
std::string fwv;
_ds_device_common->get_fw_details( gvd_buff, optic_serial, asic_serial, fwv );

_fw_version = firmware_version(fwv);

_recommended_fw_version = firmware_version(D4XX_RECOMMENDED_FIRMWARE_VERSION);
if (_fw_version >= firmware_version("5.10.4.0"))
_device_capabilities = parse_device_capabilities();
_device_capabilities = parse_device_capabilities( gvd_buff );

//D457 Development
advanced_mode = is_camera_in_advanced_mode();
Expand Down
2 changes: 1 addition & 1 deletion src/ds/d400/d400-device.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ namespace librealsense

float get_stereo_baseline_mm() const;

ds::d400_caps parse_device_capabilities() const;
ds::d400_caps parse_device_capabilities( const std::vector<uint8_t> &gvd_buf ) const;

//TODO - add these to device class as pure virtual methods
command get_firmware_logs_command() const;
Expand Down
7 changes: 7 additions & 0 deletions src/ds/ds-device-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ namespace librealsense
return _is_locked;
}

void ds_device_common::get_fw_details( const std::vector<uint8_t> &gvd_buff, std::string& optic_serial, std::string& asic_serial, std::string& fwv ) const
{
optic_serial = _hw_monitor->get_module_serial_string(gvd_buff, module_serial_offset);
asic_serial = _hw_monitor->get_module_serial_string(gvd_buff, module_asic_serial_offset);
fwv = _hw_monitor->get_firmware_version_string(gvd_buff, camera_fw_version_offset);
}

std::vector<uint8_t> ds_device_common::backup_flash(update_progress_callback_ptr callback)
{
int flash_size = 1024 * 2048;
Expand Down
1 change: 1 addition & 0 deletions src/ds/ds-device-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ namespace librealsense

bool is_camera_in_advanced_mode() const;
bool is_locked(uint8_t gvd_cmd, 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:
uvc_sensor& get_raw_depth_sensor();
Expand Down

0 comments on commit 3818cb3

Please sign in to comment.