d400-fw-update-device.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2019 Intel Corporation. All Rights Reserved.
3 
5 #include "d400-private.h"
6 
8 
9 namespace librealsense
10 {
12  std::shared_ptr< const device_info > const & dev_info,
13  std::shared_ptr< platform::usb_device > const & usb_device )
14  : update_device( dev_info, usb_device, "D400" )
15  {
16  auto info = usb_device->get_info();
17  _name = ds::rs400_sku_names.find(info.pid) != ds::rs400_sku_names.end() ? ds::rs400_sku_names.at(info.pid) : "unknown";
19  }
20 
21 
22  bool ds_d400_update_device::check_fw_compatibility(const std::vector<uint8_t>& image) const
23  {
24  // check if the given FW size matches the expected FW size
25  if( image.size() != signed_fw_size )
27  rsutils::string::from() << "Unsupported firmware binary image provided - " << image.size() << " bytes" );
28 
30  auto it = ds::d400_device_to_fw_min_version.find(_usb_device->get_info().pid);
33  rsutils::string::from() << "Min and Max firmware versions have not been defined for this device: "
34  << std::hex << _pid );
36  if (!result)
37  LOG_ERROR("Firmware version isn't compatible" << fw_version);
38 
39  return result;
40  }
41 
43  {
44  if (buffer.size() != sizeof(serial_number_data))
45  throw std::runtime_error("DFU - failed to parse serial number!");
46 
47  std::stringstream rv;
48  for (auto i = 0; i < ds::module_serial_size; i++)
49  rv << std::setfill('0') << std::setw(2) << std::hex << static_cast<int>(buffer[i]);
50 
51  return rv.str();
52  }
53 }
librealsense
Definition: algo.h:18
d400-private.h
librealsense::invalid_value_exception
Definition: librealsense-exception.h:114
librealsense::update_device::_serial_number_buffer
std::vector< uint8_t > _serial_number_buffer
Definition: fw-update-device.h:158
d400-fw-update-device.h
librealsense::update_device::_name
std::string _name
Definition: fw-update-device.h:164
string
GLsizei const GLchar *const * string
Definition: glad/glad/glad.h:2861
librealsense::update_device::_usb_device
const platform::rs_usb_device _usb_device
Definition: fw-update-device.h:157
librealsense::serial_number_data
Definition: fw-update-device.h:79
buffer
GLenum GLfloat * buffer
Definition: glad/glad/glad.h:2066
i
int i
Definition: rs-pcl-color.cpp:54
librealsense::update_device::_pid
std::string _pid
Definition: fw-update-device.h:162
librealsense::ds::rs400_sku_names
static const std::map< std::uint16_t, std::string > rs400_sku_names
Definition: d400-private.h:102
librealsense::firmware_version
rsutils::version firmware_version
Definition: src/firmware-version.h:11
librealsense::ds_d400_update_device::parse_serial_number
std::string parse_serial_number(const std::vector< uint8_t > &buffer) const
Definition: d400-fw-update-device.cpp:42
librealsense::update_device
Definition: fw-update-device.h:97
fps.info
info
Definition: fps.py:50
librealsense::ds_d400_update_device::ds_d400_update_device
ds_d400_update_device(std::shared_ptr< const device_info > const &, std::shared_ptr< platform::usb_device > const &usb_device)
Definition: d400-fw-update-device.cpp:11
rsutils::string::from
Definition: from.h:19
signed_fw_size
const unsigned int signed_fw_size
Definition: rs_internal.h:25
librealsense::update_device::_serial_number
std::string _serial_number
Definition: fw-update-device.h:166
librealsense::ds::extract_firmware_version_string
std::string extract_firmware_version_string(const std::vector< uint8_t > &fw_image)
Definition: d400-private.cpp:88
image
GLenum GLenum GLsizei void * image
Definition: glad/glad/glad.h:3587
test-depth_ae_mode.fw_version
fw_version
Definition: test-depth_ae_mode.py:14
usb_device
Definition: usbhost.c:81
end
GLuint GLuint end
Definition: glad/glad/glad.h:2395
it
static auto it
Definition: openvino-face-detection.cpp:375
librealsense::ds_d400_update_device::check_fw_compatibility
virtual bool check_fw_compatibility(const std::vector< uint8_t > &image) const override
Definition: d400-fw-update-device.cpp:22
test-depth.result
result
Definition: test-depth.py:183
librealsense::ds::module_serial_size
@ module_serial_size
Definition: ds-private.h:541
librealsense::ds::d400_device_to_fw_min_version
static std::map< uint16_t, std::string > d400_device_to_fw_min_version
Definition: d400-private.h:129
rs_internal.h
Exposes RealSense internal functionality for C compilers.
LOG_ERROR
#define LOG_ERROR(...)
Definition: easyloggingpp.h:73


librealsense2
Author(s): LibRealSense ROS Team
autogenerated on Mon Apr 22 2024 02:12:56