UVC XU (Extension Unit) fails on Developer OS

I have tried using XU (Extension Units) to control a USB webcam and on the factory install it works well but when using the developer version it fails and can’t work.

On Factory I get this
ioctl UVCIOC_CTRL_MAP error, errno = 0x0, str = Success return:0 fd:3
ioctl index 0 ->-1
ioctl return 0

But on Developer version
ioctl UVCIOC_CTRL_MAP error, errno = 0x16, str = Invalid argument return:-1 fd:3
ioctl index 0 ->-1
ioctl return -1

Any one that has any logic explanation why this happens and what I can do about it?

hello PlantMaster,

please check the description of the error return values, errno = 0x16
also, what’s the condition if you access the usb-camera via v4l2src,
for example,

gst-launch-1.0 -v v4l2src device=/dev/videoX ! video/x-raw,framerate=30/1,width=640,height=480 ! xvimagesink

Hi Jerry

When I run the above on a system where I know XU is works I get this output

nvidia@tegra-ubuntu:~/Documents/test$ gst-launch-1.0 -v v4l2src device=/dev/video0 ! video/x-raw,framerate=30/1,width=640,height=480 ! xvimagesink
Setting pipeline to PAUSED …
Pipeline is live and does not need PREROLL …
Setting pipeline to PLAYING …
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2948): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming task paused, reason not-negotiated (-4)
Execution ended after 0:00:00.762341825
Setting pipeline to PAUSED …
Setting pipeline to READY …
Setting pipeline to NULL …
Freeing pipeline …

Nothing pops up but if I use aasink a window briefly pops up.

On this system I do have access to X but on the one with the XU error it is harder to access X and the HDMI. What is best way to just output to NULL or disk with gst-launch-1.0 ?

I got access to HDMI on the the TX2 where XU doesn’t work and the above command works I just had to change FPS to 15. I can see the video output in a window.

I can use PU control and take photos using select as one would expect from v4l2 but the XU returns the error 0x16 invalid argument

hello PlantMaster,

the low level driver should works normally if you’re able to stream the usb-camera via v4l2src,
since there’s failure coming from extension units, please try to narrow down the failures,
thanks

The strange part is that XU works well on the factory version but not on the (unchanged by me) developer version Tegra186_Linux_R28.2.0_aarch64.

What can the difference be that disables XU?

How are you logged in (and is the user a member of group “video”…see “/etc/group”)? If you are not logged in directly to the GUI perhaps DISPLAY needs to be set and the user logged in to that GUI.

@linuxdev I have tried both logged in with SSH and using the terminal from the Ubuntu 16.04 GUI. It is the later you mean by being logged in directly to GUI, correct?

Both SSH and terminal/GUI give the same error. The user nvidia is part of the video group (I doubled checked) and I have also sudo su to become root but same error persist. I tried another webcam (from Logitech) and it also returned 0x16

Correct, it is possible being logged in directly to the Jetson with keyboard/mouse/monitor (versus over ssh or other networking) would work when remote login wouldn’t (due to environment). It is also possible logging in as user “nvidia” or “ubuntu” would work when other accounts would not (group video is required to access the GPU…normally “ubuntu” and “nvidia” have this, but other accounts must manually make this available).

Btw, although user “root” has group “video” access, security can still sometimes refuse to display GUI programs run by root when the GUI is logged in as another user. I was just hoping perhaps the issue was nothing more than environment.

I turned on UVC trace and rebuilt the kernel and I get these errors when using XU:

[ 4033.859743] uvcvideo: uvc_v4l2_open
[ 4033.863537] xhci-tegra 3530000.xhci: tegra_xhci_mbox_work mailbox command 4
[ 4033.870553] xhci-tegra 3530000.xhci: tegra_xhci_mbox_work ignore firmware MBOX_CMD_INC_SSPI_CLOCK request
[ 4034.087681] uvcvideo: Resuming interface 0
[ 4034.091892] uvcvideo: Resuming interface 1
[ 4034.103950] <b>uvc_ctrl_add_mapping: ret = -22</b>
[ 4034.116206] uvc_ctrl_add_mapping: ret = -22
[ 4034.128493] uvc_ctrl_add_mapping: ret = -22
[ 4034.140770] uvc_ctrl_add_mapping: ret = -22
[ 4034.152873] uvc_ctrl_add_mapping: ret = -22
[ 4034.158141] <b>uvcvideo: Control 0x0800000e not found.</b>
[ 4034.163591] <b>uvcvideo: Control 0x0800000f not found.</b>
[ 4034.168618] uvcvideo: uvc_v4l2_release
[ 4036.834783] uvcvideo: Suspending interface 1
[ 4036.839129] uvcvideo: Suspending interface 0

The uvc_ctrl_add_mapping: ret = -22 is my own print of the return value (22d=0x16) which is the error I get.
But what does uvcvideo: Control 0x0800000e not found and 0x0800000f mean?

Anyone like @JerryChang knows what this means?

hello PlantMaster,

it looks like your device is query for not supported control IDs,
please refer to standard v4l2 controls as below.

sources/kernel/kernel-4.4/include/uapi/linux/v4l2-controls.h

you may update the kernel driver to skip those control inquiries or extend the control definitions,
thanks

JerryChangs answer is correct, with skipping the control check one can get passed this and make it work.

I might be running into a similar problem - could you explain in more detail what you did to make it work? Thanks