Skip to content

Commit

Permalink
dfu - rework after review #1
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Perchanov <dmitry.perchanov@intel.com>
  • Loading branch information
dmipx committed May 21, 2024
1 parent bc74750 commit b830283
Show file tree
Hide file tree
Showing 18 changed files with 49 additions and 41 deletions.
2 changes: 1 addition & 1 deletion include/librealsense2/hpp/rs_device.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2024 Intel Corporation. All Rights Reserved.
// Copyright(c) 2017-2024 Intel Corporation. All Rights Reserved.

#ifndef LIBREALSENSE_RS2_DEVICE_HPP
#define LIBREALSENSE_RS2_DEVICE_HPP
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ target_sources(${LRS_TARGET}
"${CMAKE_CURRENT_LIST_DIR}/platform/hid-data.h"
"${CMAKE_CURRENT_LIST_DIR}/platform/hid-device.h"
"${CMAKE_CURRENT_LIST_DIR}/platform/hid-device-info.h"
"${CMAKE_CURRENT_LIST_DIR}/platform/mipi-device.h"
"${CMAKE_CURRENT_LIST_DIR}/platform/mipi-device-info.h"
"${CMAKE_CURRENT_LIST_DIR}/platform/playback-device-info.h"
"${CMAKE_CURRENT_LIST_DIR}/platform/platform-utils.h"
Expand Down
2 changes: 1 addition & 1 deletion src/backend-device-factory.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2024 Intel Corporation. All Rights Reserved.
// Copyright(c) 2023-2024 Intel Corporation. All Rights Reserved.

#include "backend-device-factory.h"
#include "context.h"
Expand Down
3 changes: 1 addition & 2 deletions src/backend.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2024 Intel Corporation. All Rights Reserved.
// Copyright(c) 2015-2024 Intel Corporation. All Rights Reserved.

#pragma once

Expand Down Expand Up @@ -44,7 +44,6 @@ namespace librealsense
virtual std::shared_ptr<hid_device> create_hid_device(hid_device_info info) const = 0;
virtual std::vector<hid_device_info> query_hid_devices() const = 0;

virtual std::shared_ptr<mipi_device> create_mipi_device(mipi_device_info info) const = 0;
virtual std::vector<mipi_device_info> query_mipi_devices() const = 0;

virtual std::shared_ptr<device_watcher> create_device_watcher() const = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/ds/d400/d400-fw-update-device.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2024 Intel Corporation. All Rights Reserved.
// Copyright(c) 2019-2024 Intel Corporation. All Rights Reserved.

#include "d400-fw-update-device.h"
#include "d400-private.h"
Expand Down
2 changes: 1 addition & 1 deletion src/ds/d400/d400-fw-update-device.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2024 Intel Corporation. All Rights Reserved.
// Copyright(c) 2019-2024 Intel Corporation. All Rights Reserved.

#pragma once

Expand Down
2 changes: 1 addition & 1 deletion src/ds/d400/d400-private.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2024 Intel Corporation. All Rights Reserved.
// Copyright(c) 2015-2024 Intel Corporation. All Rights Reserved.

#pragma once

Expand Down
2 changes: 1 addition & 1 deletion src/fw-update/fw-update-device.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2024 Intel Corporation. All Rights Reserved.
// Copyright(c) 2019-2024 Intel Corporation. All Rights Reserved.

#include "fw-update-device.h"
#include "../types.h"
Expand Down
4 changes: 2 additions & 2 deletions src/fw-update/fw-update-device.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <src/core/device-interface.h>
#include "fw-update-device-interface.h"
#include "usb/usb-device.h"
#include "src/platform/mipi-device-info.h"
#include "platform/mipi-device.h"

namespace librealsense
{
Expand All @@ -20,7 +20,7 @@ namespace librealsense
RS2_DFU_STATUS_VERIFY = 0x07, // Programmed memory failed verification.
RS2_DFU_STATUS_ADDRESS = 0x08, // Cannot program memory due to received address that is out of range.
RS2_DFU_STATUS_NOTDONE = 0x09, // Received DFU_DNLOAD with wLength = 0, but device does not think it has all of the data yet.
RS2_DFU_STATUS_FIRMWARE = 0x0A, // Devices firmware is corrupt.It cannot return to run - time (non - DFU) operations.
RS2_DFU_STATUS_FIRMWARE = 0x0A, // Devices firmware is corrupt.It cannot return to run - time (non - DFU) operations.
RS2_DFU_STATUS_VENDOR = 0x0B, // iString indicates a vendor - specific RS2_DFU_STATUS_or.
RS2_DFU_STATUS_USBR = 0x0C, // Device detected unexpected USB reset signaling.
RS2_DFU_STATUS_POR = 0x0D, // Device detected unexpected power on reset.
Expand Down
2 changes: 1 addition & 1 deletion src/fw-update/fw-update-factory.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2024 Intel Corporation. All Rights Reserved.
// Copyright(c) 2019-2024 Intel Corporation. All Rights Reserved.

#include "fw-update-factory.h"
#include "fw-update-device.h"
Expand Down
2 changes: 1 addition & 1 deletion src/fw-update/fw-update-factory.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2024 Intel Corporation. All Rights Reserved.
// Copyright(c) 2019-2024 Intel Corporation. All Rights Reserved.

#pragma once

Expand Down
7 changes: 1 addition & 6 deletions src/linux/backend-v4l2.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2024 Intel Corporation. All Rights Reserved.
// Copyright(c) 2015-2024 Intel Corporation. All Rights Reserved.

#include "backend-v4l2.h"
#include <src/platform/command-transfer.h>
Expand Down Expand Up @@ -2905,11 +2905,6 @@ namespace librealsense
return device_infos;
}

std::shared_ptr<mipi_device> v4l_backend::create_mipi_device(mipi_device_info info) const
{
return nullptr;
}

std::vector<mipi_device_info> v4l_backend::query_mipi_devices() const
{
std::vector<mipi_device_info> mipi_nodes;
Expand Down
3 changes: 1 addition & 2 deletions src/linux/backend-v4l2.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2024 Intel Corporation. All Rights Reserved.
// Copyright(c) 2015-2024 Intel Corporation. All Rights Reserved.

#pragma once

Expand Down Expand Up @@ -515,7 +515,6 @@ namespace librealsense
std::shared_ptr<hid_device> create_hid_device(hid_device_info info) const override;
std::vector<hid_device_info> query_hid_devices() const override;

std::shared_ptr<mipi_device> create_mipi_device(mipi_device_info info) const override;
std::vector<mipi_device_info> query_mipi_devices() const override;

std::shared_ptr<device_watcher> create_device_watcher() const override;
Expand Down
2 changes: 1 addition & 1 deletion src/platform/backend-device-group.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2024 Intel Corporation. All Rights Reserved.
// Copyright(c) 2023-2024 Intel Corporation. All Rights Reserved.

#pragma once

Expand Down
18 changes: 0 additions & 18 deletions src/platform/mipi-device-info.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,5 @@ inline bool operator==( const mipi_device_info & a, const mipi_device_info & b )
&& ( a.device_path == b.device_path );
}

class mipi_device;
typedef std::shared_ptr<mipi_device> rs_mipi_device;

class mipi_device
{
public:
mipi_device(const mipi_device_info& info) : _info(info) {}
virtual ~mipi_device() = default;
static rs_mipi_device create_mipi_device(const mipi_device_info& info)
{
return std::make_shared<mipi_device>(info);
}
const mipi_device_info get_info() const { return _info; };
private:
const mipi_device_info _info;
};


} // namespace platform
} // namespace librealsense
32 changes: 32 additions & 0 deletions src/platform/mipi-device.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2024 Intel Corporation. All Rights Reserved.

#pragma once

#include <sstream>
#include <memory>
#include "mipi-device-info.h"

namespace librealsense {
namespace platform {

class mipi_device;
typedef std::shared_ptr<mipi_device> rs_mipi_device;

class mipi_device
{
public:
mipi_device(const mipi_device_info& info) : _info(info) {}
virtual ~mipi_device() = default;
static rs_mipi_device create_mipi_device(const mipi_device_info& info)
{
return std::make_shared<mipi_device>(info);
}
const mipi_device_info get_info() const { return _info; };
private:
const mipi_device_info _info;
};


} // namespace platform
} // namespace librealsense
2 changes: 1 addition & 1 deletion src/platform/platform-device-info.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2024 Intel Corporation. All Rights Reserved.
// Copyright(c) 2023-2024 Intel Corporation. All Rights Reserved.

#pragma once

Expand Down
2 changes: 1 addition & 1 deletion src/platform/platform-utils.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2024 Intel Corporation. All Rights Reserved.
// Copyright(c) 2023-2024 Intel Corporation. All Rights Reserved.

#pragma once

Expand Down

0 comments on commit b830283

Please sign in to comment.