1
1
// License: Apache 2.0. See LICENSE file in root directory.
2
- // Copyright(c) 2019 Intel Corporation. All Rights Reserved.
3
-
2
+ // Copyright(c) 2023 Intel Corporation. All Rights Reserved.
4
3
#pragma once
5
4
6
- #include " ../types.h"
7
5
#include < src/core/device-interface.h>
8
- #include " ../usb/usb-types.h"
9
- #include < cstddef>
6
+ #include < librealsense2/hpp/rs_types.hpp>
7
+ #include < cstdint>
8
+ #include < vector>
9
+
10
10
11
11
namespace librealsense
12
12
{
@@ -16,20 +16,33 @@ namespace librealsense
16
16
virtual bool check_fw_compatibility (const std::vector<uint8_t >& image) const = 0;
17
17
};
18
18
19
+ // Regular devices inherit to enable entering DFU state or implementing unsigned FW update.
19
20
class updatable : public firmware_check_interface
20
21
{
21
22
public:
23
+ // Places the device in DFU (recovery) mode, where the DFU process can continue with update_device_interface.
24
+ // Restarts the device!
22
25
virtual void enter_update_state () const = 0;
23
- virtual std::vector<uint8_t > backup_flash ( rs2_update_progress_callback_sptr callback) = 0;
24
- virtual void update_flash (const std::vector<uint8_t >& image, rs2_update_progress_callback_sptr callback, int update_mode) = 0;
26
+
27
+ // Returns a backup of the current flash image. Optional: return an empty buffer if unsupported
28
+ virtual std::vector< uint8_t > backup_flash ( rs2_update_progress_callback_sptr callback ) = 0;
29
+
30
+ // Unsigned FW update. When this is called, we're not in an "update state".
31
+ virtual void update_flash ( const std::vector< uint8_t > & image,
32
+ rs2_update_progress_callback_sptr callback,
33
+ int update_mode )
34
+ = 0;
25
35
};
26
36
27
37
MAP_EXTENSION ( RS2_EXTENSION_UPDATABLE, updatable );
28
38
39
+ // Recovery devices implement this to perform DFU with signed FW.
29
40
class update_device_interface : public device_interface , public firmware_check_interface
30
41
{
31
42
public:
32
- virtual void update (const void * fw_image, int fw_image_size, rs2_update_progress_callback_sptr = nullptr ) const = 0;
43
+ // Signed FW update
44
+ virtual void update ( const void * fw_image, int fw_image_size, rs2_update_progress_callback_sptr = nullptr ) const = 0;
45
+
33
46
protected:
34
47
virtual const std::string& get_name () const = 0;
35
48
virtual const std::string& get_product_line () const = 0;
0 commit comments