USB Camera cannot set extension unit (XU) control on Jetson NANO

We use our USB camera and it can support some special functions by extension unit (XU) control.

However we found it will fail to query the XU control on Jetson NANO (JetPack 4.6.1).

our sample code:

#define UVC_XU_ID 0x03         XU_TERMINAL_ID
#define EU2_TEST_CMD 0x02       XU_BOOT_CONTROL
#define EU2_TEST_CMD_LEN 0x01   XU_BOOT_CONTROL DATA LENGTH

struct uvc_xu_control_query xu_ctrl_query_boot =
{
    .unit     = UVC_XU_ID,
    .selector = EU2_TEST_CMD,
    .query    = UVC_SET_CUR,
    .size     = EU2_TEST_CMD_LEN,
    .data     = NULL,
};

int uvc_boot_ctrl(int fd)
{
    int ret = 0;
    unsigned char buf[EU2_TEST_CMD_LEN];
    buf[0] = 1; 
    xu_ctrl_query_boot.data = buf;


    ret = ioctl(fd, UVCIOC_CTRL_QUERY, &xu_ctrl_query_boot);
    if(ret < 0) {
        printf("Error: boot query fail!\n");
        printf("%s\n",strerror(errno));
    }

    return ret;
}

int main(void) {
   int r;
   int fd;
...
   r = uvc_boot_ctrl(fd);
   if (r < 0) {
      close(fd);
      return r;
   }
...
}

When we use the sample on Jetson NANO, it will return the error messages:

$ sudo ./xu_sample
[71764.026694] uvcvideo: Failed to query (GET_LEN) UVC control 2 on unit 3: 1 (exp. 2).
Error: boot query fail!
...

We can run the sample without any errors on our host PC (Ubuntu 20.04) .

I think it maybe has some issues for UVC driver on Jetson NANO.

How could we fix the problem on Jetson NANO?

I have resolved the issue by modifying uvc driver.
Thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.