Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
61df276
removed thresholds checking part
nohayassin Jul 25, 2021
f183dcd
L500 depth units fix
nohayassin Jul 25, 2021
f0ee359
add depth unit from metadata test
Nir-Az Jul 26, 2021
4faab60
add SR300
Nir-Az Jul 26, 2021
e2e8ac8
fix depth units on SR300 devices
Nir-Az Jul 26, 2021
c06d54e
rename test file
Nir-Az Jul 26, 2021
fca85e1
disable live tests from rec files
Nir-Az Jul 27, 2021
bc98d0c
disable live tests from files on Linux
Nir-Az Jul 27, 2021
b228ca4
change libci.home for Linux and fix test-device-fw-compatibility
maloel Jul 19, 2021
321f171
fix devices.py crash in linux
maloel Jul 20, 2021
2f081c2
remove -S from libci runs
maloel Jul 20, 2021
edf3a1d
repo.build for LibCI Linux (x86_64/static); fix test-fw-update
maloel Jul 20, 2021
14db184
add 5-second extra timeout in LibCI device waits
maloel Jul 20, 2021
652f0ff
protect playback sensor call to user callback
Nir-Az Jul 29, 2021
a49dafd
Added missing DS error codes
aangerma Jul 27, 2021
d7fc0ce
merge record and playback readme files
Nir-Az Jul 27, 2021
a97676e
replace _ with -
Nir-Az Jul 29, 2021
4ca0788
Start device_watcher on register_internal_device_callback also.
aangerma Jul 27, 2021
0b1ac64
Some update.
aangerma Jul 28, 2021
e4a1193
CR fixes
aangerma Jul 29, 2021
702305e
release point cloud resources on android
gwen2018 Jul 28, 2021
25da84e
option receiver sensitivity added to python wrapper
remibettan Jul 29, 2021
0bea4c8
adjusting java-example to androidX
remibettan Jul 26, 2021
c5d2456
adding the gradle-wrapper.properties file to repo
remibettan Jul 26, 2021
c6063c1
gradle and gradle version upgraded
remibettan Jul 27, 2021
412c0cf
removing build warning
remibettan Jul 28, 2021
5ef86ad
Fix build on macOS arm64
prusnak Jun 20, 2021
4ad7862
update LZ4 to version 1.9.3
Nir-Az Jul 29, 2021
98c5b93
remove downloding test files
Nir-Az Aug 1, 2021
6359b4a
fix record and playback readme link
Nir-Az Aug 2, 2021
d652c84
fix more links
Nir-Az Aug 2, 2021
6482747
Memleak fix - remove circular shared_ptr dependency in pointcloud pro…
ev-mp Aug 2, 2021
422184d
Typo fix
ev-mp Aug 2, 2021
f33f7db
hdr merge - discarding merged frame if counter diff is higher than 10
remibettan Jul 26, 2021
50a9959
checking frame metadata supported
remibettan Jul 26, 2021
1feaea9
code review corrections
remibettan Aug 2, 2021
f21d4a5
Added unit tests for sw_update::version
aangerma Jul 29, 2021
f3b24db
Added Nir's test
aangerma Aug 1, 2021
535009a
CR fixes
aangerma Aug 1, 2021
b21fb16
Added unit tests.
aangerma Aug 1, 2021
b9ef758
move test into string utilities; add some tests; fix bug in version
maloel Aug 4, 2021
b67ca25
adding flag in device_watcher_usbhost, correcting Sensor java class r…
remibettan Aug 1, 2021
649e555
calling stop method in the device_watcher instance method (singleton)
remibettan Aug 3, 2021
1f46f74
add skelton for LRS updates docs
Nir-Az Aug 5, 2021
e3073f6
update descriptions
Nir-Az Aug 5, 2021
0cce4a3
Update viewer-sw-fw-update.md
maloel Aug 5, 2021
8efea0d
remove support for L535 FW update to allow recovery update
Nir-Az Aug 4, 2021
dd2abe8
Notify on FW update on DFU mode
Nir-Az Aug 4, 2021
b5a3d32
do not show fw update notification when manual update is displayed
Nir-Az Aug 4, 2021
ee4932f
get FW by pid
Nir-Az Aug 5, 2021
5189b1d
reduce FW tables storage size in ram
Nir-Az Aug 5, 2021
c87e10c
L535 recovery pid addition
Nir-Az Aug 8, 2021
a650efb
check supported option
Nir-Az Aug 8, 2021
b3bc7dc
added FW check when device is in recovery mode
Aug 25, 2021
4f64434
fix PR comments - added pid to the error
Aug 29, 2021
ff1780f
fixed PR notes
Sep 5, 2021
d42509a
added a fw size check for sr3xx in recovery
Sep 9, 2021
bf3febf
Merge branch 'development' of https://github.com/IntelRealSense/libre…
Sep 9, 2021
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
9 changes: 6 additions & 3 deletions src/ds5/ds5-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,16 @@ namespace librealsense

bool ds5_device::check_fw_compatibility(const std::vector<uint8_t>& image) const
{
std::string fw_version = extract_firmware_version_string((const void*)image.data(), image.size());
std::string fw_version = extract_firmware_version_string(image);

auto it = ds::device_to_fw_min_version.find(_pid);
if (it == ds::device_to_fw_min_version.end())
throw std::runtime_error("Minimum firmware version has not been defined for this device!");
throw librealsense::invalid_value_exception(to_string() << "Min and Max firmware versions have not been defined for this device: " << std::hex << _pid);
bool result = (firmware_version(fw_version) >= firmware_version(it->second));
if (!result)
LOG_ERROR(fw_version);

return (firmware_version(fw_version) >= firmware_version(it->second));
return result;
}

class ds5_depth_sensor : public synthetic_sensor, public video_sensor_interface, public depth_stereo_sensor, public roi_sensor_base
Expand Down
13 changes: 13 additions & 0 deletions src/ds5/ds5-fw-update-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ namespace librealsense
update_device::update(fw_image, fw_image_size, callback);
}

bool ds_update_device::check_fw_compatibility(const std::vector<uint8_t>& image) const
{
std::string fw_version = extract_firmware_version_string(image);
auto it = ds::device_to_fw_min_version.find(_usb_device->get_info().pid);
if (it == ds::device_to_fw_min_version.end())
throw librealsense::invalid_value_exception(to_string() << "Min and Max firmware versions have not been defined for this device: " << std::hex << _pid);
bool result = (firmware_version(fw_version) >= firmware_version(it->second));
if (!result)
LOG_ERROR(fw_version);

return result;
}

std::string ds_update_device::parse_serial_number(const std::vector<uint8_t>& buffer) const
{
if (buffer.size() != sizeof(serial_number_data))
Expand Down
1 change: 1 addition & 0 deletions src/ds5/ds5-fw-update-device.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace librealsense
virtual ~ds_update_device() = default;

void update(const void* fw_image, int fw_image_size, update_progress_callback_ptr = nullptr) const override;
virtual bool check_fw_compatibility(const std::vector<uint8_t>& image) const override;

protected:
virtual const std::string& get_name() const override { return _name; }
Expand Down
39 changes: 18 additions & 21 deletions src/fw-update/fw-update-device-interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,35 @@

namespace librealsense
{
class updatable
class firmware_check_interface
{
public:
virtual void enter_update_state() const = 0;
virtual std::vector<uint8_t> backup_flash(update_progress_callback_ptr callback) = 0;
virtual void update_flash(const std::vector<uint8_t>& image, update_progress_callback_ptr callback, int update_mode) = 0;
virtual bool check_fw_compatibility(const std::vector<uint8_t>& image) const = 0;
std::string extract_firmware_version_string(const void* fw_image, size_t fw_image_size) const
static std::string extract_firmware_version_string(const std::vector<uint8_t>& fw_image)
{
if (!fw_image)
throw std::runtime_error("Firmware binary image might be corrupted - null pointer");

auto version_offset = offsetof(platform::dfu_header, bcdDevice);
if (fw_image.size() < (version_offset + sizeof(size_t)))
throw std::runtime_error("Firmware binary image might be corrupted - size is only: " + fw_image.size());

if (fw_image_size < (version_offset + sizeof(size_t)))
throw std::runtime_error("Firmware binary image might be corrupted - size is only: " + fw_image_size);

uint32_t version{};

memcpy(reinterpret_cast<char*>(&version), reinterpret_cast<const char*>(fw_image) +
version_offset, sizeof(version));

uint8_t major = (version & 0xFF000000) >> 24;
uint8_t minor = (version & 0x00FF0000) >> 16;
uint8_t patch = (version & 0x0000FF00) >> 8;
uint8_t build = version & 0x000000FF;
auto version = fw_image.data() + version_offset;
uint8_t major = *(version + 3);
uint8_t minor = *(version + 2);
uint8_t patch = *(version + 1);
uint8_t build = *(version);

return std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(patch) + "." + std::to_string(build);
}
};

class update_device_interface : public device_interface
class updatable : public firmware_check_interface
{
public:
virtual void enter_update_state() const = 0;
virtual std::vector<uint8_t> backup_flash(update_progress_callback_ptr callback) = 0;
virtual void update_flash(const std::vector<uint8_t>& image, update_progress_callback_ptr callback, int update_mode) = 0;
};

class update_device_interface : public device_interface, public firmware_check_interface
{
public:
virtual void update(const void* fw_image, int fw_image_size, update_progress_callback_ptr = nullptr) const = 0;
Expand Down
5 changes: 5 additions & 0 deletions src/fw-update/fw-update-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ namespace librealsense

void update_device::update(const void* fw_image, int fw_image_size, update_progress_callback_ptr update_progress_callback) const
{
// checking fw compatibility (covering the case of recovery device with wrong product line fw )
std::vector<uint8_t> buffer((uint8_t*)fw_image, (uint8_t*)fw_image + fw_image_size);
if (!check_fw_compatibility(buffer))
throw librealsense::invalid_value_exception("Device: " + get_serial_number() + " failed to update firmware\nImage is unsupported for this device or corrupted");

auto messenger = _usb_device->open(FW_UPDATE_INTERFACE_NUMBER);

const size_t transfer_size = 1024;
Expand Down
23 changes: 23 additions & 0 deletions src/ivcam/sr300-fw-update-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
// Copyright(c) 2019 Intel Corporation. All Rights Reserved.

#include "sr300-fw-update-device.h"
#include "sr300.h"
#include "ivcam-private.h"
#include <chrono>
#include <thread>


namespace librealsense
{
sr300_update_device::sr300_update_device(std::shared_ptr<context> ctx, bool register_device_notifications, std::shared_ptr<platform::usb_device> usb_device)
Expand All @@ -22,6 +24,27 @@ namespace librealsense
std::this_thread::sleep_for(std::chrono::seconds(10));
}

bool sr300_update_device::check_fw_compatibility(const std::vector<uint8_t>& image) const
{
std::string fw_version = extract_firmware_version_string(image);
auto min_max_fw_it = device_to_fw_min_max_version.find(_usb_device->get_info().pid);
if (min_max_fw_it == device_to_fw_min_max_version.end())
throw librealsense::invalid_value_exception(to_string() << "Min and Max firmware versions have not been defined for this device: " << std::hex << _pid);

// check FW size as well, because on SR3xx it is not enough to use heuristic based on FW version
if (image.size() != signed_sr300_size)
throw librealsense::invalid_value_exception(to_string() << "Unsupported firmware binary image provided - " << image.size() << " bytes");

// advanced SR3XX devices do not fit the "old" fw versions and
// legacy SR3XX devices do not fit the "new" fw versions
bool result = (firmware_version(fw_version) >= firmware_version(min_max_fw_it->second.first)) &&
(firmware_version(fw_version) <= firmware_version(min_max_fw_it->second.second));
if (!result)
LOG_ERROR(fw_version);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Pls elaborate the error details


return result;
}

std::string sr300_update_device::parse_serial_number(const std::vector<uint8_t>& buffer) const
{
if (buffer.size() != sizeof(serial_number_data))
Expand Down
1 change: 1 addition & 0 deletions src/ivcam/sr300-fw-update-device.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace librealsense
sr300_update_device(std::shared_ptr<context> ctx, bool register_device_notifications, std::shared_ptr<platform::usb_device> usb_device);
virtual ~sr300_update_device() = default;
virtual void update(const void* fw_image, int fw_image_size, update_progress_callback_ptr = nullptr) const override;
virtual bool check_fw_compatibility(const std::vector<uint8_t>& image) const override;

protected:
virtual const std::string& get_name() const override { return _name; }
Expand Down
10 changes: 7 additions & 3 deletions src/ivcam/sr300.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,16 +584,20 @@ namespace librealsense

bool sr3xx_camera::check_fw_compatibility(const std::vector<uint8_t>& image) const
{
std::string fw_version = extract_firmware_version_string((const void*)image.data(), image.size());
std::string fw_version = extract_firmware_version_string(image);

auto min_max_fw_it = device_to_fw_min_max_version.find(_pid);
if (min_max_fw_it == device_to_fw_min_max_version.end())
throw std::runtime_error("Min and Max firmware versions have not been defined for this device!");
throw librealsense::invalid_value_exception(to_string() << "Min and Max firmware versions have not been defined for this device: " << std::hex << _pid);

// advanced SR3XX devices do not fit the "old" fw versions and
// legacy SR3XX devices do not fit the "new" fw versions
return (firmware_version(fw_version) >= firmware_version(min_max_fw_it->second.first)) &&
bool result = (firmware_version(fw_version) >= firmware_version(min_max_fw_it->second.first)) &&
(firmware_version(fw_version) <= firmware_version(min_max_fw_it->second.second));
if (!result)
LOG_ERROR(fw_version);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here as well


return result;
}

void sr3xx_camera::create_snapshot(std::shared_ptr<debug_interface>& snapshot) const
Expand Down
8 changes: 4 additions & 4 deletions src/ivcam/sr300.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ namespace librealsense

static std::map<uint16_t, std::pair<std::string, std::string>> device_to_fw_min_max_version = {
{ SR300_PID, {"3.21.0.0", "3.26.3.0"}},
{ SR300v2_PID, {"3.27.0.0", "99.99.99.99"}},
{ SR306_PID, {"3.28.3.0", "99.99.99.99"}},
{ SR306_PID_DBG, {"3.28.3.0", "99.99.99.99"}},
{ SR300_RECOVERY, {"3.21.0.0", "99.99.99.99"}}
{ SR300v2_PID, {"3.27.0.0", "4.99.99.99"}},
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it should be 3.xx, not 4

{ SR306_PID, {"3.28.3.0", "4.99.99.99"}},
{ SR306_PID_DBG, {"3.28.3.0", "4.99.99.99"}},
{ SR300_RECOVERY, {"3.21.0.0", "4.99.99.99"}}
};

class sr300_timestamp_reader : public frame_timestamp_reader
Expand Down
12 changes: 8 additions & 4 deletions src/l500/l500-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -692,15 +692,19 @@ namespace librealsense

bool l500_device::check_fw_compatibility(const std::vector<uint8_t>& image) const
{
std::string fw_version = extract_firmware_version_string((const void*)image.data(), image.size());
std::string fw_version = extract_firmware_version_string(image);

auto min_max_fw_it = ivcam2::device_to_fw_min_max_version.find(_pid);
if (min_max_fw_it == ivcam2::device_to_fw_min_max_version.end())
throw std::runtime_error("Min and Max firmware versions have not been defined for this device!");
throw librealsense::invalid_value_exception(to_string() << "Min and Max firmware versions have not been defined for this device: " << std::hex << _pid);

// Limit L515 to FW versions within the 1.5.1.3-1.99.99.99 range to differenciate from the other products
return (firmware_version(fw_version) >= firmware_version(min_max_fw_it->second.first)) &&
(firmware_version(fw_version) <= firmware_version(min_max_fw_it->second.second));
bool result = (firmware_version(fw_version) >= firmware_version(min_max_fw_it->second.first)) &&
(firmware_version(fw_version) <= firmware_version(min_max_fw_it->second.second));
if (!result)
LOG_ERROR(fw_version);

return result;

}

Expand Down
17 changes: 17 additions & 0 deletions src/l500/l500-fw-update-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "l500-fw-update-device.h"
#include "l500-private.h"


Copy link
Collaborator

Choose a reason for hiding this comment

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

Unintended change, pls drop

namespace librealsense
{
l500_update_device::l500_update_device(std::shared_ptr<context> ctx, bool register_device_notifications, std::shared_ptr<platform::usb_device> usb_device)
Expand All @@ -19,6 +20,22 @@ namespace librealsense
update_device::update(fw_image, fw_image_size, callback);
}

bool l500_update_device::check_fw_compatibility(const std::vector<uint8_t>& image) const
{
std::string fw_version = extract_firmware_version_string(image);
auto min_max_fw_it = ivcam2::device_to_fw_min_max_version.find(_usb_device->get_info().pid);
if (min_max_fw_it == ivcam2::device_to_fw_min_max_version.end())
throw librealsense::invalid_value_exception(to_string() << "Min and Max firmware versions have not been defined for this device: " << std::hex << _pid);

// Limit L515 to FW versions within the 1.5.1.3-1.99.99.99 range to differenciate from the other products
bool result = (firmware_version(fw_version) >= firmware_version(min_max_fw_it->second.first)) &&
(firmware_version(fw_version) <= firmware_version(min_max_fw_it->second.second));
if (!result)
LOG_ERROR(fw_version);

return result;
}

std::string l500_update_device::parse_serial_number(const std::vector<uint8_t>& buffer) const
{
// Note that we are using a specific serial_number_data struct then the generic one.
Expand Down
1 change: 1 addition & 0 deletions src/l500/l500-fw-update-device.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace librealsense
virtual ~l500_update_device() = default;

void update(const void* fw_image, int fw_image_size, update_progress_callback_ptr = nullptr) const override;
virtual bool check_fw_compatibility(const std::vector<uint8_t>& image) const override;

protected:
virtual const std::string& get_name() const override { return _name; }
Expand Down