Skip to content

Commit

Permalink
UNDO getMxId() and extra debug
Browse files Browse the repository at this point in the history
  • Loading branch information
diablodale committed May 11, 2023
1 parent a1786f9 commit de21468
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
5 changes: 5 additions & 0 deletions include/depthai/xlink/XLinkConnection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ class XLinkConnection {
constexpr static std::chrono::milliseconds WAIT_FOR_BOOTUP_TIMEOUT{15000};
constexpr static std::chrono::milliseconds WAIT_FOR_CONNECT_TIMEOUT{5000};
constexpr static std::chrono::milliseconds POLLING_DELAY_TIME{10};

public:
std::string getMxId() const {
return deviceInfo.getMxId();
}
};

} // namespace dai
3 changes: 3 additions & 0 deletions include/depthai/xlink/XLinkStream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ class XLinkStream {
[[deprecated]] void readRawRelease();

streamId_t getStreamId() const;
std::string getMxId() const {
return connection->getMxId();
}
};

struct XLinkError : public std::runtime_error {
Expand Down
2 changes: 1 addition & 1 deletion src/device/DeviceBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ void DeviceBase::init2(Config cfg, const dai::Path& pathToMvcmd, tl::optional<co
return rpcStream->read();
} catch(const std::exception& e) {
// If any exception is thrown, log it and rethrow
implLogger.debug("RPC error: {}", e.what());
implLogger.warn("RPC mxid({}) error: {}", rpcStream->getMxId(), e.what());
throw std::system_error(std::make_error_code(std::errc::io_error), "Device already closed or disconnected");
}
});
Expand Down
12 changes: 8 additions & 4 deletions src/xlink/XLinkConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ void XLinkConnection::close() {

const auto ret = XLinkResetRemoteTimeout(deviceLinkId, static_cast<int>(std::chrono::duration_cast<std::chrono::milliseconds>(RESET_TIMEOUT).count()));
if(ret != X_LINK_SUCCESS) {
logger::debug("XLinkResetRemoteTimeout({}) returned: {}", previousLinkId, XLinkErrorToStr(ret));
logger::warn("XLinkResetRemoteTimeout({}) mxid({}) returned: {}", previousLinkId, deviceInfo.getMxId(), XLinkErrorToStr(ret));
}

deviceLinkId = -1;
Expand All @@ -326,20 +326,24 @@ void XLinkConnection::close() {
}
if(steady_clock::now() - t1 >= BOOTUP_SEARCH) {
if(found) {
logger::debug("XLinkResetRemoteTimeout({}) post-reboot({}s) unusable state {}",
logger::warn("XLinkResetRemoteTimeout({}) mxid({}) post-reboot({}s) unusable state {}",
previousLinkId,
deviceInfo.getMxId(),
BOOTUP_SEARCH.count(),
rebootingDeviceInfo.toString());
} else {
logger::debug("XLinkResetRemoteTimeout({}) post-reboot({}s) can't find device", previousLinkId, BOOTUP_SEARCH.count());
logger::warn("XLinkResetRemoteTimeout({}) mxid({}) post-reboot({}s) can't find device",
previousLinkId,
deviceInfo.getMxId(),
BOOTUP_SEARCH.count());
}
break;
}
std::this_thread::sleep_for(POLLING_DELAY_TIME);
};
}

logger::debug("XLinkResetRemoteTimeout({})", previousLinkId);
logger::debug("XLinkResetRemoteTimeout({}) mxid({})", previousLinkId, deviceInfo.getMxId());
}
}

Expand Down

0 comments on commit de21468

Please sign in to comment.