depthai icon indicating copy to clipboard operation
depthai copied to clipboard

[BUG] getMxId returns `<error>` on Linux when it does not have enough permissions to access the USB device

Open jpc opened this issue 4 years ago • 1 comments

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.

jpc avatar Jul 05 '21 15:07 jpc

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.

Luxonis-Brandon avatar Jul 06 '21 20:07 Luxonis-Brandon