Skip to content

Commit 11d175b

Browse files
author
SzabolcsGergely
committed
Merge remote-tracking branch 'origin/develop' into HEAD
2 parents 25bacff + 1a542a3 commit 11d175b

File tree

7 files changed

+71
-4
lines changed

7 files changed

+71
-4
lines changed

cmake/Depthai/DepthaiDeviceSideConfig.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set(DEPTHAI_DEVICE_SIDE_MATURITY "snapshot")
33

44
# "full commit hash of device side binary"
5-
set(DEPTHAI_DEVICE_SIDE_COMMIT "81701b1fe003b50e9bd17862a7f9c0b1ffdaf53a")
5+
set(DEPTHAI_DEVICE_SIDE_COMMIT "ff550421ac5b2f333e58735f3c5e1d0085d9f0c9")
66

77
# "version if applicable"
88
set(DEPTHAI_DEVICE_SIDE_VERSION "")

cmake/Hunter/config.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ hunter_config(
88
hunter_config(
99
XLink
1010
VERSION "luxonis-2021.4.2-develop"
11-
URL "https://github.com/luxonis/XLink/archive/1ef2f960eec66540891434c9a3341c11e66e4360.tar.gz"
12-
SHA1 "23641bb9ae698d0e016abcce349094a38577838b"
11+
URL "https://github.com/luxonis/XLink/archive/b7c3aca2ba8b9d598be886a8076a875b50f5184f.tar.gz"
12+
SHA1 "6c19757c6fe6871a9f40688871edbfc6f1e939ee"
1313
)
1414

1515
hunter_config(

examples/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,3 +359,6 @@ dai_add_example(apriltag_rgb AprilTag/apriltag_rgb.cpp ON)
359359
# DetectionParser
360360
dai_add_example(detection_parser NeuralNetwork/detection_parser.cpp ON)
361361
target_compile_definitions(detection_parser PRIVATE BLOB_PATH="${mobilenet_blob}")
362+
363+
# DetectionParser
364+
dai_add_example(crash_report CrashReport/crash_report.cpp OFF)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#include <fstream>
2+
#include <iostream>
3+
4+
// Includes common necessary includes for development using depthai library
5+
#include "depthai/depthai.hpp"
6+
7+
static bool fileExists(dai::Path path) {
8+
std::ifstream file(path);
9+
return file.is_open();
10+
}
11+
12+
int main() {
13+
using namespace std;
14+
15+
// Connect to device and start pipeline
16+
dai::Device device;
17+
if(device.hasCrashDump()) {
18+
auto crashDump = device.getCrashDump();
19+
std::string commitHash = crashDump.depthaiCommitHash;
20+
std::string deviceId = crashDump.deviceId;
21+
22+
auto json = crashDump.serializeToJson();
23+
24+
for(int i = 0;; i++) {
25+
dai::Path destPath = "crashDump_" + to_string(i) + "_" + deviceId + "_" + commitHash + ".json";
26+
if(fileExists(destPath)) continue;
27+
28+
std::ofstream ob(destPath);
29+
ob << std::setw(4) << json << std::endl;
30+
31+
std::cout << "Crash dump found on your device!" << std::endl;
32+
std::cout << "Saved to " << std::string(destPath) << std::endl;
33+
std::cout << "Please report to developers!" << std::endl;
34+
break;
35+
}
36+
} else {
37+
std::cout << "There was no crash dump found on your device!" << std::endl;
38+
}
39+
40+
return 0;
41+
}

include/depthai/device/DeviceBase.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "depthai-shared/common/CpuUsage.hpp"
3131
#include "depthai-shared/common/MemoryInfo.hpp"
3232
#include "depthai-shared/device/BoardConfig.hpp"
33+
#include "depthai-shared/device/CrashDump.hpp"
3334
#include "depthai-shared/log/LogLevel.hpp"
3435
#include "depthai-shared/log/LogMessage.hpp"
3536

@@ -450,6 +451,16 @@ class DeviceBase {
450451
*/
451452
std::vector<std::tuple<std::string, int, int>> getIrDrivers();
452453

454+
/**
455+
* Retrieves crash dump for debugging.
456+
*/
457+
dai::CrashDump getCrashDump();
458+
459+
/**
460+
* Retrieves whether the is crash dump stored on device or not.
461+
*/
462+
bool hasCrashDump();
463+
453464
/**
454465
* Add a callback for device logging. The callback will be called from a separate thread with the LogMessage being passed.
455466
*

src/device/DeviceBase.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "depthai-bootloader-shared/Bootloader.hpp"
88
#include "depthai-bootloader-shared/XLinkConstants.hpp"
99
#include "depthai-shared/datatype/RawImgFrame.hpp"
10+
#include "depthai-shared/device/CrashDump.hpp"
1011
#include "depthai-shared/log/LogConstants.hpp"
1112
#include "depthai-shared/log/LogLevel.hpp"
1213
#include "depthai-shared/log/LogMessage.hpp"
@@ -965,6 +966,17 @@ std::vector<std::tuple<std::string, int, int>> DeviceBase::getIrDrivers() {
965966
return pimpl->rpcClient->call("getIrDrivers");
966967
}
967968

969+
dai::CrashDump DeviceBase::getCrashDump() {
970+
checkClosed();
971+
972+
return pimpl->rpcClient->call("getCrashDump").as<dai::CrashDump>();
973+
}
974+
975+
bool DeviceBase::hasCrashDump() {
976+
dai::CrashDump crashDump = getCrashDump();
977+
return !crashDump.crashReports.empty();
978+
}
979+
968980
int DeviceBase::addLogCallback(std::function<void(LogMessage)> callback) {
969981
checkClosed();
970982

0 commit comments

Comments
 (0)