Add tracing and retracing for VIDIOC_G_TUNER and VIDIOC_S_TUNER. Signed-off-by: Deborah Brouwer <deborah.brouwer@xxxxxxxxxxxxx> --- utils/v4l2-tracer/libv4l2tracer.cpp | 2 ++ utils/v4l2-tracer/retrace.cpp | 28 ++++++++++++++++++++++++++++ utils/v4l2-tracer/trace.cpp | 4 ++++ utils/v4l2-tracer/v4l2-tracer-gen.pl | 26 ++++++++++++++++++++++++++ 4 files changed, 60 insertions(+) diff --git a/utils/v4l2-tracer/libv4l2tracer.cpp b/utils/v4l2-tracer/libv4l2tracer.cpp index a9f039c7..5ab493e8 100644 --- a/utils/v4l2-tracer/libv4l2tracer.cpp +++ b/utils/v4l2-tracer/libv4l2tracer.cpp @@ -26,6 +26,8 @@ const std::list<unsigned long> ioctls = { VIDIOC_ENUMINPUT, VIDIOC_G_CTRL, VIDIOC_S_CTRL, + VIDIOC_G_TUNER, + VIDIOC_S_TUNER, VIDIOC_QUERYCTRL, VIDIOC_G_INPUT, VIDIOC_S_INPUT, diff --git a/utils/v4l2-tracer/retrace.cpp b/utils/v4l2-tracer/retrace.cpp index 8667826c..b2d7c4b3 100644 --- a/utils/v4l2-tracer/retrace.cpp +++ b/utils/v4l2-tracer/retrace.cpp @@ -647,6 +647,28 @@ void retrace_vidioc_s_control(int fd_retrace, json_object *ioctl_args) free(ptr); } +void retrace_vidioc_g_tuner(int fd_retrace, json_object *ioctl_args) +{ + struct v4l2_tuner *ptr = retrace_v4l2_tuner_gen(ioctl_args); + ioctl(fd_retrace, VIDIOC_G_TUNER, ptr); + + if (is_verbose() || (errno != 0)) + perror("VIDIOC_G_TUNER"); + + free(ptr); +} + +void retrace_vidioc_s_tuner(int fd_retrace, json_object *ioctl_args) +{ + struct v4l2_tuner *ptr = retrace_v4l2_tuner_gen(ioctl_args); + ioctl(fd_retrace, VIDIOC_S_TUNER, ptr); + + if (is_verbose() || (errno != 0)) + perror("VIDIOC_S_TUNER"); + + free(ptr); +} + void retrace_vidioc_g_input(int fd_retrace, json_object *ioctl_args) { int input = 0; @@ -1240,6 +1262,12 @@ void retrace_ioctl(json_object *syscall_obj) case VIDIOC_S_CTRL: retrace_vidioc_s_control(fd_retrace, ioctl_args_user); break; + case VIDIOC_G_TUNER: + retrace_vidioc_g_tuner(fd_retrace, ioctl_args_user); + break; + case VIDIOC_S_TUNER: + retrace_vidioc_s_tuner(fd_retrace, ioctl_args_user); + break; case VIDIOC_QUERYCTRL: retrace_vidioc_queryctrl(fd_retrace, ioctl_args_user); break; diff --git a/utils/v4l2-tracer/trace.cpp b/utils/v4l2-tracer/trace.cpp index a393d0d4..ed8e94a0 100644 --- a/utils/v4l2-tracer/trace.cpp +++ b/utils/v4l2-tracer/trace.cpp @@ -563,6 +563,10 @@ json_object *trace_ioctl_args(unsigned long cmd, void *arg) case VIDIOC_S_CTRL: trace_v4l2_control_gen(arg, ioctl_args); break; + case VIDIOC_G_TUNER: + case VIDIOC_S_TUNER: + trace_v4l2_tuner_gen(arg, ioctl_args); + break; case VIDIOC_QUERYCTRL: trace_v4l2_queryctrl_gen(arg, ioctl_args); break; diff --git a/utils/v4l2-tracer/v4l2-tracer-gen.pl b/utils/v4l2-tracer/v4l2-tracer-gen.pl index d10be6a8..8c6f7cb5 100755 --- a/utils/v4l2-tracer/v4l2-tracer-gen.pl +++ b/utils/v4l2-tracer/v4l2-tracer-gen.pl @@ -162,6 +162,7 @@ sub get_val_def_name { v4l2_exportbuffer v4l2_cropcap v4l2_selection v4l2_sliced_vbi_cap v4l2_format v4l2_streamparm); @structs_that_use_v4l2_ctrl_type = qw(v4l2_queryctrl v4l2_query_ext_ctrl); + @structs_that_use_v4l2_tuner_type = qw(v4l2_tuner v4l2_frequency); if ($member eq "type") { foreach (@structs_that_use_v4l2_buf_type) { if ($struct_name eq $_) { @@ -242,6 +243,9 @@ sub get_val_def_name { if (($member eq "status") && ($struct_name eq "v4l2_input")) { $val_def_name = "input_field_val_def"; } + if ($member eq "audmode") { + return "tuner_audmode_val_def"; + } return ""; } @@ -276,6 +280,12 @@ sub get_flag_def_name { if ($struct_name =~ /capability$/) { return "v4l2_cap_flag_def"; } + if ($struct_name eq "v4l2_tuner") { + return "tuner_cap_flag_def"; + } + } + if ($member eq "rxsubchans") { + return "tuner_rxsub_flag_def"; } return ""; } @@ -908,6 +918,22 @@ while (<>) { flag_def_gen("V4L2_OUT_CAP_NATIVE_SIZE"); next } + if (grep {/^#define V4L2_TUNER_CAP_LOW\s+/} $_) { + printf $fh_common_info_h "constexpr flag_def tuner_cap_flag_def[] = {\n"; + flag_def_gen("V4L2_TUNER_CAP_1HZ"); + next + } + if (grep {/^#define V4L2_TUNER_SUB_MONO\s+/} $_) { + printf $fh_common_info_h "constexpr flag_def tuner_rxsub_flag_def[] = {\n"; + flag_def_gen("V4L2_TUNER_SUB_RDS"); + next + } + if (grep {/^#define V4L2_TUNER_MODE_MONO\s+/} $_) { + printf $fh_common_info_h "constexpr val_def tuner_audmode_val_def[] = {\n"; + val_def_gen("V4L2_TUNER_MODE_LANG1_LANG2"); + next + } + if (grep {/^#define V4L2_ENC_CMD_START\s+/} $_) { printf $fh_common_info_h "constexpr val_def encoder_cmd_val_def[] = {\n"; val_def_gen("V4L2_ENC_CMD_RESUME"); -- 2.40.1