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

Update firmware of D415 #4416

Closed
ghost opened this issue Jul 12, 2019 · 14 comments
Closed

Update firmware of D415 #4416

ghost opened this issue Jul 12, 2019 · 14 comments
Labels
fw update Firmware Update

Comments

@ghost
Copy link

ghost commented Jul 12, 2019

I have a requirement to check the firmware and if it is not recommended update the firmware to recommended firmware.

How to update the firmware from the python code.

if firmware_update_require:
//update the firmware from code

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Jul 12, 2019

I found a couple of function names that may be useful for your investigation.

RS2_CAMERA_INFO_FIRMWARE_VERSION]
RS2_CAMERA_INFO_RECOMMENDED_FIRMWARE_VERSION

https://github.com/IntelRealSense/librealsense/blob/development/include/librealsense2/h/rs_sensor.h#L25

More info here about firmware checking:

#3818 (comment)

Please also note that a new cross-platform firmware update system was introduced in SDK version 2.24.0. You can read about it in that version's release notes, under the 'New features & improvements' heading.

https://github.com/IntelRealSense/librealsense/wiki/Release-Notes#release-2240

The standalone rs-fw-update tool referenced by the release notes can be found here:

https://github.com/IntelRealSense/librealsense/tree/master/tools/fw-update

@ghost
Copy link
Author

ghost commented Jul 12, 2019

@MartyG-RealSense, i can check what is the firmware version of the camera but how can i download and update the firmware from my python code if the version does not match.
I am using pyrealsense2, does that module provides any inbuilt tool to upgrade or downgrade the firmware ?

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Jul 12, 2019

I think that in the cross-platform update system, the firmware updating process may be handled by a script called fw-update-helper.

https://github.com/IntelRealSense/librealsense/blob/master/common/fw-update-helper.cpp

@radfordi
Copy link
Contributor

radfordi commented Jul 12, 2019

Firmware update is now build into librealsense. There is a new command line program fw-update that updates the firwmare. You can take a look at the source to see how to call this yourself. The summary is to check to see if the rs2::device is an rs2::update_device and then call update with firmware image. update_device is supported in python.

@radfordi
Copy link
Contributor

Here's a quick schematic of how to update a D435 or D435i in python:

import pyrealsense2 as rs
ctx = rs.context()
dev = ctx.query_devices()[0]
ud = dev.as_update_device()
ud.update(open("common/fw/D4XX_FW_Image-5.11.6.250.bin", "rb").read())

@dorodnic
Copy link
Contributor

It's a bit more complicated than that, but generally, yes, update_device and updatable are the two relevant interfaces.
First, you need to cast D400 device to updatable and call enter_update_mode if I recall correctly.
Next you need to wait until new device appears and case it to update device.
Then you can call update, and everything should be fine.
This is however somewhat delicate flow, that I don't encourage integrating directly into your application. Using provided tools (rs-fw-update or the RealSense Viewer) is safer alternative.

@dorodnic dorodnic added the fw update Firmware Update label Jul 13, 2019
@ghost
Copy link
Author

ghost commented Jul 15, 2019

@radfordi I am calling this function:
upgrade_fw = dev.as_update_device()
upgrade_fw.update(open("./Intel/Signed_Image_UVC_5_10_3_0.bin", "rb").read())

but i am getting RuntimeError: null pointer passed for argument "device"

@radfordi
Copy link
Contributor

radfordi commented Jul 15, 2019

Thanks @dorodnic, I had missed the updatable bit.

Here's an updated "schematic" update process:

import pyrealsense2 as rs
ctx = rs.context()

dev = ctx.query_devices()[0]
dev.as_updatable().enter_update_state()

import time
time.sleep(1) # using ctx.set_devices_changed_callback(), as in rs-fw-update.cpp, would be better

dev = ctx.query_devices()[0]
dev.as_update_device().update(open("common/fw/D4XX_FW_Image-5.11.6.250.bin", "rb").read())

@lramati
Copy link
Contributor

lramati commented Aug 20, 2019

It looks like the two new classes of rs2::update_device and rs2::updatable were not properly registered in the python bindings. This may be the cause of some problems. I will fix this for inclusion in a future release.

@lramati
Copy link
Contributor

lramati commented Sep 2, 2019

This was addressed in PR #4758

@RealSenseCustomerSupport
Copy link
Collaborator


@itachi134999 Could you please try the latest v2.28 to see if it meets your need? Thanks!

@RealSenseCustomerSupport
Copy link
Collaborator


@itachi13499 Any other questions about this? Looking forward to your update. Thanks!

@raghav1906
Copy link

import pyrealsense2 as rs
ctx = rs.context()

dev = ctx.query_devices()[0]
dev.as_updatable().enter_update_state()

import time
time.sleep(1)

dev = ctx.query_devices()[0]
dev.as_update_device().update(open("Signed_Image_UVC_5_11_6_250.bin", "rb").read())

I used this code to update the firmware but when i executed it, the camera got disconnected and I got an error message saying:
Runtime Error: access denied for 8086:adb uid: 2-3-5
Can someone help me fix this??

@avizipi
Copy link

avizipi commented Feb 26, 2023

just for future reference the python code suggested here will not work.
better (and working) python code for firmware update:

import pyrealsense2 as rs
fw_file = "Signed_Image_UVC_5_12_6_0.bin"
ctx = rs.context()
dev = ctx.query_devices()[0]
with open(fw_file, "rb") as fw:
    dev.as_update_device().update(list(fw.read()))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fw update Firmware Update
Projects
None yet
Development

No branches or pull requests

7 participants