[PATCH] v4l2: Add support for interpreting remaining fields in VIDIOC_ENUMINPUT struct v4l2_input

Marek Vasut marex at denx.de
Fri Jan 28 03:49:37 UTC 2022


Interpret $audioset as flags, $tuner as integer. Add ID list for
v4l2_std_id. Add flags for status and capabilities and interpret
them.

This is based off Linux 5.15.y:
https://www.kernel.org/doc/html/v5.15/userspace-api/media/v4l/vidioc-enuminput.html

Signed-off-by: Marek Vasut <marex at denx.de>
---
 src/v4l2.c                                | 16 ++++++++++++++
 src/xlat/v4l2_input_capabilities_flags.in |  4 ++++
 src/xlat/v4l2_input_status_flags.in       | 16 ++++++++++++++
 src/xlat/v4l2_std_ids.in                  | 27 +++++++++++++++++++++++
 4 files changed, 63 insertions(+)
 create mode 100644 src/xlat/v4l2_input_capabilities_flags.in
 create mode 100644 src/xlat/v4l2_input_status_flags.in
 create mode 100644 src/xlat/v4l2_std_ids.in

diff --git a/src/v4l2.c b/src/v4l2.c
index c4031aa6a..a23fa3978 100644
--- a/src/v4l2.c
+++ b/src/v4l2.c
@@ -755,7 +755,10 @@ print_v4l2_standard(struct tcb *const tcp, const kernel_ulong_t arg)
 	return RVAL_IOCTL_DECODED;
 }
 
+#include "xlat/v4l2_input_capabilities_flags.h"
+#include "xlat/v4l2_input_status_flags.h"
 #include "xlat/v4l2_input_types.h"
+#include "xlat/v4l2_std_ids.h"
 
 static int
 print_v4l2_input(struct tcb *const tcp, const kernel_ulong_t arg)
@@ -779,6 +782,19 @@ print_v4l2_input(struct tcb *const tcp, const kernel_ulong_t arg)
 		tprint_struct_next();
 		PRINT_FIELD_XVAL(i, type, v4l2_input_types,
 				 "V4L2_INPUT_TYPE_???");
+		tprint_struct_next();
+		PRINT_FIELD_X(i, audioset);
+		tprint_struct_next();
+		PRINT_FIELD_U(i, tuner);
+		tprint_struct_next();
+		PRINT_FIELD_FLAGS(i, std, v4l2_std_ids, "V4L2_STD_???");
+		tprint_struct_next();
+		PRINT_FIELD_FLAGS(i, status, v4l2_input_status_flags,
+				  "V4L2_IN_ST_???");
+		tprint_struct_next();
+		PRINT_FIELD_FLAGS(i, capabilities,
+				  v4l2_input_capabilities_flags,
+				  "V4L2_IN_CAP_???");
 	}
 
 	tprint_struct_end();
diff --git a/src/xlat/v4l2_input_capabilities_flags.in b/src/xlat/v4l2_input_capabilities_flags.in
new file mode 100644
index 000000000..cd7a13467
--- /dev/null
+++ b/src/xlat/v4l2_input_capabilities_flags.in
@@ -0,0 +1,4 @@
+#unconditional
+V4L2_IN_CAP_DV_TIMINGS		0x00000002
+V4L2_IN_CAP_STD			0x00000004
+V4L2_IN_CAP_NATIVE_SIZE		0x00000008
diff --git a/src/xlat/v4l2_input_status_flags.in b/src/xlat/v4l2_input_status_flags.in
new file mode 100644
index 000000000..e80d7d336
--- /dev/null
+++ b/src/xlat/v4l2_input_status_flags.in
@@ -0,0 +1,16 @@
+#unconditional
+V4L2_IN_ST_NO_POWER    0x00000001
+V4L2_IN_ST_NO_SIGNAL   0x00000002
+V4L2_IN_ST_NO_COLOR    0x00000004
+V4L2_IN_ST_HFLIP       0x00000010
+V4L2_IN_ST_VFLIP       0x00000020
+V4L2_IN_ST_NO_H_LOCK   0x00000100
+V4L2_IN_ST_COLOR_KILL  0x00000200
+V4L2_IN_ST_NO_V_LOCK   0x00000400
+V4L2_IN_ST_NO_STD_LOCK 0x00000800
+V4L2_IN_ST_NO_SYNC     0x00010000
+V4L2_IN_ST_NO_EQU      0x00020000
+V4L2_IN_ST_NO_CARRIER  0x00040000
+V4L2_IN_ST_MACROVISION 0x01000000
+V4L2_IN_ST_NO_ACCESS   0x02000000
+V4L2_IN_ST_VTR         0x04000000
diff --git a/src/xlat/v4l2_std_ids.in b/src/xlat/v4l2_std_ids.in
new file mode 100644
index 000000000..badf23860
--- /dev/null
+++ b/src/xlat/v4l2_std_ids.in
@@ -0,0 +1,27 @@
+#unconditional
+V4L2_STD_PAL_B          ((v4l2_std_id)0x00000001)
+V4L2_STD_PAL_B1         ((v4l2_std_id)0x00000002)
+V4L2_STD_PAL_G          ((v4l2_std_id)0x00000004)
+V4L2_STD_PAL_H          ((v4l2_std_id)0x00000008)
+V4L2_STD_PAL_I          ((v4l2_std_id)0x00000010)
+V4L2_STD_PAL_D          ((v4l2_std_id)0x00000020)
+V4L2_STD_PAL_D1         ((v4l2_std_id)0x00000040)
+V4L2_STD_PAL_K          ((v4l2_std_id)0x00000080)
+V4L2_STD_PAL_M          ((v4l2_std_id)0x00000100)
+V4L2_STD_PAL_N          ((v4l2_std_id)0x00000200)
+V4L2_STD_PAL_Nc         ((v4l2_std_id)0x00000400)
+V4L2_STD_PAL_60         ((v4l2_std_id)0x00000800)
+V4L2_STD_NTSC_M         ((v4l2_std_id)0x00001000)
+V4L2_STD_NTSC_M_JP      ((v4l2_std_id)0x00002000)
+V4L2_STD_NTSC_443       ((v4l2_std_id)0x00004000)
+V4L2_STD_NTSC_M_KR      ((v4l2_std_id)0x00008000)
+V4L2_STD_SECAM_B        ((v4l2_std_id)0x00010000)
+V4L2_STD_SECAM_D        ((v4l2_std_id)0x00020000)
+V4L2_STD_SECAM_G        ((v4l2_std_id)0x00040000)
+V4L2_STD_SECAM_H        ((v4l2_std_id)0x00080000)
+V4L2_STD_SECAM_K        ((v4l2_std_id)0x00100000)
+V4L2_STD_SECAM_K1       ((v4l2_std_id)0x00200000)
+V4L2_STD_SECAM_L        ((v4l2_std_id)0x00400000)
+V4L2_STD_SECAM_LC       ((v4l2_std_id)0x00800000)
+V4L2_STD_ATSC_8_VSB     ((v4l2_std_id)0x01000000)
+V4L2_STD_ATSC_16_VSB    ((v4l2_std_id)0x02000000)
-- 
2.34.1



More information about the Strace-devel mailing list