Skip to content

Commit

Permalink
check fw compatibility for dfu via mipi
Browse files Browse the repository at this point in the history
  • Loading branch information
remibettan committed Jul 31, 2022
1 parent 182fd92 commit 56beeb2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
11 changes: 9 additions & 2 deletions common/fw-update-helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,19 @@ namespace rs2
return false;
}

void firmware_update_manager::process_flow_mipi()
void firmware_update_manager_mipi::process_flow(std::function<void()> cleanup, invoker invoke)
{
if (!_is_signed)
{
LOG_INFO("Only Signed Firmware can be burnt on MIPI device");
return;
}
auto dev_updatable = _dev.as<updatable>();
if(!(dev_updatable && dev_updatable.check_firmware_compatibility(_fw)))
{
fail("Firmware Update failed - fw version must be newer than version 5.13.1.1");
return;
}

// Enter DFU mode
auto device_debug = _dev.as<rs2::debug_protocol>();
Expand Down Expand Up @@ -238,7 +244,8 @@ namespace rs2
auto str = _dev.get_info(RS2_CAMERA_INFO_PRODUCT_ID);
if (!strcmp(_dev.get_info(RS2_CAMERA_INFO_PRODUCT_ID), "ABCD")) // if device is D457
{
process_flow_mipi();
firmware_update_manager_mipi fw_update_mgr_mipi(_not_model, _model, _dev, _ctx, _fw, _is_signed);
fw_update_mgr_mipi.process_flow(cleanup, invoke);
return;
}

Expand Down
21 changes: 19 additions & 2 deletions common/fw-update-helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#pragma once

#include "notifications.h"
#include "../src/fw-update/fw-update-device-interface.h"


namespace rs2
Expand All @@ -28,10 +29,9 @@ namespace rs2
const device_model& get_device_model() const { return _model; }
std::shared_ptr<notifications_model> get_protected_notification_model() { return _not_model.lock(); };

private:
protected:
void process_flow(std::function<void()> cleanup,
invoker invoke) override;
void process_flow_mipi();
bool check_for(
std::function<bool()> action, std::function<void()> cleanup,
std::chrono::system_clock::duration delta);
Expand All @@ -44,6 +44,23 @@ namespace rs2
device_model& _model;
};

class firmware_update_manager_mipi : public process_manager
{
public:
firmware_update_manager_mipi(std::weak_ptr<notifications_model> not_model, device_model& model, device dev, context ctx, std::vector<uint8_t> fw, bool is_signed)
: process_manager("Firmware Update Mipi"), _not_model(not_model), _model(model),
_fw(fw), _is_signed(is_signed), _dev(dev), _ctx(ctx) {}
void process_flow(std::function<void()> cleanup, invoker invoke);

private:
std::weak_ptr<notifications_model> _not_model;
device _dev;
context _ctx;
std::vector<uint8_t> _fw;
bool _is_signed;
device_model& _model;
};

struct fw_update_notification_model : public process_notification_model
{
fw_update_notification_model(std::string name,
Expand Down
3 changes: 2 additions & 1 deletion src/ds5/ds5-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,8 @@ namespace librealsense
{RS465_PID, "5.12.7.100" },
{RS416_RGB_PID, "5.8.15.0" },
{RS405_PID, "5.12.11.8" },
{RS455_PID, "5.12.7.100" }
{RS455_PID, "5.12.7.100" },
{RS457_PID, "5.13.1.1" }
};


Expand Down

0 comments on commit 56beeb2

Please sign in to comment.