diff --git a/src/ds/d400/d400-fw-update-device.cpp b/src/ds/d400/d400-fw-update-device.cpp index ec18af4a1b..ff0182a892 100644 --- a/src/ds/d400/d400-fw-update-device.cpp +++ b/src/ds/d400/d400-fw-update-device.cpp @@ -65,4 +65,8 @@ ds_d400_update_device::ds_d400_update_device( return rv.str(); } + float ds_d400_update_device::compute_progress(float progress, float start, float end, float threshold) const + { + return (progress*100); + } } diff --git a/src/ds/d400/d400-fw-update-device.h b/src/ds/d400/d400-fw-update-device.h index a1ed524a33..1105d5b700 100644 --- a/src/ds/d400/d400-fw-update-device.h +++ b/src/ds/d400/d400-fw-update-device.h @@ -18,6 +18,7 @@ namespace librealsense virtual bool check_fw_compatibility(const std::vector& image) const override; + float compute_progress(float progress, float start, float end, float threshold) const override; private: std::string parse_serial_number(const std::vector& buffer) const; }; diff --git a/src/ds/d500/d500-fw-update-device.cpp b/src/ds/d500/d500-fw-update-device.cpp index aa20914dfd..9a06449090 100644 --- a/src/ds/d500/d500-fw-update-device.cpp +++ b/src/ds/d500/d500-fw-update-device.cpp @@ -153,4 +153,10 @@ ds_d500_update_device::ds_d500_update_device( std::shared_ptr< const device_info else std::this_thread::sleep_for(std::chrono::seconds(required_dfu_time)); } + float ds_d500_update_device::compute_progress(float progress, float start, float end, float threshold) const + { + if (threshold < 1.f) + throw std::invalid_argument("Avoid division by zero"); + return start + (ceil(progress * threshold) / threshold) * (end - start) / 100.f; + } } diff --git a/src/ds/d500/d500-fw-update-device.h b/src/ds/d500/d500-fw-update-device.h index 61f5f79f09..367e7afbbe 100644 --- a/src/ds/d500/d500-fw-update-device.h +++ b/src/ds/d500/d500-fw-update-device.h @@ -19,6 +19,7 @@ namespace librealsense bool wait_for_manifest_completion(std::shared_ptr messenger, const rs2_dfu_state state, std::chrono::seconds timeout_seconds, rs2_update_progress_callback_sptr update_progress_callback) const; virtual void dfu_manifest_phase(const platform::rs_usb_messenger& messenger, rs2_update_progress_callback_sptr update_progress_callback) const override; + float compute_progress(float progress, float start, float end, float threshold) const override; private: std::string parse_serial_number(const std::vector& buffer) const; diff --git a/src/fw-update/fw-update-device.h b/src/fw-update/fw-update-device.h index 019474c335..fd3ee8d0a1 100644 --- a/src/fw-update/fw-update-device.h +++ b/src/fw-update/fw-update-device.h @@ -162,7 +162,7 @@ namespace librealsense const std::string & get_serial_number() const { return _serial_number; } std::string to_string(platform::usb_status state) const; std::string to_string(rs2_dfu_state state) const; - float compute_progress(float progress, float start, float end, float threshold) const; + virtual float compute_progress(float progress, float start, float end, float threshold) const; const int DEFAULT_TIMEOUT = 100; const int FW_UPDATE_INTERFACE_NUMBER = 0; diff --git a/tools/fw-update/readme.md b/tools/fw-update/readme.md index 3c0eb4a157..4bb696147b 100644 --- a/tools/fw-update/readme.md +++ b/tools/fw-update/readme.md @@ -13,55 +13,56 @@ After installing `librealsense` run ` rs-fw-update -l` to launch the tool and pr An example for output for a D415 camera is: ``` -connected devices: -1) Name: Intel RealSense D415, serial number: 725112060411, ASIC serial number: 012345678901, firmware version: 05.11.01.100, USB type: 3.2 +Connected devices: +1) [USB] Intel RealSense D435IF s/n 038322070306, update serial number: 039223050231, firmware version: 5.15.1 ``` -Then we will provid the serial number to identify the device together with the path to firmware file that we want to update ` rs-fw-update -s 725112060411 -f Signed_Image_UVC_5_11_6_250.bin`. +Then we will provid the serial number to identify the device together with the path to firmware file that we want to update ` rs-fw-update -s 038322070306 -f Signed_Image_UVC_5_15_1_0.bin`. An example for the expected output is: ``` -search for device with serial number: 725112060411 +Search for device with serial number: 038322070306 -update to FW: Signed_Image_UVC_5_11_6_250.bin +Updating device FW: +[USB] Intel RealSense D435IF s/n 038322070306, update serial number: 039223050231, firmware version: 5.15.1 -updating device: -Name: Intel RealSense D415, serial number: 725112060411, ASIC serial number: 012345678901, firmware version: 05.11.01.100, USB type: 3.2 +Firmware update started. Please don't disconnect device! -firmware update started +Firmware update progress: 100[%] -firmware update progress: 100[%] +Firmware update done -firmware update done +Waiting for device to reconnect... -device 725112060411 successfully updated to FW: 05.11.06.250 +Device 038322070306 successfully updated to FW: 5.15.1 ``` -In case only one camera is connected you can simply run ` rs-fw-update -f Signed_Image_UVC_5_11_6_250.bin`. +In case only one camera is connected you can simply run ` rs-fw-update -f Signed_Image_UVC_5_15_1_0.bin`. A camera/s might be in a recovery state, in such case listing the devices will output the following: ``` -connected devices: -1) Name: Intel RealSense D4xx Recovery, serial number: unknown, ASIC serial number: 012345678901, firmware version: unknown, USB type: unknown +Connected devices: +1) [0ADB] Intel RealSense D4XX Recovery, update serial number: 039223050231, firmware version: 5.16.0.1 ``` -In such case we can use the recovery flag and run ` rs-fw-update -r -f Signed_Image_UVC_5_11_6_250.bin` +In such case we can use the recovery flag and run ` rs-fw-update -r -f Signed_Image_UVC_5_15_1_0.bin` An example for the expected output is: ``` -update to FW: Signed_Image_UVC_5_11_6_250.bin +Update to FW: Signed_Image_UVC_5_15_1_0.bin -recovering device: -Name: Intel RealSense D4xx Recovery, serial number: unknown, ASIC serial number: 012345678901, firmware version: unknown, USB type: unknown +Recovering device: +[0ADB] Intel RealSense D4XX Recovery, update serial number: 039223050231, firmware version: 5.16.0.1 -firmware update started +Firmware update started. Please don't disconnect device! -firmware update progress: 100[%] +Firmware update progress: 100[%] -firmware update done +Firmware update done +Waiting for new device... -recovery done +Recovery done ``` @@ -69,11 +70,16 @@ recovery done |Flag |Description | |---|---| -|`-s`| The serial number of the device to be update, this is mandetory if more than one device is connected| +|`--sw-only`|Show only software devices (playback, DDS, etc. -- but not USB/HID/etc.)| +|`-b`|Create a backup to the camera flash and saved it to the given path| +|`-s`|The serial number of the device to be update, this is mandetory if more than one device is connected| |`-f`|Path of the firmware image file| +|`-u`|Update unsigned firmware, available only for unlocked cameras| |`-r`|Recover all connected devices which are in recovery mode| |`-l`|List all available devices and exits| -|`-v`|Displays version information and exits| +|`--debug`|Turn on LibRS debug logs| +|`--`|Ignores the rest of the labeled arguments following this flag.| +|`--version`|Displays version information and exits| |`-h`|Displays usage information and exits| | None| List supported streaming modes|