librealsense: xioctl(UVCIOC_CTRL_QUERY) Device or resource busy errors with kernel 4.19.5

Required Info
Camera Model D430
Firmware Version 5.10.13.0
Operating System & Version Linux (Gentoo)
Kernel Version (Linux Only) 4.19.5
Platform PC
SDK Version master branch at 79dda7f
Language C++
Segment N/A

Issue Description

On Linux kernel 4.19.5 errors are generated when some commands are sent to camera in too quick succession. The error message is: ERROR [139644039424128] (types.h:188) get_xu(...). xioctl(UVCIOC_CTRL_QUERY) failed Last Error: Device or resource busy

Most reliable way to trigger this error is to create an rs2::pipeline, start it with start() and immediately use stream1.get_extrinsics_to(stream2) with appropriate streams. The get_extrinsics_to will throw with above error.

Current workaround is to wait around 3 seconds after starting the pipeline so that the camera can settle and then run get_extrinsics_to without issues.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (3 by maintainers)

Most upvoted comments

Here’s a VERY VERY cheap and dirty workaround:

diff --git a/src/linux/backend-v4l2.cpp b/src/linux/backend-v4l2.cpp
index 3366845e..8eca827d 100644
--- a/src/linux/backend-v4l2.cpp
+++ b/src/linux/backend-v4l2.cpp
@@ -1058,8 +1058,11 @@ namespace librealsense
         {
             uvc_xu_control_query q = {static_cast<uint8_t>(xu.unit), control, UVC_GET_CUR,
                                       static_cast<uint16_t>(size), const_cast<uint8_t *>(data)};
+            retry:
             if(xioctl(_fd, UVCIOC_CTRL_QUERY, &q) < 0)
             {
+                if(errno == EBUSY)
+                    goto retry;
                 if (errno == EIO || errno == EAGAIN) // TODO: Log?
                     return false;

@yyxr75, I got the same error on my laptop and the reason was that Ubuntu updated the kernel to 5.0. … without me noticing it. Switching back to 4.18 solved the problem. Supported kernel versions are listed here https://github.com/IntelRealSense/librealsense/blob/master/doc/distribution_linux.md.