-
Notifications
You must be signed in to change notification settings - Fork 5k
FW update aligned for D400/D500 #12395
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7c94a18
align d500 dfu
Nir-Az fda6646
CR updates
Nir-Az c5f712e
fix indent
Nir-Az 24d14dc
d500 recovery pid removed
Nir-Az 209c76c
updates new DFU timings for D500
Nir-Az d1ed76d
fix indent
Nir-Az c59029c
remove case and change size to unsigned int
Nir-Az File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| // License: Apache 2.0. See LICENSE file in root directory. | ||
| // Copyright(c) 2023 Intel Corporation. All Rights Reserved. | ||
|
|
||
| #include "d500-fw-update-device.h" | ||
| #include "d500-private.h" | ||
|
|
||
|
|
||
| namespace librealsense | ||
| { | ||
| ds_d500_update_device::ds_d500_update_device( std::shared_ptr< const device_info > const & dev_info, | ||
| std::shared_ptr< platform::usb_device > const & usb_device ) | ||
| : update_device( dev_info, usb_device, "D500" ) | ||
| { | ||
| auto info = usb_device->get_info(); | ||
| _name = ds::rs500_sku_names.find(info.pid) != ds::rs500_sku_names.end() ? ds::rs500_sku_names.at(info.pid) : "unknown"; | ||
| _serial_number = parse_serial_number(_serial_number_buffer); | ||
| } | ||
|
|
||
|
|
||
| bool ds_d500_update_device::check_fw_compatibility(const std::vector<uint8_t>& image) const | ||
| { | ||
| // Currently we cannot extract FW version from HKR FW image | ||
| bool result = true; | ||
|
|
||
| // TODO::: Once verified we can check against the minimal FW version map | ||
| std::string fw_version = extract_firmware_version_string(image); | ||
| LOG_INFO( "FW version extracted from the FW image is" + fw_version ); | ||
|
|
||
| return result; | ||
| } | ||
|
|
||
| std::string ds_d500_update_device::parse_serial_number(const std::vector<uint8_t>& buffer) const | ||
| { | ||
| if (buffer.size() != sizeof(serial_number_data)) | ||
| throw std::runtime_error("DFU - failed to parse serial number!"); | ||
|
|
||
| std::stringstream rv; | ||
| for (auto i = 0; i < ds::module_serial_size; i++) | ||
| rv << std::setfill('0') << std::setw(2) << std::hex << static_cast<int>(buffer[i]); | ||
|
|
||
| return rv.str(); | ||
| } | ||
|
|
||
| void ds_d500_update_device::update(const void* fw_image, int fw_image_size, rs2_update_progress_callback_sptr update_progress_callback) const | ||
| { | ||
| update_device::update( fw_image, fw_image_size ); | ||
|
|
||
| static constexpr float D500_FW_DFU_TIME = 180.0; // [sec] | ||
| // We calculate the sleep time needed for each cycle to get to 100% progress bar | ||
| // On D500 devices after transferring the FW image the internal DFU progress start on the device | ||
| float iteration_sleep_time_ms = (static_cast<float>(D500_FW_DFU_TIME) / 100.0f) * 1000.0f; | ||
| for(int i = 1; i <= 100; i++) | ||
| { | ||
| if (update_progress_callback) | ||
| update_progress_callback->on_update_progress( i / 100.f ); | ||
| std::this_thread::sleep_for(std::chrono::milliseconds(static_cast<int>(iteration_sleep_time_ms))); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // License: Apache 2.0. See LICENSE file in root directory. | ||
| // Copyright(c) 2023 Intel Corporation. All Rights Reserved. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "fw-update/fw-update-device.h" | ||
|
|
||
| namespace librealsense | ||
| { | ||
| class ds_d500_update_device : public update_device | ||
| { | ||
| public: | ||
| ds_d500_update_device( std::shared_ptr< const device_info > const &, | ||
| std::shared_ptr< platform::usb_device > const & usb_device ); | ||
| virtual ~ds_d500_update_device() = default; | ||
|
|
||
| virtual bool check_fw_compatibility(const std::vector<uint8_t>& image) const override; | ||
| virtual void update(const void* fw_image, int fw_image_size, rs2_update_progress_callback_sptr = nullptr) const override; | ||
|
|
||
| private: | ||
| std::string parse_serial_number(const std::vector<uint8_t>& buffer) const; | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.