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

L515 FW version compatibility fix #9185

Merged
merged 4 commits into from
Jun 10, 2021
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
11 changes: 7 additions & 4 deletions src/l500/l500-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,11 +696,14 @@ namespace librealsense
{
std::string fw_version = extract_firmware_version_string((const void*)image.data(), image.size());

auto it = ivcam2::device_to_fw_min_version.find(_pid);
if (it == ivcam2::device_to_fw_min_version.end())
throw std::runtime_error("Minimum firmware version has not been defined for this device!");
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!");

// 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));
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 we can use [) for ranges here so it's be < rather than <=?
Then you wouldn't have to write numbers like 1.99.99.99...

I also don't like putting the build number in there. It's got nothing to do with the version number.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The max is required to prevent recognizing D400's 5.12.14.50 as a valid candidate for L515.
Since no formal definition is given 1.99..... is the version that will be currently supported.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm saying rather than <= 1.99.99.99 we should say < 2.0


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

notification l500_notification_decoder::decode(int value)
Expand Down
16 changes: 8 additions & 8 deletions src/l500/l500-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,14 @@ namespace librealsense

};

static std::map<uint16_t, std::string> device_to_fw_min_version = {
{ L500_RECOVERY_PID, "1.4.1.0"},
{ L535_RECOVERY_PID, "1.4.1.0"},
{ L500_USB2_RECOVERY_PID_OLD, "1.4.1.0"},
{ L500_PID, "1.4.1.0"},
{ L515_PID_PRE_PRQ, "1.4.1.0"},
{ L515_PID, "1.4.1.0"},
{ L535_PID, "1.4.1.0"}
static std::map<uint16_t, std::pair<std::string, std::string>> device_to_fw_min_max_version = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not a pair of firmware_version... or even char const *?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can consider firmware_version as enhancement separately, I'm not sure whether it improves readability.

{ L500_RECOVERY_PID, { "1.5.1.3", "1.99.99.99"}},
{ L535_RECOVERY_PID, { "1.5.1.3", "1.99.99.99"}},
{ L500_USB2_RECOVERY_PID_OLD, { "1.5.1.3", "1.99.99.99"}},
{ L500_PID, { "1.5.1.3", "1.99.99.99"}},
{ L515_PID_PRE_PRQ, { "1.5.1.3", "1.99.99.99"}},
{ L515_PID, { "1.5.1.3", "1.99.99.99"}},
{ L535_PID, { "1.5.1.3", "1.99.99.99"}}
};

// Known FW error codes, if we poll for errors (RS2_OPTION_ERROR_POLLING_ENABLED)
Expand Down
25 changes: 13 additions & 12 deletions unit-tests/live/dfu/test-device-fw-compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
d400_fw_min_version_2_prev = 'Signed_Image_UVC_5_12_6_0.bin'
d400_fw_min_version_3_prev = 'Signed_Image_UVC_5_12_11_0.bin'

l500_fw_min_version = 'Signed_Image_UVC_1_4_1_0.bin'
l500_fw_min_version_prev = 'Signed_Image_UVC_1_4_0_10.bin'
l500_fw_min_version_valid = 'Signed_Image_UVC_1_5_1_3.bin'
l500_fw_min_version_invalid = 'Signed_Image_UVC_1_4_1_0.bin'

sr300_fw_min_version_1 = 'Signed_Image_UVC_3_21_0_0.bin'
sr300_fw_min_version_2 = 'Signed_Image_UVC_3_27_0_0.bin'
Expand Down Expand Up @@ -45,18 +45,18 @@
'0B3A': d400_fw_min_version_2, # D435I
'0B49': d400_fw_min_version_1, # D416
'0B4B': d400_fw_min_version_1, # D430I
'0B4D': d400_fw_min_version_1, # D465
'0B4D': d400_fw_min_version_2, # D465
'0B52': d400_fw_min_version_1, # D416_RGB
'0B5B': d400_fw_min_version_3, # D405
'0B5C': d400_fw_min_version_2, # D455
# L500 product line:
'0B55': l500_fw_min_version, # L500_RECOVERY
'0B72': l500_fw_min_version, # L535_RECOVERY
'0ADC': l500_fw_min_version, # L500_USB2_RECOVERY_OLD
'0B0D': l500_fw_min_version, # L500
'0B3D': l500_fw_min_version, # L515_PRE_PRQ
'0B64': l500_fw_min_version, # L515
'0B68': l500_fw_min_version, # L535
'0B55': l500_fw_min_version_valid, # L500_RECOVERY
'0B72': l500_fw_min_version_valid, # L535_RECOVERY
'0ADC': l500_fw_min_version_valid, # L500_USB2_RECOVERY_OLD
'0B0D': l500_fw_min_version_valid, # L500
'0B3D': l500_fw_min_version_valid, # L515_PRE_PRQ
'0B64': l500_fw_min_version_valid, # L515
'0B68': l500_fw_min_version_valid, # L535
# SR300 product line:
'0AA5': sr300_fw_min_version_1, # SR300
'0AB3': sr300_fw_min_version_1, # SR300_RECOVERY
Expand All @@ -75,7 +75,7 @@
fw_previous_version = {d400_fw_min_version_1: d400_fw_min_version_1_prev,
d400_fw_min_version_2: d400_fw_min_version_2_prev,
d400_fw_min_version_3: d400_fw_min_version_3_prev,
l500_fw_min_version: l500_fw_min_version_prev,
l500_fw_min_version_valid: l500_fw_min_version_invalid,
# sr300_fw_min_version_1:sr300_fw_min_version_1_prev, no version before exists
sr300_fw_min_version_2: sr300_fw_min_version_2_prev,
sr300_fw_min_version_3: sr300_fw_min_version_3_prev
Expand Down Expand Up @@ -115,10 +115,11 @@ def get_fw_version_path(product_line_dir, fw_version):
fw_image = bytearray(binary_file.read())
check_firmware_compatible(updatable_device, fw_image)

# Negative
if min_fw_version in fw_previous_version:
one_before_min_fw_version = fw_previous_version[min_fw_version]
one_before_min_fw_version_path = get_fw_version_path(product_line_dir, one_before_min_fw_version)
print("one before: " + one_before_min_fw_version)
print("firware version defined as non-compatible: " + one_before_min_fw_version)
with open(one_before_min_fw_version_path, 'rb') as binary_file:
fw_image = bytearray(binary_file.read())
check_firmware_not_compatible(updatable_device, fw_image)
Expand Down