aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2022-03-03cec-ctl: only generate eob for CEC pin eventsHEADmasterHans Verkuil1-1/+3
An end-of-bit event is generated if a CEC pin event arrives that indicates that the CEC bus remained high for longer than a bit period, which means that it was the end of the message. But this was also done for HPD/5V events, which is incorrect. Especially since HPD/5V events might have a timestamp that is later than a CEC event (probably due to a driver or framework bug). In any case, the eob generator has nothing to do with HPD/5V events. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2022-03-03cec-ctl: fix timestamp log for HPD/5V changesHans Verkuil1-3/+10
The timestamp format for HPD and 5V changes was slightly different compared to CEC changes. Make them consistent to improve readability of the logs. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2022-02-18v4l2-compliance: only check function if an MC is presentHans Verkuil3-2/+6
The codec tests checked if the function of the device as reported by the media controller is that of an de/encoder. But that test was also done for codecs without a MC, and then it fails. So only do this test if an MC was found. Also test that stateless codecs always have a MC since it is required for such codecs. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
2022-02-17Add check for READ ONLY flagDikshita Agarwal1-1/+2
Add a check for V4L2_CTRL_FLAG_READ_ONLY to avoid request testing for such controls. Signed-off-by: Dikshita Agarwal <quic_dikshita@quicinc.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2022-02-17Revert "Add check for READ ONLY flag"Hans Verkuil1-2/+1
This reverts commit e5000e09485c5b92874c21810336823de4f23dfd due to a wrong SoB address.
2022-02-17Add check for READ ONLY flagDikshita Agarwal1-1/+2
Add a check for V4L2_CTRL_FLAG_READ_ONLY to avoid request testing for such controls. Signed-off-by: Dikshita Agarwal <dikshita@qti.qualcomm.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2022-01-28ir-ctl: report ir overflowSean Young1-2/+15
Signed-off-by: Sean Young <sean@mess.org>
2022-01-28v4l-utils: sync with latest media staging treeSean Young5-10/+325
This merges the latest lirc.h changes. Signed-off-by: Sean Young <sean@mess.org>
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-12-15cec-ctl: periodically insert monotonic/wallclock timeHans Verkuil1-3/+31
The monotonic time and the wallclock time diverge over time. To help analyze 'pin' logs (--monitor-pin) insert the monotonic and wallclock time every hour into the pin log, and --analyze-pin will use that information to keep the wallclock time as reported by -w reasonably in sync. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-12-13cec-ctl: show timestamp for eventsHans Verkuil1-4/+8
Events (HPD/5V) didn't report the timestamp, unless --verbose was added. But this is very useful to know, so change it to always report the timestamp. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-12-09ir-ctl: allow for different gaps to be specifiedSean Young1-63/+63
For example: ir-ctl --send=part1 --gap=10000 --send=part2 --gap=20000 --send=part3 This would introduce a gap of 10000 microseconds between part1 and part2, and 20000 microseconds between part2 and part3. Signed-off-by: Sean Young <sean@mess.org>
2021-12-04v4l2-compliance: improve two vivid_ro_ctrl warningsHans Verkuil1-4/+8
These warnings check the vivid_ro_ctrl value against the expected value. Improve them to show the actual values. Hopefully this helps debugging to make this test more reliable since it regularly warns in the daily tests. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-12-04v4l2-compliance: improve select() check in captureBufs()Hans Verkuil1-1/+2
This test checks that at least one of the read or write fds are set upon return from select(). But it is possible while streaming that only an event is returned. In that case this check would fail. Add a check for an event (exception) as well. This should solve a regular occuring failure in the compliance test. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-12-03v4l2-compliance: increase sleeps that are too shortHans Verkuil1-4/+4
When running the compliance tests in a VM sometimes the VM takes a lot longer to respond than you expect. Increase a few usleeps that are too tight to avoid the tests failing because of that. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-12-02qv4l2: Add capture toggle and close hotkeys to CaptureWinDavid Fries2-5/+20
It can be inconvenient to stop or start the stream when the capture window obscures most or all of the application window. Register the current application window stream toggle QAction to the capture window as well. Register a more standard Control-W to close the window. Add both to the context menu to allow them to be visible and discovered. Signed-off-by: David Fries <David@Fries.net> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-12-02qv4l2: enable the play action on non-streaming radio rxJorge Maidana1-3/+3
The commit 37f42eb35d87 ("qv4l2: reorganize colorspace handling") disabled the play action on non-streaming devices. This patch enables the play action 'm_capStartAct' on non-streaming radio rx (audio-only) devices, assuming that 'isCapture' should exclude radio tx. In addition, it also disables the step-frame action 'm_capStepAct' on radio devices. Signed-off-by: Jorge Maidana <jorgem.seq@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-12-02v4l2-compliance: detect no-mmu systemsHans Verkuil5-30/+52
Check if the OS has an MMU. If not, then skip tests that only work for systems that have an MMU. The safest and most generic method I found is the FIONBIO ioctl that is available for any file descriptor and is a write-only ioctl, so no memory will be accidentally written. On a MMU system this will return EFAULT, and on a ucLinux system this will return 0. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-11-25sliced-vbi-detect/test.c: drop unused headersHans Verkuil2-14/+1
Lots of headers are not used in these two utils. Drop them. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-11-25v4l-utils: use v4l_getsubopt instead of getsuboptHans Verkuil13-255/+278
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-25libv4lconvert: HM12 -> NV12_16L16Hans Verkuil5-19/+19
Rename HM12 to NV12_16L16 (HM12 is now redefined to this new, more generic, pixel format). So don't use the old name anymore, only use the new pixel format name. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-11-24v4l2-ctl/compliance: add stateless VP9 supportHans Verkuil2-0/+4
Understand V4L2_CTRL_TYPE_VP9_FRAME and V4L2_PIX_FMT_VP9_FRAME. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-11-24v4l-utils: update to latest media_stage kernelHans Verkuil7-6/+672
The main addition is VP9 stateless codec support. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-11-24v4l2-compliance: relax time32-64 testHans Verkuil1-2/+2
The delta between the 64 bit DQEVENT timestamp and the 32 bit timestamp doesn't have to be <= 10 ms, that's too short when run in a VM instance. Change it to 500 ms, that should be fine for this test. It's not about performance, but about checking that the timestamps retrieved through the 32 bit compat API are sane. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-11-18v4l2-compliance: Let uvcvideo return -EACCESRicardo Ribalda3-7/+24
Setting a control while inactive is meant to work, but it might not be actually written to the hardware until control becomes active. v4l2-compliance should allow -EACCES as an error code, but only for the uvcdriver when an attempt is made to set inactive controls. The control framework is able to handle this case more elegantly: it will remember the last set inactive value, and when the control becomes active it will update the hardware. But that's really hard to model in uvc. Suggested-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-11-11v4l2grab: estimate the frame rateMauro Carvalho Chehab1-6/+44
Add a framerate estimation after the end of the capture loop. the start time is calculated just after streamon for mmap/userptr, in order to avoid counting the time to allocate/mmap buffers and to prepare the device for start streaming. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-10v4l2-compliance: show value with 'delta_ms > 10' fail msgHans Verkuil1-2/+2
This helps debugging this issue. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-11-09test-media: increase sleep after modprobe vivid to 3Hans Verkuil1-3/+3
A sleep of 1 is apparently sometimes too short and the following v4l2-ctl calls fail. Increment to 3 and hope that that is sufficient. Also reload vivid with the same cache_hints module option as the first modprobe for vivid. 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-11-09v4l2-compliance: add missing returnHans Verkuil1-2/+2
fail() by itself does not return, the correct usage is 'return fail();' Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-11-09v4l2-compliance: improve failure messageHans Verkuil1-1/+3
Show the exact values for the exp_q.g_length(p) < buf.g_length(p) check. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-11-09v4l2grab: avoid the risc of having sizeimage == 0Mauro Carvalho Chehab1-0/+4
In the eventual case where sizeimage is zero, userptr will fail. So, add a default. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-09v4l2grab: properly implement quantizationMauro Carvalho Chehab1-16/+56
Implement a logic to detect between full-range and limited range, instead of hardcoding it. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-09v4l2grab: use an array for format propertiesMauro Carvalho Chehab1-56/+68
Instead of hardcoding depth and other per-format properties, place them into an array, in order to make easier to parse. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-08libdvbv5/dvb-dev-remote.c: fix send_fmt prototypeHans Verkuil1-2/+2
The 3rd argument should be a const char *, not a const char array. This fixes a lot of compiler warnings for this source. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-11-08decode_tm6000: fix compiler warningHans Verkuil1-1/+1
decode_tm6000.c: In function ‘main’: decode_tm6000.c:354:25: warning: ‘img’ may be used uninitialized [-Wmaybe-uninitialized] 354 | memcpy(buf,&img[pos],sizeof(buf)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ decode_tm6000.c:253:48: note: ‘img’ declared here 253 | unsigned char buf[TM6000_URB_MSG_LEN], img[720*2*480]; | ^~~ Just initialize img to all 0. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-11-01v4l2grab: add a way to explicitly enable raw modeMauro Carvalho Chehab1-34/+46
Sometimes, we just want to write files in raw mode, in order to let some other utility to decode it. So, add a new program option to force raw mode. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-01v4l2grab: don't try to convert formats on raw modeMauro Carvalho Chehab1-3/+3
If the device is in raw mode, it shouln't touch the image, just store it as-is. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-11-01v4l2grab: add RGB 32 format and variantsMauro Carvalho Chehab1-1/+36
Those are pretty simple to add. As we don't have much to do with that, just ignore the alpha channel, if present. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-10-31v4l2grab: add support for YUV 420 planar and semi-planar formatsMauro Carvalho Chehab1-0/+45
Now that planes support is in place, add support for YUV and YVU 4:2:0 planar and semi-planar formats. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-10-31v4l2grab: add the basic logic to support planar formatsMauro Carvalho Chehab1-17/+48
Planar formats usually place 3 planes. On YUV formats, the plane 0 is luma, and planes 1 and 2 are for the chroma components, which are usually decimated. Add support for that at the core of the conversion logic. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-10-31v4l2grab: rework conversion routines to add more YUV formatsMauro Carvalho Chehab1-63/+81
Rewrite the conversion code in order to simplify the addition of other YUV formats. While here, also use full-range by default, preparing ground to support other colorspace ranges. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-10-30v4l2grab: add support for handling colorspaceMauro Carvalho Chehab1-25/+37
Rely on colorspace/ycrcb encoding fields in order to handle the YUV conversions. Currently, just BT.709 and BT.601 are supported. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-10-30v4l2grab: pass fmt to the conversion functionMauro Carvalho Chehab1-23/+12
Right now, it colorspace parameters are not passed to the conversion routines. However, those are needed at the conversion routines, in order to be able to properly handle YUV conversion. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-10-30v4l2grab: use BT.709 by default on YUV conversionMauro Carvalho Chehab1-6/+25
This is more commonly found those days. Yet, the right approach would be, instead, to add full support for colorspace. So, add a note there, while keeping the BT.601 table too. As the hole idea of v4l2grab is to do quick tests, let's keep using an integer arithimetic, as this should be faster. Yet, let's improve its precision. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-10-30v4l2grab: optimize conversion routinesMauro Carvalho Chehab1-38/+15
The conversion routines came from the vimc driver, where they also re-scale and flip images vertically and horizontally and can convert into several formats including Bayer. So, it was done in two steps. As we just want to convert everything into RGB24, this can be simplified in order to avoid double-buffering. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-10-29v4l2grab: accept other formats than RGB24Mauro Carvalho Chehab1-23/+210
Extend the logic to accecpt non-RGB24 formats. The basic import the conversion logic from the vimc Kernel driver, removing the scaling logic from it. The YUV conversion logic is based on the formulas found at Wikipedia. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-10-29v4l2grab: print the fourcc when libv4l won't handle itMauro Carvalho Chehab1-1/+2
Instead of just saying that libv4l doesn't support a format, print its fourcc. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-10-23m4: Update ax_pthread to latestGregor Jasny1-109/+146
2021-10-23bootstrap.sh: Replace which with POSIX compliant command -vGregor Jasny1-1/+1
This avoids a deprecation warning on Debian on /usr/bin/which.
2021-10-23configure.ac: Add copy of gnulib visibility.m4Gregor Jasny1-0/+82
That file used to be part of gettext but as of 0.21 it is not, anymore. The file has been copied from gnulib.
2021-10-18cec-compliance: wake up remote device if neededHans Verkuil3-5/+3
Until now, if the remote device was in standby the test would just abort with a message that the remote device should be woken up manually. This patch changes this to attempt to automatically wake up the remote device. Basically it adds the 'Wake up' to the core tests, but it is only run if the remote device was in standby, otherwise it is skipped. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-10-15buildsystem: Start v4l-utils 1.23.0 development cycleGregor Jasny1-1/+1
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
2021-10-15Prepare for 1.22.0 releaseGregor Jasny13-3246/+4082
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
2021-10-08v4l2-compliance: check entity function for codecsHans Verkuil5-8/+25
Codec devices must have entity function MEDIA_ENT_F_PROC_VIDEO_ENCODER or _DECODER. Check this. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-10-08cec-compliance: fix confusing 'Transient state' messageHans Verkuil1-2/+6
Fix confusing messages like this: Transient state after 0 s, stable state On after 0 s This really means that no transient state was reported, and only a stable state. Report this as such. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-10-08cec-compliance: improve confusing messageHans Verkuil1-2/+2
"Device is woken up" suggests that the device has just woken up, but what is actually meant is: "Wait for device to wake up". Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-10-08cec-compliance: fix 'unresponsive' detectionHans Verkuil1-39/+40
The poll_stable_power_status() function reported the unresponsive_time, which is not the duration the device is unresponsive during a power state transition, but the time of the last unresponsive attempt since the start of that state transition. That's not what was intended, so change unresponsive_time to unresponsive_cnt where we keep track of the number of unresponsive attempts. Adjust the messages accordingly. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-10-02test-media: show version info earlier and show cmd argsHans Verkuil1-6/+10
Log the version info earlier and also log the command line arguments. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-09-29test-media: drop vidtv from the 'mc' targetHans Verkuil1-1/+1
There are too many issues with the vidtv driver. So for now drop it from the list of drivers that the 'mc' target activates. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-09-23test-media: mc should include vidtvHans Verkuil1-1/+2
Since DVB can also use the media controller, add 'vidtv' to the list of drivers that the 'mc' option enables. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-09-23test-media: add 'date' at beginning and end, show versionsHans Verkuil1-7/+14
Add a 'date' command at the beginning and the end to make it easier to see how much time the script takes. Also show the kernel version and v4l2-compliance version at the start to check that the expected versions are used for testing. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-09-22test-media: missed one scaler config lineHans Verkuil1-0/+1
There was one other place where the scaler had to be configured. Add this. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-09-22test-media: configure vimc scaler correctlyHans Verkuil1-0/+1
With the new vimc scaler patch the scaler has to be configured correctly, otherwise the vimc test will fail. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-09-22test-media: add -E and -W optionsHans Verkuil1-2/+13
Add -E (exit-on-fail) and -W (exit-on-warn) options. This helps debugging test failures. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-09-21v4l2-compliance: use fail_on_test_val for better fail reportsHans Verkuil2-23/+29
Often a return code is checked against allowed values. It is very useful if that return code is shown in the fail message if it has a wrong value. Add fail_on_test_val() for that. Use it in v4l2-test-buffers.cpp to start with. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-09-19v4l-compliance: re-introduce NON_COHERENT and cache hints testsSergey Senozhatsky3-18/+70
This returns back non-coherent (previously known as NON_COHERENT) memory flag and buffer cache management hints testing (for VB2_MEMORY_MMAP buffers). Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-09-19v4l-utils: sync with latest media staging treeHans Verkuil10-27/+247
This merges the new vb2 non-coherent API. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-09-15ir-ctl: increase the size of the buffer used to read raw filesSean Young1-3/+5
Air conditioner codes typically have 100 pulse/space pairs (12 bytes + headers). The resulting raw IR line length is 1063, which exceeds the current 1024 byte buffer, and results in an error trying to parse the line. The buffers used to read pulse/space files are significantly larger than needed so this decreases their size, and allocates the difference to the buffer used to read raw IR files in order to keep the total size of buffers the same. Signed-off-by: Norman Rasmussen <norman@rasmussen.co.za> Signed-off-by: Sean Young <sean@mess.org>
2021-09-03v4l2-compliance: add new test for 32/64 bit time handlingHans Verkuil4-1/+193
When a 32-bit application is running on a 64-bit kernel then there can be two different VIDIOC_DQEVENT ioctls: one using 32-bit time fields, one using 64-bit time fields (year 2038 safe). Test that each version (if available) reports sane values. This test is only run from the 32-bit version of v4l2-compliance. It currently only supports VIDIOC_DQEVENT and not yet the ioctls that use struct v4l2_buffer. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-09-03v4l2-compliance: add 0 check for v4l2_event reserved fieldHans Verkuil1-0/+1
This check was missing, add it. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
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-01v4l-utils: libdvbv5: fix broken my_strlcpy callsHans Verkuil1-3/+3
sizeof(*msg->cmd) should have been sizeof(msg->cmd). Also, call strncpy with siz - 1 instead of siz to avoid this compiler warning: CC libdvbv5_la-dvb-dev-remote.lo In function ‘my_strlcpy’, inlined from ‘send_buf.isra.0.constprop’ at dvb-dev-remote.c:350:2: dvb-dev-remote.c:121:7: warning: ‘strncpy’ output truncated copying 1 byte from a string of length 12 [-Wstringop-truncation] 121 | rc = strncpy(dst, src, siz); | ^~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-09-01utils: replace push_back with emplace_backRosen Penev2-3/+3
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-09-01remove pointless constructorRosen Penev1-4/+2
The members can be initialized directly, allowing to remove the onstructor. Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-08-25cec-compliance: fix broken timer testsHans Verkuil2-1/+9
If the remote device doesn't support the Timer Feature, then do not attempt to test for timer errors or overlapped timers. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-08-12cec-compliance: wait up to 10s for Inactive Source replyHans Verkuil1-1/+1
The current wait time of 3 seconds is a bit too short, increase to 10 seconds. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-08-11configure.ac: drop printf for GIT_COMMIT_DATEHans Verkuil1-1/+1
Drop the unnecessary printf '\"' and incorporate the " instead in the --date='format-local:"%F %T"' option. It looks like this was a partial copy-and-paste from GIT_COMMIT_CNT, but it is unnecessarily complex for GIT_COMMIT_DATE. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reported-by: Idar Tollefsen <itollefs@cisco.com>
2021-08-11cec-compliance: improve testLostMsgs testHans Verkuil1-58/+135
Properly comment this function. As part of the commenting process several bugs were also fixed: - when determining the Signal Free Time, ignore messages with non-OK and non-NACK results, since in those cases nothing was actually transmitted. - always show the detected SFTs: this helps verifying that the measured SFTs are sane. Before they were only shown if there were failures or warnings, or if --verbose was used. - the meaning of the first 'sft' array dimension was changed (effectively inverted), making it a bit easier to explain what it stood for. - replace the various pending_tx_rx_*_msgs counters with just one (pending_tx_rx_msgs). This really shouldn't happen at all, so it is overkill to split it up by the possible rx results. - multiple tx_status bits could be set, count them all and don't stop at the first detected bit. - add a new check to verify that only the oldest transmit result was lost in the message queue. 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-07-28cec-compliance: improve warning about late replyHans Verkuil1-2/+4
The warning about a late reply or Feature Abort to a transmitted message was rather vague. Show whether it is a late reply or a late Feature Abort and report the opcode in human readable format. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-07-13cec-compliance: add cec-test-tuner-record-timer.cppHans Verkuil4-1072/+1094
Split off the tuner, record and timer tests into a separate source since cec-test.cpp became a bit too big. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-07-13cec-compliance: use send_timer_error for one more testHans Verkuil1-12/+1
The 'Day error: November 31, at 6:00 am, for 1 hr.' test can also use the send_timer_error helper. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-07-13cec-follower: refactoring: split up overly long functionsHans Verkuil3-206/+240
A single function dealt with tuner, record and timer messages, split this up into three, one function for each type of message. The programmed timer handling in the main processing loop is also split off into its own function. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-07-13cec-follower: emulate programmed timer recordingsDeborah Brouwer4-2/+84
Start and stop recording as timers are scheduled. Schedule future timers if a completed timer has a recording sequence. Delete overlapped and unfinished timers. Reduce available media space when a recording is completed. Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-07-13cec: expand Timer Programming testsDeborah Brouwer6-101/+706
Check that Timer Status and Time Cleared Status replies have a valid operand. Send timers with out-of-range dates and check follower's response. Send an out-of-range recording sequence and check that the timer is not set. Send a duplicate timer and check that the timer is not set. Set overlapping timers and check that the timer overlap warning is set. In the follower, keep track of timers that have been received and warn if there may be insufficient space for a programmed recording. Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-07-05ir-ctl: Revert "ir-ctl: print correct transmitter count"Sean Young1-6/+3
This change was totally wrong. All the existing drivers (except rc-loopback) return the number of transmitters, not what would be a valid mask. The documentation also says so. This reverts commit eb47c00736586329a2043512dacb10fcf95aa58a. Signed-off-by: Sean Young <sean@mess.org>
2021-07-03ir-ctl: print correct transmitter countSean Young1-3/+6
Signed-off-by: Sean Young <sean@mess.org>
2021-07-01cec: add One Touch Record Standby testsDeborah Brouwer5-1/+87
Check that the recording device ignores a Standby message while it is recording. When the recording is finished, check that the recording device enters standby unless the recording device is the active source. Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-07-01cec: expand One Touch Record testsDeborah Brouwer7-49/+442
Expand the One Touch Record tests so that the follower and initiator know their local and remote device types and respond accordingly. Send Record TV Screen and check that Record On source replies are valid. Send Record On source messages and check that Record Status replies are valid. Send Record Off and check that the recording terminates. Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-07-01cec-ctl: log signal free time when (show && !verbose)Hans Verkuil1-3/+4
The logging of the signal free time was no longer done when show == true and verbose == false, fix the logic. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Fixes: 8639ff89 ("cec-ctl: report low drive without --verbose")
2021-07-01cec-ctl: free signal time -> signal free timeHans Verkuil1-2/+2
Use the same phrase as in the CEC specification. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-06-30test-media: drop vidtv from mc, but warn if MC is disabled for DVBHans Verkuil1-2/+15
The vidtv test requires CONFIG_MEDIA_CONTROLLER_DVB=y, so drop this from the 'mc' target and if vidtv is explicitly selected as target, then verify (if possible) that this config option is set. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-06-30test-media: add vidtv to the mc targetHans Verkuil1-3/+4
Also document that vidtv is part of the all and mc targets. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-06-28cec-ctl: report low drive without --verboseHans Verkuil1-33/+43
When analyzing a low-level pin log with (--analyze-pin the low drive condition was only reported if --verbose was also given. But this is important enough that it should also be reported without --verbose. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-06-25cec-follower: fix incorrect fallthroughHans Verkuil1-1/+1
The CEC_MSG_ROUTING_INFORMATION handler fell through to the CEC_MSG_GET_MENU_LANGUAGE handler for no good reason. Just return instead. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-06-25cec-follower: use log_addr_type to get local device typeDeborah Brouwer3-5/+6
A device may use a Backup logical address (aka Reserved in CEC Version < 2.0) if the logical addresses that the device would normally used are unavailable. Since a Backup logical address is not unique to any device type, it cannot be used to determine the device type of the follower. Instead use the more accurate log_addr_type as returned by CEC_ADAP_G_LOG_ADDRS to find the device type. Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-06-17cec-compliance: remove One Touch Record Status testDeborah Brouwer1-18/+0
Remove the Record Status test for One Touch Record because the follower sends these kinds of messages in response to Record On. Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-06-16keytable: ensure BPF IR decoders use correct section nameSean Young10-35/+50
The convention is to have the type ("lirc_mode2/") prefixed so the BPF loader knows what type it is. Signed-off-by: Sean Young <sean@mess.org>
2021-06-16libcecutil/cec-info.cpp: rename Reserved to BackupHans Verkuil1-2/+2
Logical Addresses 12 and 13 were called Reserved 1/2 in CEC 1.4, but were renamed to Backup 1/2 in CEC 2.0. Follow that new name, also because the corresponding #defines in cec.h use BACKUP as well. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-06-16cec: remove redundant struct cec_msg initializationsDeborah Brouwer7-86/+86
It is redundant to initialize a struct cec_msg variable with an empty list if the variable is also initialized by a call to cec_msg_init. Remove these redundant initializations. Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-06-15cec: add Deck Control wake-up handling testsDeborah Brouwer2-0/+48
Test that a deck in standby will wake up upon receiving the Deck Control messages Eject or Play Forward. Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-06-12cec-compliance/follower: fix type comparison warningsHans Verkuil2-3/+3
This fixes the following warnings on a 32-bit system: cec-test.cpp: In function ‘int deck_ctl_deck_ctl(node*, unsigned int, unsigned int, bool)’: cec-test.cpp:742:69: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘time_t’ {aka ‘long int’} [-Wsign-compare] 742 | for (unsigned i = 0; deck_status == CEC_OP_DECK_INFO_SKIP_FWD && i < long_timeout; i++) { | ~~^~~~~~~~~~~~~~ cec-test.cpp:754:69: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘time_t’ {aka ‘long int’} [-Wsign-compare] 754 | for (unsigned i = 0; deck_status == CEC_OP_DECK_INFO_SKIP_REV && i < long_timeout; i++) { | ~~^~~~~~~~~~~~~~ cec-processing.cpp: In function ‘void testProcessing(node*, bool)’: cec-processing.cpp:1105:47: warning: comparison of integer expressions of different signedness: ‘time_t’ {aka ‘long int’} and ‘unsigned int’ [-Wsign-compare] 1105 | (time(nullptr) - last_pwr_status_toggle > node->state.toggle_power_status)) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
2021-06-12v4l2-compliance: fix g++-7 compile errorHans Verkuil1-5/+9
g++ version 7 has problems with this assignment: v4l2_ext_controls vivid_ro_ctrls = { .which = V4L2_CTRL_WHICH_REQUEST_VAL, .count = 1, .controls = &vivid_ro_ctrl, }; Probably because 'which' is part of an anonymous union. Go back to assigning this the old fashioned way to allow v4l2-compliance to be compiled with g++ 7. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
2021-06-12cec-compliance: remove Deck Status testDeborah Brouwer1-18/+0
Remove the Deck Status message test because invalid Deck Status messages are already captured by cec-compliance in other tests. Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-06-12cec: add tests for Deck Play messageDeborah Brouwer2-14/+140
Send all Deck Play commands and check that the follower implements them. Test that the follower returns Feature Abort for invalid Play operands. Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-06-12cec: add tests for Deck Control messageDeborah Brouwer5-12/+177
Send all Deck Control commands Skip Forward, Skip Reverse, Stop and Eject and check the corresponding deck status. Test that the follower returns Feature Abort for invalid Deck Control operands. Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> [hverkuil: move CEC_OP_DECK_CTL_MODE_EJECT up to after MODE_STOP]
2021-06-11v4l2-compliance: fix bad indentationHans Verkuil1-2/+2
Fix bad indentation in checkInput(). Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-06-10contrib/test/test-media: add -setup optionHans Verkuil1-59/+86
The -setup option just does the device setup and test file generation without running any tests or unloading modules. This makes it easy to set everything up, but run the tests manually. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-06-09v4l2-compliance: improve request testsHans Verkuil3-20/+177
Add a lot of comments to explain the various tests. Also check that all controls are filled in correctly upon completion of a request, even if no controls were set in the queued request. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-06-08v4l-utils: sync with media_tree masterHans Verkuil2-0/+8
This will update v4l2-controls.h, adding _BITUL support Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-06-08v4l-utils: patch v4l2-controls.hHans Verkuil2-0/+17
Very old kernels do not have the _BITUL define. Test for this. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-06-08cec-ctl: min/max-sleep arguments should be double, not unsignedHans Verkuil1-7/+7
You want to be able to set the sleep values to e.g. 0.1 seconds, so use a double instead of unsigned. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-06-07cec-ctl: improve 'Sleep' message in stress testHans Verkuil1-2/+2
When sleeping before Image View On or Standby, clarify before which message the Sleep comes. This makes it easier to grep for a sleep for Standby or a sleep for Image View On. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-06-04cec: add tests for Give Deck Status messageDeborah Brouwer4-35/+81
Test that a valid Deck Status message is received in response to Give Deck Status and that Give Deck Status automatic reporting can be turned on and off. Test that the follower returns Feature Abort for an invalid Give Deck Status operand. Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-06-04cec-follower: emulate features for CEC versions < CEC 2.0Deborah Brouwer2-21/+23
For CEC adapters using versions < CEC 2.0, read the CEC Features as configured in the CEC adapter and emulate the features that are present. Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-06-04cec-compliance: move CDC helper functions to cec-test.cppHans Verkuil3-64/+60
Several CDC helper functions were in cec-compliance.cpp, but they belong to cec-test.cpp where the CDC tests happen. Move them to cec-test.cpp. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-06-04cec-compliance: move audio helper functions to cec-test-audio.cppHans Verkuil3-199/+199
Several audio helper functions that were in cec-compliance.cpp really belong to cec-test-audio.cpp. Move them. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-06-04v4l-utils: sync with media_tree/masterHans Verkuil3-23/+25
Update headers from latest media_tree/master kernel. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-05-28cec-compliance: skip warning if audio_out_delay is 1Hans Verkuil1-1/+1
The warning about an invalid audio_out_delay was shown even if the value was valid (1). Check if it is != 1 first. 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: sync with upstream media_tree masterHans Verkuil11-71/+1618
Update to the latest kernel media headers. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-05-27v4l2-compliance: V4L2_PIX_FMT_VP8_FRAME is for stateless decoderHans Verkuil1-0/+1
The compliance utility didn't detect that V4L2_PIX_FMT_VP8_FRAME represents a stateless decoder. Add support for this. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-05-27cec-compliance: hardcode audio_out_delay to 1 if not setHans Verkuil1-0/+2
If audio_out_delay is not present in the message, then set the value to 1. 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 Penev6-6/+6
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 Penev22-74/+74
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-26cec-compliance: improve error messageHans Verkuil1-1/+1
Rephrase error message to avoid the ugly: 'Expected no warnings, got 1 warnings' Now it says: 'Expected no warnings, but got 1' Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-05-21cec-compliance: use the actual audio_out_delay valueHans Verkuil1-0/+5
cec_ops_report_current_latency() hardcodes the audio_out_delay value if it is unused, ignoring the actual value. Which is fine, except when running a compliance test, then you want the actual value. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-05-21cec-compliance: clarify a warningHans Verkuil1-3/+4
The warning when a reserved audio out delay value was used didn't include that value 1 should be used instead. Clarify this. 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-05-06utils/cec: fix inconsistent Vendor ID reportingHans Verkuil4-9/+8
Either report it as '0x010203 (Name)' or '0x010203, 66051', depending on whether the Vendor ID is a vendor that is known by libcecutil. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-05-06utils/libcecutil/cec-log.cpp: report 6 digits of Vendor IDHans Verkuil1-2/+2
The Vendor ID is just 24 bits, so report only 6 digits (%06x) instead of 8 (%08x). Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-05-01ir-ctl: include timeout in raw IR and parse timeout in pulse-space fileSean Young1-6/+5
Reported-by: Luca Di Gregorio <lucdig@gmail.com> Signed-off-by: Sean Young <sean@mess.org>
2021-04-27cec-follower: detect the cessation of Audio Rate Control messagesDeborah Brouwer1-8/+14
If the controlling device simply stops sending audio rate messages, give the cec-follower the ability to detect that it has not received an audio rate message within 2 seconds as required. The cec-follower will quit the audio rate controlled mode. Eliminate the need to measure an interval between two audio rate messages. Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-04-27cec-follower: increase precision of Audio Rate Control active sensingDeborah Brouwer1-4/+4
Measure the interval since the last audio rate control message in nanoseconds instead of seconds. Increasing the precision catches audio rate messages that are late by less than a second. Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-04-22v4l2-compliance: move all vivid controls to v4l2-compliance.hHans Verkuil2-12/+8
The vivid controls are defined in two places: the header and v4l2-test-buffers.cpp. Move them all to the header so they are all in a single place. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-04-22v4l2-dbg: fix control flow problemHans Verkuil1-3/+3
Fix this coverity report: *** CID 1452658: Control flow issues (NO_EFFECT) /utils/v4l2-dbg/v4l2-dbg.cpp: 567 in main() 561 if (doioctl(fd, VIDIOC_DBG_G_CHIP_INFO, &chip_info, "VIDIOC_DBG_G_CHIP_INFO") != 0) 562 chip_info.name[0] = '\0'; 563 564 if (!strncasecmp(match.name, "ac97", 4)) { 565 curr_bd = &boards[AC97_BOARD]; 566 } else { >>> >>> CID 1452658: Control flow issues (NO_EFFECT) >>> >>> This greater-than-or-equal-to-zero comparison of an unsigned value is always true. "board >= 0UL". 567 for (size_t board = boards.size() - 1; board >= 0; board--) { 568 if (!strcasecmp(chip_info.name, boards[board].name)) { 569 curr_bd = &boards[board]; 570 break; 571 } 572 } Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Fixes: bafe32e7 ("v4l-utils: convert board_list to vector")
2021-04-22cec: add invalid operand test for Audio Rate Control messagesDeborah Brouwer2-0/+29
Add a test in cec-compliance that sends an Audio Rate Control message with an invalid operand. Check that it receives a Feature Abort reply due to the invalid operand. Add a response in cec-follower to Feature Abort due to an invalid operand. Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-04-22cec: add active sensing test for Audio Rate Control messagesDeborah Brouwer4-13/+69
The controlling device should send an Audio Rate Control message at least once every 2 seconds for active sensing. Add a test in cec-compliance to delay the message by more than 2 seconds. Check the interval between messages in cec-follower and warn if the delay is greater than 2 seconds. Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-04-22cec-compliance: add Audio System mask to Set Audio RateDeborah Brouwer1-1/+2
An Audio System can support Audio Rate Control, so add the Audio System as a possible source in the Set Audio Rate test. Signed-off-by: Deborah Brouwer <deborahbrouwer3563@gmail.com> 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-21cec-tuner: std::array conversionsRosen Penev1-70/+70
Allows getting rid of sizeof macros. Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-04-21remove unused ARRAY_SIZERosen Penev5-13/+0
This is a C construct that is not really needed in C++. Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-04-21clang-tidy: use nullptrRosen Penev2-2/+2
Found with modernize-use-nullptr Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-04-21clang-tidy: use autoRosen Penev1-1/+1
Found with modernize-use-auto Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-04-21v4l2-compliance: rename stvec to vec_remote_subtestsHans Verkuil4-31/+31
I found stvec to be a bit too obscure, so renamed it. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-04-21clang-tidy: use using instead of typedefRosen Penev10-19/+19
Found with modernize-use-using Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-04-21v4l-utils: convert board_list to vectorRosen Penev7-429/+390
Removes boilerplate code with a slight reduction in size. Ran through git clang-format Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-04-21v4l-utils: switch remote_subtest arrays to vectorRosen Penev4-228/+170
Easier to read and allows removing some boilerplate code. Only a moderate size increase. Ran through git clang-format Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-04-20Rudimentary support for mi_media_detect_type on FreeBSD.Trenton Schulz1-1/+22
FreeBSD doesn't have the same uevent and sys filesystem that Linux does. So, use the VIDIOC_QUERYCAP ioctl to find out basic capabilities for a device. The ioctl doesn't give us as much information, but it gets things like webcams, VBIs, and radios. This is better than what was there previously, which was returning unknown. This makes some v4l-utils like v4l2-ctl a little more useful. Signed-off-by: Trenton Schulz <trenton@norwegianrockcat.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-04-20configure.ac: Fix building without libudevNiklas Söderlund1-1/+1
Since the addition of the --without-libudev option automatic detection of missing libudev have been broken and fails with, configure: error: Package requirements (libudev) were not met: Package 'libudev', required by 'virtual:world', not found This is because autotools macro PKG_CHECK_MODULES action-if-not-found behaves differently from most other macros, As most of the original autoconf macros, there are boolean values provided, for the cases when the check succeeded or failed. In contrast with almost all of the original macros, though, the default action-if-not-found will end the execution with an error for not having found the dependency. As the AS_IF check following the PKG_CHECK_MODULES prints a warning if libudev is not found the intention can't have been to fail configure if libudev not found. Fix this by setting have_libudev=no instead of failing due to the default action. Fixes: 49316dc21f806d0c ("configure.ac: Add --without-libudev option to avoid automagic dep") Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-04-20configure.ac: Resolve GIT_* even if repository is a submoduleNiklas Söderlund1-3/+3
If the v4l-utils repository is a git submodule the $(top_srcdir)/.git is a file and not a directory. Update the shell checks to allow the test to pass in both cases. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-04-13cec: improve vendor ID loggingHans Verkuil5-41/+74
Always log the translated vendor ID string if available. This helps debugging. Also add a new vendor ID string. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-04-09keytable: restrict installation of 50-rc_keymap.confUlrich Ölmann1-0/+4
It is only needed if BPF is effectively used and the package is compiled for a systemd based target. Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Sean Young <sean@mess.org>
2021-04-09configure.ac: autodetect availability of systemdUlrich Ölmann1-1/+9
Import systemd's official suggestion [1] how this should be handled in packages using autoconf. A side effect of this is the removal of the hardcoded fallback path "/lib/systemd/system" which leaks build host information when cross compiling v4l-utils and therefore defeats reproducible builds. [1] https://www.freedesktop.org/software/systemd/man/daemon.html#Installing%20systemd%20Service%20Files Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Sean Young <sean@mess.org>
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-26qv4l2: fallback if window()->windowHandle() == NULLHans Verkuil1-2/+8
window()->windowHandle() can return NULL, in that case fallback to a 1920x1080 screen resolution. Still better than a crash. 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-20libdvbv5: hide stack_dump symbols and provide soname compatibilityGregor Jasny3-2/+7
2021-03-20libdvbv5: hide my_strlcpy symbolGregor Jasny1-1/+1
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-03-17v4l2-compliance: don't warn about seq counter for metadataHans Verkuil1-1/+4
Don't warn about unexpected sequence counters for metadata streams: the sequence counter is typically linked to the video capture to sync the metadata with the video data. So the sequence counter would start at a non-zero value and produce a warning when it shouldn't. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
2021-03-15v4l2-tpg.patch: rename min/max defines to tpg_min/maxHans Verkuil2-13/+9
With gcc 11 the min/max defines clash with what gcc provides, so rename these defines. They are only used in the min3/max3 defines, so the change it kept to a minimum. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Reported-by: Gregor Jasny <gjasny@googlemail.com>
2021-03-12v4l2-compliance: improve compound control checksHans Verkuil2-5/+62
Verify that QUERY_EXT_CTRLS and QUERYCTRLS handle enumerating only regular controls or only compound controls correctly. Before v4l2-compliance only checked that enumerating all controls was done correctly. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-03-11v4l2-compliance: improve fmtdesc.description checkHans Verkuil1-0/+8
Check that the driver doesn't make up pixelformat descriptions. It should be left to the v4l2 core. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-03-11v4l-utils: sync with latest media kernelHans Verkuil4-3/+4
Also drop the 'grep -v V4L2_PIX_FMT_H264_SLICE' in sync-with-kernel.sh. This is now part of the stable API, so allow this. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-03-06v4l-utils: sync with latest media kernelSean Young145-14/+271
Sync with 5.12-rc1 Signed-off-by: Sean Young <sean@mess.org>
2021-03-06keytable: fix typoUlrich Ölmann1-1/+1
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Signed-off-by: Sean Young <sean@mess.org>
2021-03-06keytable: Add source information in generated keymapsBastien Nocera1-1/+5
Add comments to mention that keymap files are generated, and list which tool was used to generate them and the kernel source filename. This should make it less likely that generated files are used as examples to contribute keymaps from, and more likely that upstream changes are channeled through the right source tree. Signed-off-by: Bastien Nocera <hadess@hadess.net> Signed-off-by: Sean Young <sean@mess.org>
2021-03-02configure.ac: improve gettext compatibility supportHans Verkuil1-1/+1
Gettext 0.19.8 wants to see AM_GNU_GETTEXT_VERSION, but gettext 0.21 wants AM_GNU_GETTEXT_REQUIRE_VERSION. Test if AM_GNU_GETTEXT_REQUIRE_VERSION is supported and use that, otherwise fall back to AM_GNU_GETTEXT_VERSION. This also prevents gettextize from overwriting configure.ac with an updated AM_GNU_GETTEXT_VERSION version number, which was really annoying since configure.ac is under version control. Tested with both gettext versions. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Suggested-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-03-01configure.ac: revert AM_GNU_GETTEXT_VERSION changeHans Verkuil1-1/+1
AM_GNU_GETTEXT_VERSION was changed accidentally to version 0.21 in the previous commit, but this fails on some distros with an older gettext. Go back to the old AM_GNU_GETTEXT_VERSION([0.19.8]). Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-02-25cec-compliance: improve current latency checksHans Verkuil6-2/+54
If audio_out_delay is unused, then still check that: 1) the value is not a reserved value, 2) that the value is set to 1 as the recommended (sane) default. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2021-02-24Makefile.am: turn the build less verbose by defaultMauro Carvalho Chehab5-7/+7
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-02-24dvbv5-daemon: don't dereference a null pointerMauro Carvalho Chehab1-2/+1
The print message there can dereference a null pointer, if the first check is true. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-02-23dvb-dev-remote: check if setsockopt() failsMauro Carvalho Chehab1-2/+4
Print an error if it can't adjust the size of the RCV buffer. As it might still work, let the code to continue. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-02-23libdvbv5: dvb-dev-remote: better handle cmd sizeMauro Carvalho Chehab2-7/+20
Use a define and add a few checks in order to avoid potential mistakes in the future. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-02-23dvbv5-zap: fix a cut-and paste errorMauro Carvalho Chehab1-1/+1
Clearly, the free() call should be for args.server ;-) Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-02-23dvbv5-zap: remove an unused logicMauro Carvalho Chehab1-3/+0
err_cnt is unsigned. So, it can't be below zero. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-02-23dvbv5-zap: add a check for dvb_fe_retrieve_status() errorsMauro Carvalho Chehab1-0/+5
If something goes wrong, just sleep and re-try inside the timeout loop. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-02-23dvb-zap: copy_to_file doesn't return any valueMauro Carvalho Chehab1-2/+1
It doesn't make sense to have a return NULL inside it. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-02-23dvb-file: fix one-line output with default valuesMauro Carvalho Chehab1-1/+1
The current logic is broken for default values, due to a misplaced '}'. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-02-23libdvbv5: fix a typoMauro Carvalho Chehab3-5/+12
descriptior->descriptor Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-02-23libdvbv5: desc_language: check if the size is correctMauro Carvalho Chehab1-0/+9
Reject it when the size doesn't match what's expected. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-02-23libdvbv5: desc_ca: cleanup the routineMauro Carvalho Chehab1-9/+18
Add a check if the CA descriptor has at least 4 bytes, and cleanup the logic, in order to avoid using magic numbers, by using offsetof() and sizeof(). Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-02-23libdvbv5: validate cable descriptor's sizeMauro Carvalho Chehab1-3/+13
Check if the size has the expected value. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-02-23libdvbv5: desc_network_name: simplify the init codeMauro Carvalho Chehab1-4/+2
This is a very simple descriptor. Make the code equally simple. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-02-23libdvbv5: add a warning if a descriptor's init doesn't went fineMauro Carvalho Chehab1-0/+5
Instead of relying that all descriptors will report the error conditions, add a generic handler, as it may help to discover hidden problems. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-02-23libdvb: fix ATSC service location parserMauro Carvalho Chehab2-9/+32
A fixup patch actually broke the parser, as it was copying data to the wrong place. Yet, while testing it, it was noticed some streams that have a descriptor 0xa1 whose the language code is bogus: | pcr PID 1539 |\ elementary service - 3 elementaries |- elementary 0 |- | stream type 0x00 |- | PID 1 |- | Language .'. (0xcf 0x27 0x04) |- elementary 1 |- | stream type 0x04 |- | PID 0 |- | Language ..& (0x01 0xcf 0x26) |- elementary 2 |- | stream type 0x05 |- | PID 1280 |- | Language ... (0x00 0x01 0xcf) So, clearly this is not an ATSC descriptor. So, improve the logic to allow displaying invalid language codes, plus check if the descriptor's size is what it was expected. Fixes: 868ca548b10a ("libdvbv5: fix init of the ATSC service location") Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-02-23libdvbv5: dvb-dev-local: better handle realloc()Mauro Carvalho Chehab1-4/+5
The realloc() call assumes that, when realloc() succeeds, the return pointer is identical. This should always be the case here, as the code is reducing the size of the struct. Yet, an assumption like that can be dangerous, if used with a library different than the standard glibc. So, let's store the returned pointer. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-02-23libdvbv5: dvb-dev-local: fix error handling for device additionMauro Carvalho Chehab1-24/+32
The logic which detects changes at the DVB devices can leak data or try to do double-free, if errors occur. Fix it. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-02-23libdvbv5: dvb-dev-remote: don't leak resources at send_buf()Mauro Carvalho Chehab1-0/+3
If errors occur, ensure that the message buffer will be freed. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>