Skip to content

Commit

Permalink
PR IntelRealSense#13220 from Noy-Zini: Update rs-fw-update readme & b…
Browse files Browse the repository at this point in the history
…ug fix
  • Loading branch information
Nir-Az authored Aug 1, 2024
2 parents b7ba086 + e59e139 commit f22025d
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 25 deletions.
4 changes: 4 additions & 0 deletions src/ds/d400/d400-fw-update-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
1 change: 1 addition & 0 deletions src/ds/d400/d400-fw-update-device.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ namespace librealsense

virtual bool check_fw_compatibility(const std::vector<uint8_t>& 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<uint8_t>& buffer) const;
};
Expand Down
6 changes: 6 additions & 0 deletions src/ds/d500/d500-fw-update-device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
1 change: 1 addition & 0 deletions src/ds/d500/d500-fw-update-device.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace librealsense
bool wait_for_manifest_completion(std::shared_ptr<platform::usb_messenger> 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<uint8_t>& buffer) const;
Expand Down
2 changes: 1 addition & 1 deletion src/fw-update/fw-update-device.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
54 changes: 30 additions & 24 deletions tools/fw-update/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,67 +13,73 @@ 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
```

## Command Line Parameters

|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|

Expand Down

0 comments on commit f22025d

Please sign in to comment.