Set camera mode failed on TX2

My camera driver support 2 modes :1280x720 and 1920x1280,but it always work in mode0 (1280x720).
Run command : v4l2-ctl --list0formats-ext
ioctl:VIDIOC_ENUM_FMT
Index:0


Size :Discrete 1280x720

Size :Discrete 1920x1280

I tried to specify mode1,run command :v4l2-ctl --device=/dev/video0 --set-fmt-video=width=1920,height=1280,pixelformat=UYVY --set-ctrl=sensor_modes=1 --verbose

It reported to me:

VIDIOC_QUERYCAP:OK
VIDIOC_S_EXT_CTRLS:failed :Permission denied
Error setting controls :Permission denied
…:OK
…:OK
Format Video Capture :
Width/Hright :1280/720



How do I solve this problem?

hello 541449841,

you should either using --set-fmt-video=width,height, or --set-ctrl=sensor_modes controls in the command-line. please don’t use both of them together.

hello JerryChang,
I tried to use --set-ctrl=sensor_modes only
It reported :
VIDIOC_QUERYCAP:OK
VIDIOC_S_EXT_CTRLS:failed :Permission denied
Error setting controls :Permission denied

if I use set-fmt-video only(…–set-fmt-video=width=1920,heught=1280…),It reported:
VIDIOC_QUERYCAP:OK
VIDIOC_G_FMT:OK
VIDIOC_S_FMT:OK
Format Video Capture:
Width/Height:1280/720 …not 1920/1280

hello 541449841,

this doesn’t look correct, please double check $ v4l2-ctl --all, this CID, sensor_modes is a read only flag.
here’s sample command-line for using it.

$ v4l2-ctl -d /dev/video0 --get-ctrl sensor_modes
sensor_modes: 3

FYI, there’s another CID control, sensor_mode “without” s to call TEGRA_CAMERA_CID_SENSOR_MODE_ID operation.
you may review your sensor driver to implement that CID controls.

could you please share the details of $ v4l2-ctl -d /dev/video0 --list-formats-ext for reference,
thanks

Thanks for your reply,
Before your reply I have found this mistake. It works well now,Thanks again for your time.