diff options
author | Marek Vasut <marex@denx.de> | 2023-05-14 20:53:27 +0200 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2023-05-16 08:00:00 +0000 |
commit | 42f460aa02b317df79d4630ad82145c02f692672 (patch) | |
tree | 47b7289739b75450164bf4baf94f8c2b860e19ea | |
parent | 8f691206e4aa769cc99e264f1c15ae6956789f91 (diff) | |
download | strace-ldv/next.tar.gz |
v4l2: Add support for interpreting remaining fields in VIDIOC_ENUMINPUT struct v4l2_inputldv/next
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 commit:
b6456c0cfe9d ("V4L/DVB (13571): v4l: Adding Digital Video Timings APIs")
Latest documentation is at:
https://docs.kernel.org/userspace-api/media/v4l/vidioc-enuminput.html
Signed-off-by: Marek Vasut <marex@denx.de>
-rw-r--r-- | src/v4l2.c | 16 | ||||
-rw-r--r-- | src/xlat/v4l2_input_capabilities_flags.in | 4 | ||||
-rw-r--r-- | src/xlat/v4l2_input_status_flags.in | 16 | ||||
-rw-r--r-- | src/xlat/v4l2_std_ids.in | 27 | ||||
-rw-r--r-- | tests/ioctl_v4l2-success.c | 71 |
5 files changed, 121 insertions, 13 deletions
diff --git a/src/v4l2.c b/src/v4l2.c index d8b4ab81c..a652837ae 100644 --- a/src/v4l2.c +++ b/src/v4l2.c @@ -763,7 +763,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) @@ -787,6 +790,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) diff --git a/tests/ioctl_v4l2-success.c b/tests/ioctl_v4l2-success.c index 9875a1ab6..ade3f1b97 100644 --- a/tests/ioctl_v4l2-success.c +++ b/tests/ioctl_v4l2-success.c @@ -865,6 +865,36 @@ main(int argc, char **argv) { ARG_XLAT_UNKNOWN(0xdeadc0de, "V4L2_INPUT_TYPE_???") }, }; + static const struct strval32 input_std[] = { + { V4L2_STD_PAL_I, + XLAT_KNOWN(0x10, "V4L2_STD_PAL_I") }, + { V4L2_STD_SECAM_L, + XLAT_KNOWN(0x400000, "V4L2_STD_SECAM_L") }, + { V4L2_STD_PAL_B | V4L2_STD_PAL_G, + XLAT_KNOWN(0x5, "V4L2_STD_PAL_B|V4L2_STD_PAL_G") }, + { ARG_XLAT_UNKNOWN(0x80000000, "V4L2_STD_???") }, + }; + + static const struct strval32 input_status[] = { + { V4L2_IN_ST_NO_SIGNAL, + XLAT_KNOWN(0x2, "V4L2_IN_ST_NO_SIGNAL") }, + { V4L2_IN_ST_NO_STD_LOCK, + XLAT_KNOWN(0x800, "V4L2_IN_ST_NO_STD_LOCK") }, + { V4L2_IN_ST_NO_CARRIER | V4L2_IN_ST_NO_ACCESS, + XLAT_KNOWN(0x2040000, "V4L2_IN_ST_NO_CARRIER|V4L2_IN_ST_NO_ACCESS") }, + { ARG_XLAT_UNKNOWN(0x80000000, "V4L2_IN_ST_???") }, + }; + + static const struct strval32 input_caps[] = { + { V4L2_IN_CAP_DV_TIMINGS, + XLAT_KNOWN(0x2, "V4L2_IN_CAP_DV_TIMINGS") }, + { V4L2_IN_CAP_NATIVE_SIZE, + XLAT_KNOWN(0x8, "V4L2_IN_CAP_NATIVE_SIZE") }, + { V4L2_IN_CAP_STD | V4L2_IN_CAP_NATIVE_SIZE, + XLAT_KNOWN(0xc, "V4L2_IN_CAP_STD|V4L2_IN_CAP_NATIVE_SIZE") }, + { ARG_XLAT_UNKNOWN(0x80000000, "V4L2_IN_CAP_???") }, + }; + struct v4l2_input *input = tail_alloc(sizeof(*input)); ioctl(-1, VIDIOC_ENUMINPUT, 0); @@ -877,19 +907,34 @@ main(int argc, char **argv) for (size_t i = 0; i < ARRAY_SIZE(stdids); i++) { for (size_t j = 0; j < ARRAY_SIZE(input_types); j++) { - fill_memory32(input, sizeof(*input)); - fill_memory_ex(input->name, sizeof(input->name), - i * 47 + 13, 255); - input->type = input_types[j].val; - input->std = stdids[i].val; - - ioctl(-1, VIDIOC_ENUMINPUT, input); - printf("ioctl(-1, %s, {index=2158018784, name=", - XLAT_STR(VIDIOC_ENUMINPUT)); - print_quoted_cstring((char *) input->name, - sizeof(input->name)); - printf(", type=%s}) = %ld (INJECTED)\n", - input_types[j].str, inject_retval); + for (size_t k = 0; k < ARRAY_SIZE(input_std); k++) { + for (size_t l = 0; l < ARRAY_SIZE(input_status); l++) { + for (size_t m = 0; m < ARRAY_SIZE(input_caps); m++) { + fill_memory32(input, sizeof(*input)); + fill_memory_ex(input->name, sizeof(input->name), + i * 47 + 13, 255); + input->type = input_types[j].val; + input->std = stdids[i].val; + input->audioset = 0; + input->tuner = 0; + input->std = input_std[k].val; + input->status = input_status[l].val; + input->capabilities = input_caps[m].val; + + ioctl(-1, VIDIOC_ENUMINPUT, input); + printf("ioctl(-1, %s, {index=2158018784, name=", + XLAT_STR(VIDIOC_ENUMINPUT)); + print_quoted_cstring((char *) input->name, + sizeof(input->name)); + printf(", type=%s", input_types[j].str); + printf(", audioset=0, tuner=0"); + printf(", std=%s", input_std[k].str); + printf(", status=%s", input_status[l].str); + printf(", capabilities=%s}) = %ld (INJECTED)\n", + input_caps[m].str, inject_retval); + } + } + } } } |