-
Notifications
You must be signed in to change notification settings - Fork 4.9k
FW check for recovery mode #9683
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
Changes from all commits
61df276
f183dcd
f0ee359
4faab60
e2e8ac8
c06d54e
fca85e1
bc98d0c
b228ca4
321f171
2f081c2
edf3a1d
14db184
652f0ff
a49dafd
d7fc0ce
a97676e
4ca0788
0b1ac64
e4a1193
702305e
25da84e
0bea4c8
c5d2456
c6063c1
412c0cf
5ef86ad
4ad7862
98c5b93
6359b4a
d652c84
6482747
422184d
f33f7db
50a9959
1feaea9
f21d4a5
f3b24db
535009a
b21fb16
b9ef758
b67ca25
649e555
1f46f74
e3073f6
0cce4a3
8efea0d
dd2abe8
b5a3d32
ee4932f
5189b1d
c87e10c
a650efb
b3bc7dc
4f64434
ff1780f
d42509a
bf3febf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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"}}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
#include "l500-fw-update-device.h" | ||
#include "l500-private.h" | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) | ||
|
@@ -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. | ||
|
Uh oh!
There was an error while loading. Please reload this page.