Skip to content

Commit

Permalink
fix includes and add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
maloel committed Dec 2, 2023
1 parent 2e312a6 commit 8296e55
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions src/fw-update/fw-update-device-interface.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2019 Intel Corporation. All Rights Reserved.

// Copyright(c) 2023 Intel Corporation. All Rights Reserved.
#pragma once

#include "../types.h"
#include <src/core/device-interface.h>
#include "../usb/usb-types.h"
#include <cstddef>
#include <librealsense2/hpp/rs_types.hpp>
#include <cstdint>
#include <vector>


namespace librealsense
{
Expand All @@ -16,20 +16,33 @@ namespace librealsense
virtual bool check_fw_compatibility(const std::vector<uint8_t>& image) const = 0;
};

// Regular devices inherit to enable entering DFU state or implementing unsigned FW update.
class updatable : public firmware_check_interface
{
public:
// Places the device in DFU (recovery) mode, where the DFU process can continue with update_device_interface.
// Restarts the device!
virtual void enter_update_state() const = 0;
virtual std::vector<uint8_t> backup_flash( rs2_update_progress_callback_sptr callback) = 0;
virtual void update_flash(const std::vector<uint8_t>& image, rs2_update_progress_callback_sptr callback, int update_mode) = 0;

// Returns a backup of the current flash image. Optional: return an empty buffer if unsupported
virtual std::vector< uint8_t > backup_flash( rs2_update_progress_callback_sptr callback ) = 0;

// Unsigned FW update. When this is called, we're not in an "update state".
virtual void update_flash( const std::vector< uint8_t > & image,
rs2_update_progress_callback_sptr callback,
int update_mode )
= 0;
};

MAP_EXTENSION( RS2_EXTENSION_UPDATABLE, updatable );

// Recovery devices implement this to perform DFU with signed FW.
class update_device_interface : public device_interface, public firmware_check_interface
{
public:
virtual void update(const void* fw_image, int fw_image_size, rs2_update_progress_callback_sptr = nullptr) const = 0;
// Signed FW update
virtual void update( const void * fw_image, int fw_image_size, rs2_update_progress_callback_sptr = nullptr ) const = 0;

protected:
virtual const std::string& get_name() const = 0;
virtual const std::string& get_product_line() const = 0;
Expand Down

0 comments on commit 8296e55

Please sign in to comment.