depthai
depthai copied to clipboard
[BUG] getMxId returns `<error>` on Linux when it does not have enough permissions to access the USB device
Describe the bug
When using the Python depthai bindings on a Jetson AGX I encountered a cryptic problem which turned out to be a simple permissions problem. The code tries to access the USB devices (strace dump):
openat(AT_FDCWD, "/dev/bus/usb/001/002", O_RDWR) = -1 EACCES (Permission denied)
openat(AT_FDCWD, "/dev/bus/usb/001/004", O_RDWR) = -1 EACCES (Permission denied)
and when it gets a permission denied error it does not inform the user but just return <error> in place of the device ID.
Expected behavior
It would be much better if the script logged a warning when it could not access an OAK device because of permissions. Returning <error: EACCESS> or putting strerror output inside it together with the device file name (/dev/bus/usb/001/004) would be even better.
Sorry about the trouble. And thanks for the report and thorough Github issue here! This alone will help others in the situation. We will see what is possible in terms of making a making a useful error message here.