Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/DeviceBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "depthai-shared/device/CrashDump.hpp"

// std::chrono bindings
#include <XLink/XLinkPublicDefines.h>
#include <pybind11/chrono.h>
// py::detail
#include <pybind11/detail/common.h>
Expand Down Expand Up @@ -41,8 +42,14 @@ static auto deviceSearchHelper(Args&&... args){
auto numConnected = DEVICE::getAllAvailableDevices().size();
if(numConnected > 0) {
throw std::runtime_error("No available devices (" + std::to_string(numConnected) + " connected, but in use)");
} else {
throw std::runtime_error("No available devices");
}
auto numDevicesAnyPlatform = dai::XLinkConnection::getAllConnectedDevices(X_LINK_ANY_STATE, false, X_LINK_ANY_PLATFORM).size();
auto numDevicesRVC2 = dai::XLinkConnection::getAllConnectedDevices(
X_LINK_ANY_STATE, false, X_LINK_MYRIAD_X)
.size();
auto nonRVC2Devices = numDevicesAnyPlatform - numDevicesRVC2;
if(nonRVC2Devices > 0) {
throw std::runtime_error("No available RVC2 devices found, but found " + std::to_string(nonRVC2Devices) + " non RVC2 device[s]. To use RVC4 devices, please update DepthAI to version v3.x or newer.");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/XLinkBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void XLinkBindings::bind(pybind11::module &m, void *pCallstack)
.def(py::init<const DeviceInfo &, std::vector<std::uint8_t> >())
.def(py::init<const DeviceInfo &, std::string>())
.def(py::init<const DeviceInfo &>())
.def_static("getAllConnectedDevices", &XLinkConnection::getAllConnectedDevices, py::arg("state") = X_LINK_ANY_STATE, py::arg("skipInvalidDevices") = true)
.def_static("getAllConnectedDevices", &XLinkConnection::getAllConnectedDevices, py::arg("state") = X_LINK_ANY_STATE, py::arg("skipInvalidDevices") = true, py::arg("platform") = X_LINK_MYRIAD_X)
.def_static("getFirstDevice", &XLinkConnection::getFirstDevice, py::arg("state") = X_LINK_ANY_STATE, py::arg("skipInvalidDevice") = true)
.def_static("getDeviceByMxId", &XLinkConnection::getDeviceByMxId, py::arg("mxId"), py::arg("state") = X_LINK_ANY_STATE, py::arg("skipInvalidDevice") = true)
.def_static("bootBootloader", &XLinkConnection::bootBootloader, py::arg("devInfo"))
Expand Down
Loading