aboutsummaryrefslogtreecommitdiffstats
path: root/utils/v4l2-ctl
AgeCommit message (Collapse)AuthorFilesLines
2022-03-17v4l2-ctl: allow waiting/polling for multiple eventsHans Verkuil1-91/+76
Currently there can be only one --wait/poll/epoll-for-event option, so waiting or polling is for a single event only. Add support for more than one of these options to make it possible to wait/poll for multiple events. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2022-01-10v4l2-utils: Fix incorrect use of fd in streaming_set_cap2outVedant Paranjape1-2/+2
Running the "Stream video from a capture video device (/dev/video1) to an output video device (/dev/video2)" example from the manpage with vivid as the output device failed with a error message. vedant@pc ~$ v4l2-ctl --list-devices vivid (platform:vivid-000): /dev/video2 /dev/video3 /dev/radio0 /dev/radio1 /dev/vbi0 /dev/vbi1 /dev/swradio0 /dev/media1 HD WebCam: HD WebCam (usb-0000:00:14.0-7): /dev/video0 /dev/video1 /dev/media0 vedant@pc ~$ v4l2-ctl -d0 --stream-mmap --out-device /dev/video3 --stream-out-dmabuf VIDIOC_G_FMT returned -1 (Invalid argument) <VIDIOC_QBUF: failed: Invalid argument handle out -1 handle out2in -1 While using the --out-device mode g_fmt must be operated on out_fd as well. determine_field was called on fps_timestamp object for output, but was not passed out_fd. This patch fixes the VIDIOC_G_FMT returned -1 (Invalid argument) error. Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-12-29v4l2-ctl: Operate on output device if specifiedLaurent Pinchart1-3/+3
The video output get, set and list options operate on the device set by --device, even if the --out-device option is specified to select a different output device. Fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-12-15v4l2-ctl: support edid-decode output as --set-edid inputHans Verkuil1-1/+18
v4l2-ctl can now read EDID output from edid-decode as a file format with --set-edid file=<edid-file>. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-11-25v4l-utils: use v4l_getsubopt instead of getsuboptHans Verkuil5-5/+6
Android doesn't have getsubopt at all, and some libc implementations use a getsubopt variant that behaves slightly different. So add a new v4l-getsubopt.h header that either just uses the glibc function (if glibc is detected) or uses a static inline v4l_getsubopt that is copied from glibc. This should avoid such problems. Reported-by: Marian Buschsieweke <marian.buschsieweke@ovgu.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-11-24v4l2-ctl/compliance: add stateless VP9 supportHans Verkuil1-0/+3
Understand V4L2_CTRL_TYPE_VP9_FRAME and V4L2_PIX_FMT_VP9_FRAME. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-11-09v4l2-ctl: pass bus_info to mi_get_media_fd()Hans Verkuil2-2/+4
If there are multiple instances of vivid, then mi_get_media_fd() needs to find the media device corresponding to the bus_info of the video device, and not just return the first media device it finds in /dev. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
2021-09-01v4l2-ctl: update test EDIDsHans Verkuil1-37/+37
- The hdmi-4k-600mhz version didn't set SCDC support - Add support for the new Video Format Preference Data Block Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-09-01utils: replace push_back with emplace_backRosen Penev1-2/+2
Avoids having to call the constructor as it forwards the arguments directly. Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-08-04v4l2-ctl: fix bugs found in streaming_set_cap2outDafna Hirschfeld1-1/+15
When exporting buffers from a capture device to an output device. There are several bugs: 1. The bytesused are set from the exported buffer, the value might be bigger than the length of the output buffer. 2. The file descriptor field 'm.fd' in 'struct v4l2_buffer' is not set. This patch fix those issues. Testing: modprobe vimc modprobe vivid //configure vimc pipeline media-ctl -d platform:vimc -V '"Sensor A":0[fmt:SBGGR8_1X8/640x480]' media-ctl -d platform:vimc -V '"Debayer A":0[fmt:SBGGR8_1X8/640x480]' media-ctl -d platform:vimc -V '"Sensor B":0[fmt:SBGGR8_1X8/640x480]' media-ctl -d platform:vimc -V '"Debayer B":0[fmt:SBGGR8_1X8/640x480]' v4l2-ctl -z platform:vimc -d "RGB/YUV Capture" -v width=1920,height=1440 v4l2-ctl -z platform:vimc -d "Raw Capture 0" -v pixelformat=BA81 v4l2-ctl -z platform:vimc -d "Raw Capture 1" -v pixelformat=BA81 // export buffers from vimc capture device (/dev/video2) to vivid output device (/dev/video4) v4l2-ctl -d2 --stream-mmap --out-device /dev/video4 --stream-out-dmabuf Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-08-04v4l2-ctl: print specific error upon failureDafna Hirschfeld1-5/+19
When an operation fails, print an error message that specify the specific operation that failed prefixed with the current function name. This makes debugging less painful. Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-05-27v4l2-ctl: add new control typesHans Verkuil1-0/+18
Correctly detect and log hdr10, mpeg2 and vp8 control types. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-05-27v4l-utils: add missing fallthroughRosen Penev1-1/+2
Found with -Wimplicit-fallthrough Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-05-27v4l-utils: add missing staticRosen Penev1-1/+1
Found by -Wmissing-prototypes Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-05-26mass constexpr conversionsRosen Penev11-30/+30
Use constexpr instead of const, ensuring these are all initialized at compile time. Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-05-06v4l2-ctl: add '--set-edid type=list' supportHans Verkuil1-0/+15
'type=list' lists all supported EDID types. This makes life a little bit easier when trying out different EDIDs. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-04-21v4l2-ctl: remove unused struct flag_defHans Verkuil1-5/+0
This struct is no longer used, remove it. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-04-21v4l2-ctl: add missing const, use {} instead of memsetHans Verkuil1-3/+2
Add missing const to the static struct mbus_name mbus_names array. Use struct v4l2_subdev_mbus_code_enum mbus_code = {}; instead of memsetting the struct to zero. This is based on a patch from Rosen Penev <rosenp@gmail.com>. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-04-21v4l2-utils: turn fb_formats to constexpr arrayRosen Penev1-13/+11
Forces evaluation at compile time and allows usage of a for range loop. Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-04-21clang-tidy: use using instead of typedefRosen Penev2-3/+3
Found with modernize-use-using Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-04-08v4l2-ctl: recognize compound h264 and fwht control typesHans Verkuil1-0/+21
At least v4l2-ctl -l now shows the proper type instead of 'unknown'. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-03-25v4l2-ctl: update EDIDsHans Verkuil1-6/+6
Fixed incorrect DisplayID timings (swapped front and backporches) and wrong aspect ratio (1:1 instead of 16:9). Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-03-24v4l2-ctl: improve --help-edidHans Verkuil1-7/+13
Provide a more detailed description of the various EDID types. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-03-23v4l2-ctl: fix hdmi and hdmi-4k-170mhz EDIDsHans Verkuil1-4/+4
The first DTD had a wrong vsync (6 instead of 5). Fixed. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-03-22v4l2-ctl: don't squash setting multiple identical controls.Hans Verkuil1-3/+5
This: v4l2-ctl -c auto_exposure=3,exposure_time_absolute=100,auto_exposure=1,exposure_time_absolute=200 should turn into a single VIDIOC_S_EXT_CTRLS call with 4 controls instead of 2 controls with just the last value for each control. This helps testing VIDIOC_S_EXT_CTRLS to check if drivers handle this correctly (only the last value for each control should be used). Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
2021-03-20v4l2-ctl: add --show-edid, add new test EDIDsHans Verkuil3-39/+236
Add a new --show-edid option that dumps the EDID you would write with --set-edid. Updated existing EDIDs (fixing small edid-decode conformity warnings) and add new EDIDs for displayport and 3 and 4 block EDIDs. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-02-24Makefile.am: turn the build less verbose by defaultMauro Carvalho Chehab1-2/+2
When V=0, suppress: - make entering/leaving messages - some scripting logic called on a few makefiles. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-01-28v4l2-ctl: print delta to current clock in verbose modeMax Schulze3-0/+15
If the Buffer Timestamp Clock is _MONOTONIC, print the delta to the current clock time needs --stream-show-delta-now together with --verbose Signed-off-by: Max Schuze <max.schulze@posteo.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> [hverkuil: fix coding style issues] [hverkuil: dropped the 'delta' to 'delta last' change]
2021-01-27v4l2-ctl: fix incorrect check for last_tsHans Verkuil1-1/+1
The 'fix implicit float conversions' patch broke logging of the delta value while streaming. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Fixes: 222e1760 ("utils: fix implicit float conversions") Reported-by: Max Schulze <max.schulze@posteo.de>
2021-01-18v4l2-ctl: add support for VIDIOC_SUBDEV_QUERYCAPHans Verkuil1-8/+16
This ioctl was introduce some time ago, but support for this was never added to v4l2-ctl. Fix this. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2020-12-03v4l-utils: sync with media_tree masterHans Verkuil1-3/+2
The FWHT stateless codec API is now an official public API, so this required a few changes. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2020-12-01v4l2-ctl: break on VIDIOC_DQEVENT errorHans Verkuil1-14/+14
If VIDIOC_DQEVENT fails, then stop polling. This will happen if e.g. the video device was unregistered and VIDIOC_DQEVENT returns ENODEV. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2020-11-14v4l2-ctl: clean up control value printingHans Verkuil2-224/+252
There were two places where control values were printed. Merge this into a single print_value function. In addition, allow numeric controls IDs instead of control names to be passed to -C and -c. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2020-10-30clang-tidy: use nullptrRosen Penev16-416/+416
Found with modernize-use-nullptr Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2020-10-24v4l2-ctl-32: use v4l2_ctl_CPPFLAGS, fix wrong checkHans Verkuil1-3/+3
Use v4l2_ctl_CPPFLAGS to build v4l2-ctl-32 to ensure it is consistent with building v4l2-ctl. In this case the GIT_COMMIT_CNT define was missing from v4l2-ctl-32, using v4l2_ctl_CPPFLAGS fixed that. Also v4l2-ctl-32 depended on 'if WITH_V4L2_COMPLIANCE_32' instead of 'if WITH_V4L2_CTL_32'. Fixed this as well. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2020-10-03cppcheck: turn several references to constRosen Penev2-4/+4
Found with constParameter Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> [hverkuil: fix qvidcap changes]
2020-09-26v4l2-ctl: subdev: Add the flags to the list of supported mbus formatsDafna Hirschfeld1-2/+8
Add a new function mbus2s to that prints a descriptive string of the supported flags of the the v4l2_subdev_mbus_code_enum Use this function in the print_mbus_code function. Also add a macro MBUS_DEF(enc_type) to create the two arries 'mbus_hsv_def' and mbus_ycbcr_def' that maps flags to string according to the enc_type (ycbcr/hsv) Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2020-09-26v4l2-ctl: subdev: Add support for the CSC API in the subdevicesDafna Hirschfeld1-4/+12
The CSC API allows userspace to configure the colorspace, quantization, (ycbcr/hsv)_enc and xfer_func fields when setting the formats, so those fields are not read only in userspace. This patch adds support for this API in subevices. Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2020-09-26v4l2: common: add the flags V4L2_FMT_FLAG_CSC* to the list that maps flags ↵Dafna Hirschfeld1-4/+12
to str Replace the array fmtdesc_def with a macro 'FMTDESC_DEF' The macro is used to to create two arrays 'fmtdesc_def_ycbcr', 'fmtdesc_def_hsv' that map the format flags to strings. The function 'fmtdesc2s' is changed to get a parameter 'is_hsv' that decides which array to use. The new CSC flags V4L2_FMT_FLAG_CSC* are added to the arries. Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2020-09-26v4l2-ctl: vidcap: Add support for the CSC APIDafna Hirschfeld1-3/+36
With the CSC API, capture drivers can allow userspace to request to set the colorspace fields of the pixelformat. This patch adds supports for this feature. when calling 'v4l2-ctl --set-fmt-video' on capture devices userspace can ask to change the fields 'colorspace', 'ycbcr/hsv_enc', 'quantization' and 'xfer_func' of the format if the driver supports it. Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2020-09-09clean up includes and convert C includes to C++Rosen Penev18-270/+22
Several C includes ending in .h are deprecated in C++. Tested with several combinations of uClibc-ng, musl, glibc, libstdcpp, libcxx, and uClibc++. Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2020-09-09utils: v4l2-ctl: support V4L2_CAP_IO_MC in v4l2-ctl '--list-formats-*' commandsDafna Hirschfeld7-30/+75
Add optional <mbus_code> arg to 'v4l2-ctl --list-formats-*' commands for capture, metadata and output devices. If <mbus_code> is given and the device has capability V4L2_CAP_IO_MC then list only the formats that matches the mbus code. The mbus_code is ignored for devices that don't use it or don't have the V4L2_CAP_IO_MC capability. Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2020-08-10v4l2-ctl: fix broken fd.qbuf error checkHans Verkuil1-1/+1
In one place the result of fd.qbuf was checked if it was negative, but it should have been a check for non-zero. Fix this. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2020-08-07v4l2-ctl: rename vivid_uvc_meta_buf to uvc_meta_bufHans Verkuil1-3/+3
This struct is not vivid specific, so drop the vivid_ prefix. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2020-08-06v4l2-ctl: fix INTEGER64 support, add common_print_control()Hans Verkuil2-26/+41
Split off the printing of a control value into a separate common_print_control() function. While working on that I noticed that controls of type INTEGER64 were not handled correctly, so fix that. Also the control names shown by the old code when printing the control values was inconsistent: sometimes the name from QUERY_EXT_CTRL was used, sometimes the ctrl_id2str[] name. Standardize on the latter. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2020-08-03use using instead of typedefRosen Penev1-7/+7
Found with modernize-use-using Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2020-08-03use autoRosen Penev4-8/+9
Found with modernize-use-auto Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2020-08-03convert to range based loopsRosen Penev3-59/+50
Found with modernize-loop-convert Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2020-07-15v4l2-ctl: Add version commandPaul Elder5-1/+17
Add a --version option to v4l2-ctl to retrieve the version of v4l2-ctl. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2020-07-15v4l2-ctl: set total number of native DTDs to 1Hans Verkuil1-8/+8
The EDIDs used with v4l2-ctl --set-edid type=XXXX set the "total number of native DTDs" field in the CTA-861 extension block to 0, meaning that the first Short Video Descriptor is the preferred timing. However, this should be 1, meaning that the first DTD in block 0 is the preferred timing. This is more compatible and avoid a warning from the edid-decode utility that checks for this. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

Privacy Policy