aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac8
-rw-r--r--utils/cec-compliance/cec-compliance.cpp10
-rw-r--r--utils/cec-compliance/cec-compliance.h31
-rw-r--r--utils/cec-compliance/cec-test-audio.cpp231
-rw-r--r--utils/cec-compliance/cec-test-power.cpp17
-rw-r--r--utils/cec-compliance/cec-test.cpp182
-rw-r--r--utils/cec-ctl/cec-ctl.cpp19
-rw-r--r--utils/cec-ctl/cec-pin.cpp2
-rw-r--r--utils/cec-follower/cec-follower.cpp1
-rw-r--r--utils/cec-follower/cec-follower.h4
-rw-r--r--utils/cec-follower/cec-processing.cpp57
-rw-r--r--utils/cec-follower/cec-tuner.cpp140
-rw-r--r--utils/common/media-info.cpp27
-rw-r--r--utils/common/v4l2-info.cpp4
-rw-r--r--utils/ir-ctl/ir-ctl.c11
-rwxr-xr-xutils/libcecutil/cec-gen.pl2
-rw-r--r--utils/libcecutil/cec-info.cpp73
-rw-r--r--utils/libcecutil/cec-log.cpp15
-rw-r--r--utils/qv4l2/qv4l2.h8
-rw-r--r--utils/rds-ctl/rds-ctl.cpp4
-rw-r--r--utils/v4l2-compliance/v4l2-compliance.cpp2
-rw-r--r--utils/v4l2-compliance/v4l2-compliance.h18
-rw-r--r--utils/v4l2-compliance/v4l2-test-buffers.cpp12
-rw-r--r--utils/v4l2-compliance/v4l2-test-media.cpp2
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-common.cpp2
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-overlay.cpp24
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-subdev.cpp5
-rw-r--r--utils/v4l2-ctl/v4l2-ctl.h5
-rw-r--r--utils/v4l2-dbg/v4l2-dbg-ac97.h78
-rw-r--r--utils/v4l2-dbg/v4l2-dbg-bttv.h132
-rw-r--r--utils/v4l2-dbg/v4l2-dbg-em28xx.h105
-rw-r--r--utils/v4l2-dbg/v4l2-dbg-micron.h34
-rw-r--r--utils/v4l2-dbg/v4l2-dbg-saa7134.h230
-rw-r--r--utils/v4l2-dbg/v4l2-dbg-tvp5150.h146
-rw-r--r--utils/v4l2-dbg/v4l2-dbg.cpp98
35 files changed, 881 insertions, 858 deletions
diff --git a/configure.ac b/configure.ac
index 8470116d..8710ab45 100644
--- a/configure.ac
+++ b/configure.ac
@@ -299,7 +299,7 @@ AC_ARG_WITH([libudev],
have_libudev=no
AS_IF([test "x$with_libudev" != xno -o "x$enable_libdvbv5" != xno],
- [PKG_CHECK_MODULES(libudev, libudev, have_libudev=yes, [])
+ [PKG_CHECK_MODULES(libudev, libudev, have_libudev=yes, have_libudev=no)
AS_IF([test "x$have_libudev" = xyes],
[AC_DEFINE([HAVE_LIBUDEV], [], [Use libudev])
LIBUDEV_CFLAGS="$libudev_CFLAGS"
@@ -588,13 +588,13 @@ fi
CPPFLAGS="-I\$(top_srcdir)/lib/include -Wall -Wpointer-arith -D_GNU_SOURCE $CPPFLAGS"
# Obtain git SHA of HEAD
-AC_SUBST(GIT_SHA, ["-DGIT_SHA=\$(shell if test -d \$(top_srcdir)/.git ; then git -C \$(top_srcdir) rev-parse --short=12 HEAD ; fi)"])
+AC_SUBST(GIT_SHA, ["-DGIT_SHA=\$(shell if test -e \$(top_srcdir)/.git ; then git -C \$(top_srcdir) rev-parse --short=12 HEAD ; fi)"])
# Obtain git commit count of HEAD
-AC_SUBST(GIT_COMMIT_CNT, ["-DGIT_COMMIT_CNT=\$(shell if test -d \$(top_srcdir)/.git ; then printf '-'; git -C \$(top_srcdir) rev-list --count HEAD ; fi)"])
+AC_SUBST(GIT_COMMIT_CNT, ["-DGIT_COMMIT_CNT=\$(shell if test -e \$(top_srcdir)/.git ; then printf '-'; git -C \$(top_srcdir) rev-list --count HEAD ; fi)"])
# Obtain git commit date of HEAD
-AC_SUBST(GIT_COMMIT_DATE, ["-DGIT_COMMIT_DATE=\$(shell if test -d \$(top_srcdir)/.git ; then printf '\"'; TZ=UTC git -C \$(top_srcdir) show --quiet --date='format-local:%F %T\"' --format=\"%cd\"; fi)"])
+AC_SUBST(GIT_COMMIT_DATE, ["-DGIT_COMMIT_DATE=\$(shell if test -e \$(top_srcdir)/.git ; then printf '\"'; TZ=UTC git -C \$(top_srcdir) show --quiet --date='format-local:%F %T\"' --format=\"%cd\"; fi)"])
AM_COND_IF([WITH_LIBDVBV5], [USE_LIBDVBV5="yes"], [USE_LIBDVBV5="no"])
AM_COND_IF([WITH_DVBV5_REMOTE], [USE_DVBV5_REMOTE="yes"
diff --git a/utils/cec-compliance/cec-compliance.cpp b/utils/cec-compliance/cec-compliance.cpp
index eb3a5421..9a9d03fe 100644
--- a/utils/cec-compliance/cec-compliance.cpp
+++ b/utils/cec-compliance/cec-compliance.cpp
@@ -1053,8 +1053,14 @@ static void topology_probe_device(struct node *node, unsigned i, unsigned la)
} else {
node->remote[i].vendor_id = (msg.msg[2] << 16) |
(msg.msg[3] << 8) | msg.msg[4];
- printf("0x%06x %s\n", node->remote[i].vendor_id,
- cec_vendor2s(node->remote[i].vendor_id));
+
+ const char *vendor = cec_vendor2s(node->remote[i].vendor_id);
+
+ if (vendor)
+ printf("0x%06x (%s)\n",
+ node->remote[i].vendor_id, vendor);
+ else
+ printf("0x%06x\n", node->remote[i].vendor_id);
}
cec_msg_init(&msg, la, i);
diff --git a/utils/cec-compliance/cec-compliance.h b/utils/cec-compliance/cec-compliance.h
index d87e4f1b..c558f043 100644
--- a/utils/cec-compliance/cec-compliance.h
+++ b/utils/cec-compliance/cec-compliance.h
@@ -19,6 +19,8 @@
#include <cec-info.h>
+#include <vector>
+
#define TAG_AUDIO_RATE_CONTROL 1
#define TAG_ARC_CONTROL (1 << 1)
#define TAG_CAP_DISCOVERY_CONTROL (1 << 2)
@@ -174,6 +176,8 @@ struct remote_subtest {
bool for_cec20;
};
+using vec_remote_subtests = std::vector<remote_subtest>;
+
#define OK 0
#define FAIL 1
#define OK_PRESUMED 2
@@ -187,9 +191,6 @@ struct remote_subtest {
#define CEC_LOG_ADDR_MASK_ALL 0xffff
-#define ARRAY_SIZE(a) \
- (sizeof(a) / sizeof(*a))
-
#define COLOR_GREEN(s) "\033[32m" s "\033[0m"
#define COLOR_RED(s) "\033[1;31m" s "\033[0m"
#define COLOR_BOLD(s) "\033[1m" s "\033[0m"
@@ -456,25 +457,17 @@ void testRemote(struct node *node, unsigned me, unsigned la, unsigned test_tags,
bool interactive);
// cec-test-audio.cpp
-extern struct remote_subtest sac_subtests[];
-extern const unsigned sac_subtests_size;
-extern struct remote_subtest dal_subtests[];
-extern const unsigned dal_subtests_size;
-extern struct remote_subtest arc_subtests[];
-extern const unsigned arc_subtests_size;
-extern struct remote_subtest audio_rate_ctl_subtests[];
-extern const unsigned audio_rate_ctl_subtests_size;
+extern const vec_remote_subtests sac_subtests;
+extern const vec_remote_subtests dal_subtests;
+extern const vec_remote_subtests arc_subtests;
+extern const vec_remote_subtests audio_rate_ctl_subtests;
// cec-test-power.cpp
bool util_interactive_ensure_power_state(struct node *node, unsigned me, unsigned la, bool interactive,
__u8 target_pwr);
-extern struct remote_subtest standby_subtests[];
-extern const unsigned standby_subtests_size;
-extern struct remote_subtest one_touch_play_subtests[];
-extern const unsigned one_touch_play_subtests_size;
-extern struct remote_subtest power_status_subtests[];
-extern const unsigned power_status_subtests_size;
-extern struct remote_subtest standby_resume_subtests[];
-extern const unsigned standby_resume_subtests_size;
+extern const vec_remote_subtests standby_subtests;
+extern const vec_remote_subtests one_touch_play_subtests;
+extern const vec_remote_subtests power_status_subtests;
+extern const vec_remote_subtests standby_resume_subtests;
#endif
diff --git a/utils/cec-compliance/cec-test-audio.cpp b/utils/cec-compliance/cec-test-audio.cpp
index 30b702e7..bdbcd178 100644
--- a/utils/cec-compliance/cec-test-audio.cpp
+++ b/utils/cec-compliance/cec-test-audio.cpp
@@ -82,14 +82,11 @@ static int dal_req_current_latency_invalid(struct node *node, unsigned me, unsig
return 0;
}
-struct remote_subtest dal_subtests[] = {
+const vec_remote_subtests dal_subtests{
{ "Request Current Latency", CEC_LOG_ADDR_MASK_ALL, dal_request_current_latency },
{ "Request Current Latency with invalid PA", CEC_LOG_ADDR_MASK_ALL, dal_req_current_latency_invalid },
};
-const unsigned dal_subtests_size = ARRAY_SIZE(dal_subtests);
-
-
/* Audio Return Channel Control */
static __u16 pa_common_mask(__u16 pa1, __u16 pa2)
@@ -274,16 +271,13 @@ static int arc_terminate_rx(struct node *node, unsigned me, unsigned la, bool in
return 0;
}
-struct remote_subtest arc_subtests[] = {
+const vec_remote_subtests arc_subtests{
{ "Initiate ARC (RX)", CEC_LOG_ADDR_MASK_ALL, arc_initiate_rx },
{ "Terminate ARC (RX)", CEC_LOG_ADDR_MASK_ALL, arc_terminate_rx },
{ "Initiate ARC (TX)", CEC_LOG_ADDR_MASK_ALL, arc_initiate_tx },
{ "Terminate ARC (TX)", CEC_LOG_ADDR_MASK_ALL, arc_terminate_tx },
};
-const unsigned arc_subtests_size = ARRAY_SIZE(arc_subtests);
-
-
/* System Audio Control */
/*
@@ -762,72 +756,101 @@ static int sac_system_audio_mode_req_off(struct node *node, unsigned me, unsigne
return 0;
}
-struct remote_subtest sac_subtests[] = {
- { "Request Short Audio Descriptor",
- CEC_LOG_ADDR_MASK_AUDIOSYSTEM,
- sac_request_sad_probe },
- { "Request Short Audio Descriptor, invalid",
- CEC_LOG_ADDR_MASK_AUDIOSYSTEM,
- sac_request_sad_invalid },
- { "Report Short Audio Descriptor consistency",
- CEC_LOG_ADDR_MASK_AUDIOSYSTEM,
- sac_sad_format_check },
- { "Report Short Audio Descriptor, multiple requests in one",
- CEC_LOG_ADDR_MASK_AUDIOSYSTEM,
- sac_sad_req_multiple },
- { "Set System Audio Mode (directly addressed)",
- CEC_LOG_ADDR_MASK_TV,
- sac_set_system_audio_mode_direct },
- { "Set System Audio Mode (broadcast on)",
- CEC_LOG_ADDR_MASK_TV,
- sac_set_system_audio_mode_broadcast_on },
- { "System Audio Mode Status",
- CEC_LOG_ADDR_MASK_TV,
- sac_system_audio_mode_status },
- { "System Audio Mode Request (on)",
- CEC_LOG_ADDR_MASK_AUDIOSYSTEM,
- sac_system_audio_mode_req_on },
- { "Give System Audio Mode Status",
- CEC_LOG_ADDR_MASK_AUDIOSYSTEM,
- sac_give_system_audio_mode_status },
- { "Give Audio Status",
- CEC_LOG_ADDR_MASK_AUDIOSYSTEM,
- sac_give_audio_status },
- { "User Control Pressed (Volume Up)",
- CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
- sac_user_control_press_vol_up },
- { "User Control Pressed (Volume Down)",
- CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
- sac_user_control_press_vol_down },
- { "User Control Pressed (Mute)",
- CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
- sac_user_control_press_mute },
- { "User Control Pressed (Restore Volume Function)",
- CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
- sac_user_control_press_restore_volume_function },
- { "User Control Pressed (Mute Function)",
- CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
- sac_user_control_press_mute_function },
- { "User Control Released (Audio)",
- CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
- sac_user_control_release },
- { "Set System Audio Mode (broadcast off)",
- CEC_LOG_ADDR_MASK_TV,
- sac_set_system_audio_mode_broadcast_off },
- { "System Audio Mode Request (off)",
- CEC_LOG_ADDR_MASK_AUDIOSYSTEM,
- sac_system_audio_mode_req_off },
+const vec_remote_subtests sac_subtests{
+ {
+ "Request Short Audio Descriptor",
+ CEC_LOG_ADDR_MASK_AUDIOSYSTEM,
+ sac_request_sad_probe,
+ },
+ {
+ "Request Short Audio Descriptor, invalid",
+ CEC_LOG_ADDR_MASK_AUDIOSYSTEM,
+ sac_request_sad_invalid,
+ },
+ {
+ "Report Short Audio Descriptor consistency",
+ CEC_LOG_ADDR_MASK_AUDIOSYSTEM,
+ sac_sad_format_check,
+ },
+ {
+ "Report Short Audio Descriptor, multiple requests in one",
+ CEC_LOG_ADDR_MASK_AUDIOSYSTEM,
+ sac_sad_req_multiple,
+ },
+ {
+ "Set System Audio Mode (directly addressed)",
+ CEC_LOG_ADDR_MASK_TV,
+ sac_set_system_audio_mode_direct,
+ },
+ {
+ "Set System Audio Mode (broadcast on)",
+ CEC_LOG_ADDR_MASK_TV,
+ sac_set_system_audio_mode_broadcast_on,
+ },
+ {
+ "System Audio Mode Status",
+ CEC_LOG_ADDR_MASK_TV,
+ sac_system_audio_mode_status,
+ },
+ {
+ "System Audio Mode Request (on)",
+ CEC_LOG_ADDR_MASK_AUDIOSYSTEM,
+ sac_system_audio_mode_req_on,
+ },
+ {
+ "Give System Audio Mode Status",
+ CEC_LOG_ADDR_MASK_AUDIOSYSTEM,
+ sac_give_system_audio_mode_status,
+ },
+ {
+ "Give Audio Status",
+ CEC_LOG_ADDR_MASK_AUDIOSYSTEM,
+ sac_give_audio_status,
+ },
+ {
+ "User Control Pressed (Volume Up)",
+ CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
+ sac_user_control_press_vol_up,
+ },
+ {
+ "User Control Pressed (Volume Down)",
+ CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
+ sac_user_control_press_vol_down,
+ },
+ {
+ "User Control Pressed (Mute)",
+ CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
+ sac_user_control_press_mute,
+ },
+ {
+ "User Control Pressed (Restore Volume Function)",
+ CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
+ sac_user_control_press_restore_volume_function,
+ },
+ {
+ "User Control Pressed (Mute Function)",
+ CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
+ sac_user_control_press_mute_function,
+ },
+ {
+ "User Control Released (Audio)",
+ CEC_LOG_ADDR_MASK_AUDIOSYSTEM | CEC_LOG_ADDR_MASK_TV,
+ sac_user_control_release,
+ },
+ {
+ "Set System Audio Mode (broadcast off)",
+ CEC_LOG_ADDR_MASK_TV,
+ sac_set_system_audio_mode_broadcast_off,
+ },
+ {
+ "System Audio Mode Request (off)",
+ CEC_LOG_ADDR_MASK_AUDIOSYSTEM,
+ sac_system_audio_mode_req_off,
+ },
};
-const unsigned sac_subtests_size = ARRAY_SIZE(sac_subtests);
-
-
/* Audio Rate Control */
-/*
- TODO: These are very rudimentary tests which should be expanded.
- */
-
static int audio_rate_ctl_set_audio_rate(struct node *node, unsigned me, unsigned la, bool interactive)
{
struct cec_msg msg = {};
@@ -848,10 +871,66 @@ static int audio_rate_ctl_set_audio_rate(struct node *node, unsigned me, unsigne
return OK_PRESUMED;
}
-struct remote_subtest audio_rate_ctl_subtests[] = {
- { "Set Audio Rate",
- CEC_LOG_ADDR_MASK_PLAYBACK | CEC_LOG_ADDR_MASK_RECORD | CEC_LOG_ADDR_MASK_TUNER,
- audio_rate_ctl_set_audio_rate },
-};
+static int audio_rate_ctl_active_sensing(struct node *node, unsigned me, unsigned la, bool interactive)
+{
+ /*
+ * The source shall go back to Rate Control Off if no Set Audio Rate message is
+ * received for more than 2 seconds.
+ */
+ if (!node->remote[la].has_aud_rate)
+ return NOTAPPLICABLE;
+
+ struct cec_msg msg = {};
+
+ cec_msg_init(&msg, me, la);
+
+ /*
+ * Since this subtest runs immediately after Set Audio Rate, delaying the interval
+ * between the two tests is sufficient to test that the Source turns off rate control.
+ */
+ sleep(3);
+ cec_msg_set_audio_rate(&msg, CEC_OP_AUD_RATE_OFF);
+ fail_on_test(!transmit_timeout(node, &msg));
+ fail_on_test_v2(node->remote[la].cec_version, unrecognized_op(&msg));
+ return OK_PRESUMED;
+}
+
+static int audio_rate_ctl_invalid(struct node *node, unsigned me, unsigned la, bool interactive)
+{
+ if (!node->remote[la].has_aud_rate)
+ return NOTAPPLICABLE;
+
+ struct cec_msg msg = {};
-const unsigned audio_rate_ctl_subtests_size = ARRAY_SIZE(audio_rate_ctl_subtests);
+ cec_msg_init(&msg, me, la);
+ cec_msg_set_audio_rate(&msg, 0xa); /* Invalid Audio Rate Control message operand */
+ fail_on_test(!transmit_timeout(node, &msg));
+ fail_on_test(timed_out(&msg));
+ fail_on_test(!cec_msg_status_is_abort(&msg));
+ if (abort_reason(&msg) != CEC_OP_ABORT_INVALID_OP) {
+ warn("Expected Feature Abort [Invalid operand]\n");
+ return FAIL;
+ }
+ return OK;
+}
+
+const vec_remote_subtests audio_rate_ctl_subtests{
+ {
+ "Set Audio Rate",
+ CEC_LOG_ADDR_MASK_PLAYBACK | CEC_LOG_ADDR_MASK_RECORD |
+ CEC_LOG_ADDR_MASK_TUNER | CEC_LOG_ADDR_MASK_AUDIOSYSTEM,
+ audio_rate_ctl_set_audio_rate,
+ },
+ {
+ "Audio Rate Active Sensing",
+ CEC_LOG_ADDR_MASK_PLAYBACK | CEC_LOG_ADDR_MASK_RECORD |
+ CEC_LOG_ADDR_MASK_TUNER | CEC_LOG_ADDR_MASK_AUDIOSYSTEM,
+ audio_rate_ctl_active_sensing,
+ },
+ {
+ "Audio Rate Invalid Operand",
+ CEC_LOG_ADDR_MASK_PLAYBACK | CEC_LOG_ADDR_MASK_RECORD |
+ CEC_LOG_ADDR_MASK_TUNER | CEC_LOG_ADDR_MASK_AUDIOSYSTEM,
+ audio_rate_ctl_invalid,
+ },
+};
diff --git a/utils/cec-compliance/cec-test-power.cpp b/utils/cec-compliance/cec-test-power.cpp
index 42f4d298..bc88eca7 100644
--- a/utils/cec-compliance/cec-test-power.cpp
+++ b/utils/cec-compliance/cec-test-power.cpp
@@ -6,6 +6,7 @@
#include <cerrno>
#include <ctime>
#include <string>
+#include <vector>
#include <sys/ioctl.h>
#include <unistd.h>
@@ -95,14 +96,11 @@ static int power_status_report(struct node *node, unsigned me, unsigned la, bool
return OK_PRESUMED;
}
-struct remote_subtest power_status_subtests[] = {
+const vec_remote_subtests power_status_subtests{
{ "Give Device Power Status", CEC_LOG_ADDR_MASK_ALL, power_status_give },
{ "Report Device Power Status", CEC_LOG_ADDR_MASK_ALL, power_status_report },
};
-const unsigned power_status_subtests_size = ARRAY_SIZE(power_status_subtests);
-
-
/* One Touch Play */
static int one_touch_play_view_on(struct node *node, unsigned me, unsigned la, bool interactive,
@@ -233,7 +231,7 @@ static int one_touch_play_req_active_source(struct node *node, unsigned me, unsi
return 0;
}
-struct remote_subtest one_touch_play_subtests[] = {
+const vec_remote_subtests one_touch_play_subtests{
{ "Image View On", CEC_LOG_ADDR_MASK_TV, one_touch_play_image_view_on },
{ "Text View On", CEC_LOG_ADDR_MASK_TV, one_touch_play_text_view_on },
{ "Wakeup on Image View On", CEC_LOG_ADDR_MASK_TV, one_touch_play_image_view_on_wakeup },
@@ -243,9 +241,6 @@ struct remote_subtest one_touch_play_subtests[] = {
{ "Active Source and Request Active Source", CEC_LOG_ADDR_MASK_ALL, one_touch_play_req_active_source },
};
-const unsigned one_touch_play_subtests_size = ARRAY_SIZE(one_touch_play_subtests);
-
-
/* Standby / Resume */
/* The default sleep time between power status requests. */
@@ -638,7 +633,7 @@ static int power_state_transitions(struct node *node, unsigned me, unsigned la,
return 0;
}
-struct remote_subtest standby_resume_subtests[] = {
+const vec_remote_subtests standby_resume_subtests{
{ "Standby", CEC_LOG_ADDR_MASK_ALL, standby_resume_standby },
{ "Repeated Standby message does not wake up", CEC_LOG_ADDR_MASK_ALL, standby_resume_standby_toggle },
{ "Standby: Feature aborts unknown messages", CEC_LOG_ADDR_MASK_ALL, core_unknown, true },
@@ -652,10 +647,8 @@ struct remote_subtest standby_resume_subtests[] = {
{ "Standby: Get Menu Language", CEC_LOG_ADDR_MASK_ALL, system_info_get_menu_lang, true },
{ "Standby: Give Device Features", CEC_LOG_ADDR_MASK_ALL, system_info_give_features, true },
{ "No wakeup on Active Source", CEC_LOG_ADDR_MASK_ALL, standby_resume_active_source_nowake },
- { "Wake up", CEC_LOG_ADDR_MASK_ALL, standby_resume_wakeup},
+ { "Wake up", CEC_LOG_ADDR_MASK_ALL, standby_resume_wakeup },
{ "Wake up TV on Image View On", CEC_LOG_ADDR_MASK_TV, standby_resume_wakeup_image_view_on },
{ "Wake up TV on Text View On", CEC_LOG_ADDR_MASK_TV, standby_resume_wakeup_text_view_on },
{ "Power State Transitions", CEC_LOG_ADDR_MASK_TV, power_state_transitions, false, true },
};
-
-const unsigned standby_resume_subtests_size = ARRAY_SIZE(standby_resume_subtests);
diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp
index 8a9ea2af..8da29f22 100644
--- a/utils/cec-compliance/cec-test.cpp
+++ b/utils/cec-compliance/cec-test.cpp
@@ -13,14 +13,10 @@
#include "cec-compliance.h"
-#define test_case(name, tags, subtests) {name, tags, subtests, ARRAY_SIZE(subtests)}
-#define test_case_ext(name, tags, subtests) {name, tags, subtests, subtests##_size}
-
struct remote_test {
const char *name;
const unsigned tags;
- struct remote_subtest *subtests;
- unsigned num_subtests;
+ const vec_remote_subtests &subtests;
};
@@ -178,7 +174,7 @@ int system_info_give_features(struct node *node, unsigned me, unsigned la, bool
return 0;
}
-static struct remote_subtest system_info_subtests[] = {
+static const vec_remote_subtests system_info_subtests{
{ "Polling Message", CEC_LOG_ADDR_MASK_ALL, system_info_polling },
{ "Give Physical Address", CEC_LOG_ADDR_MASK_ALL, system_info_phys_addr },
{ "Give CEC Version", CEC_LOG_ADDR_MASK_ALL, system_info_version },
@@ -187,7 +183,6 @@ static struct remote_subtest system_info_subtests[] = {
{ "Give Device Features", CEC_LOG_ADDR_MASK_ALL, system_info_give_features },
};
-
/* Core behavior */
int core_unknown(struct node *node, unsigned me, unsigned la, bool interactive)
@@ -237,12 +232,11 @@ int core_abort(struct node *node, unsigned me, unsigned la, bool interactive)
return 0;
}
-static struct remote_subtest core_subtests[] = {
+static const vec_remote_subtests core_subtests{
{ "Feature aborts unknown messages", CEC_LOG_ADDR_MASK_ALL, core_unknown },
{ "Feature aborts Abort message", CEC_LOG_ADDR_MASK_ALL, core_abort },
};
-
/* Vendor Specific Commands */
int vendor_specific_commands_id(struct node *node, unsigned me, unsigned la, bool interactive)
@@ -265,11 +259,10 @@ int vendor_specific_commands_id(struct node *node, unsigned me, unsigned la, boo
return 0;
}
-static struct remote_subtest vendor_specific_subtests[] = {
+static const vec_remote_subtests vendor_specific_subtests{
{ "Give Device Vendor ID", CEC_LOG_ADDR_MASK_ALL, vendor_specific_commands_id },
};
-
/* Device OSD Transfer */
static int device_osd_transfer_set(struct node *node, unsigned me, unsigned la, bool interactive)
@@ -317,12 +310,11 @@ int device_osd_transfer_give(struct node *node, unsigned me, unsigned la, bool i
return 0;
}
-static struct remote_subtest device_osd_transfer_subtests[] = {
+static const vec_remote_subtests device_osd_transfer_subtests{
{ "Set OSD Name", CEC_LOG_ADDR_MASK_ALL, device_osd_transfer_set },
{ "Give OSD Name", CEC_LOG_ADDR_MASK_ALL, device_osd_transfer_give },
};
-
/* OSD Display */
static int osd_string_set_default(struct node *node, unsigned me, unsigned la, bool interactive)
@@ -418,13 +410,12 @@ static int osd_string_invalid(struct node *node, unsigned me, unsigned la, bool
return 0;
}
-static struct remote_subtest osd_string_subtests[] = {
+static const vec_remote_subtests osd_string_subtests{
{ "Set OSD String with default timeout", CEC_LOG_ADDR_MASK_TV, osd_string_set_default },
{ "Set OSD String with no timeout", CEC_LOG_ADDR_MASK_TV, osd_string_set_until_clear },
{ "Set OSD String with invalid operand", CEC_LOG_ADDR_MASK_TV, osd_string_invalid },
};
-
/* Routing Control */
static int routing_control_inactive_source(struct node *node, unsigned me, unsigned la, bool interactive)
@@ -525,14 +516,13 @@ static int routing_control_set_stream_path(struct node *node, unsigned me, unsig
return OK_PRESUMED;
}
-static struct remote_subtest routing_control_subtests[] = {
+static const vec_remote_subtests routing_control_subtests{
{ "Active Source", CEC_LOG_ADDR_MASK_TV, routing_control_active_source },
{ "Request Active Source", CEC_LOG_ADDR_MASK_ALL, routing_control_req_active_source },
{ "Inactive Source", CEC_LOG_ADDR_MASK_TV, routing_control_inactive_source },
{ "Set Stream Path", CEC_LOG_ADDR_MASK_ALL, routing_control_set_stream_path },
};
-
/* Remote Control Passthrough */
static int rc_passthrough_user_ctrl_pressed(struct node *node, unsigned me, unsigned la, bool interactive)
@@ -573,12 +563,11 @@ static int rc_passthrough_user_ctrl_released(struct node *node, unsigned me, uns
return OK_PRESUMED;
}
-static struct remote_subtest rc_passthrough_subtests[] = {
+static const vec_remote_subtests rc_passthrough_subtests{
{ "User Control Pressed", CEC_LOG_ADDR_MASK_ALL, rc_passthrough_user_ctrl_pressed },
{ "User Control Released", CEC_LOG_ADDR_MASK_ALL, rc_passthrough_user_ctrl_released },
};
-
/* Device Menu Control */
/*
@@ -604,13 +593,12 @@ static int dev_menu_ctl_request(struct node *node, unsigned me, unsigned la, boo
return 0;
}
-static struct remote_subtest dev_menu_ctl_subtests[] = {
+static const vec_remote_subtests dev_menu_ctl_subtests{
{ "Menu Request", static_cast<__u16>(~CEC_LOG_ADDR_MASK_TV), dev_menu_ctl_request },
{ "User Control Pressed", CEC_LOG_ADDR_MASK_ALL, rc_passthrough_user_ctrl_pressed },
{ "User Control Released", CEC_LOG_ADDR_MASK_ALL, rc_passthrough_user_ctrl_released },
};
-
/* Deck Control */
/*
@@ -704,22 +692,13 @@ static int deck_ctl_play(struct node *node, unsigned me, unsigned la, bool inter
return OK_PRESUMED;
}
-static struct remote_subtest deck_ctl_subtests[] = {
- { "Give Deck Status",
- CEC_LOG_ADDR_MASK_PLAYBACK | CEC_LOG_ADDR_MASK_RECORD,
- deck_ctl_give_status },
- { "Deck Status",
- CEC_LOG_ADDR_MASK_ALL,
- deck_ctl_deck_status },
- { "Deck Control",
- CEC_LOG_ADDR_MASK_PLAYBACK | CEC_LOG_ADDR_MASK_RECORD,
- deck_ctl_deck_ctl },
- { "Play",
- CEC_LOG_ADDR_MASK_PLAYBACK | CEC_LOG_ADDR_MASK_RECORD,
- deck_ctl_play },
+static const vec_remote_subtests deck_ctl_subtests{
+ { "Give Deck Status", CEC_LOG_ADDR_MASK_PLAYBACK | CEC_LOG_ADDR_MASK_RECORD, deck_ctl_give_status },
+ { "Deck Status", CEC_LOG_ADDR_MASK_ALL, deck_ctl_deck_status },
+ { "Deck Control", CEC_LOG_ADDR_MASK_PLAYBACK | CEC_LOG_ADDR_MASK_RECORD, deck_ctl_deck_ctl },
+ { "Play", CEC_LOG_ADDR_MASK_PLAYBACK | CEC_LOG_ADDR_MASK_RECORD, deck_ctl_play },
};
-
/* Tuner Control */
static const char *bcast_type2s(__u8 bcast_type)
@@ -957,11 +936,10 @@ static int tuner_ctl_test(struct node *node, unsigned me, unsigned la, bool inte
return 0;
}
-static struct remote_subtest tuner_ctl_subtests[] = {
+static const vec_remote_subtests tuner_ctl_subtests{
{ "Tuner Control", CEC_LOG_ADDR_MASK_TUNER | CEC_LOG_ADDR_MASK_TV, tuner_ctl_test },
};
-
/* One Touch Record */
/*
@@ -1061,14 +1039,13 @@ static int one_touch_rec_status(struct node *node, unsigned me, unsigned la, boo
return 0;
}
-static struct remote_subtest one_touch_rec_subtests[] = {
+static const vec_remote_subtests one_touch_rec_subtests{
{ "Record TV Screen", CEC_LOG_ADDR_MASK_TV, one_touch_rec_tv_screen },
{ "Record On", CEC_LOG_ADDR_MASK_RECORD, one_touch_rec_on },
{ "Record Off", CEC_LOG_ADDR_MASK_RECORD, one_touch_rec_off },
{ "Record Status", CEC_LOG_ADDR_MASK_ALL, one_touch_rec_status },
};
-
/* Timer Programming */
/*
@@ -1281,7 +1258,7 @@ static int timer_prog_timer_clear_status(struct node *node, unsigned me, unsigne
return OK_PRESUMED;
}
-static struct remote_subtest timer_prog_subtests[] = {
+static const vec_remote_subtests timer_prog_subtests{
{ "Set Analogue Timer", CEC_LOG_ADDR_MASK_RECORD, timer_prog_set_analog_timer },
{ "Set Digital Timer", CEC_LOG_ADDR_MASK_RECORD, timer_prog_set_digital_timer },
{ "Set Timer Program Title", CEC_LOG_ADDR_MASK_RECORD, timer_prog_set_prog_title },
@@ -1384,11 +1361,10 @@ static int cdc_hec_discover(struct node *node, unsigned me, unsigned la, bool pr
return OK_NOT_SUPPORTED;
}
-static struct remote_subtest cdc_subtests[] = {
+static const vec_remote_subtests cdc_subtests{
{ "CDC_HEC_Discover", CEC_LOG_ADDR_MASK_ALL, cdc_hec_discover },
};
-
/* Post-test checks */
static int post_test_check_recognized(struct node *node, unsigned me, unsigned la, bool interactive)
@@ -1409,79 +1385,33 @@ static int post_test_check_recognized(struct node *node, unsigned me, unsigned l
return 0;
}
-static struct remote_subtest post_test_subtests[] = {
+static const vec_remote_subtests post_test_subtests{
{ "Recognized/unrecognized message consistency", CEC_LOG_ADDR_MASK_ALL, post_test_check_recognized },
};
-
-static const struct remote_test tests[] = {
- test_case("Core",
- TAG_CORE,
- core_subtests),
- test_case_ext("Give Device Power Status feature",
- TAG_POWER_STATUS,
- power_status_subtests),
- test_case("System Information feature",
- TAG_SYSTEM_INFORMATION,
- system_info_subtests),
- test_case("Vendor Specific Commands feature",
- TAG_VENDOR_SPECIFIC_COMMANDS,
- vendor_specific_subtests),
- test_case("Device OSD Transfer feature",
- TAG_DEVICE_OSD_TRANSFER,
- device_osd_transfer_subtests),
- test_case("OSD String feature",
- TAG_OSD_DISPLAY,
- osd_string_subtests),
- test_case("Remote Control Passthrough feature",
- TAG_REMOTE_CONTROL_PASSTHROUGH,
- rc_passthrough_subtests),
- test_case("Device Menu Control feature",
- TAG_DEVICE_MENU_CONTROL,
- dev_menu_ctl_subtests),
- test_case("Deck Control feature",
- TAG_DECK_CONTROL,
- deck_ctl_subtests),
- test_case("Tuner Control feature",
- TAG_TUNER_CONTROL,
- tuner_ctl_subtests),
- test_case("One Touch Record feature",
- TAG_ONE_TOUCH_RECORD,
- one_touch_rec_subtests),
- test_case("Timer Programming feature",
- TAG_TIMER_PROGRAMMING,
- timer_prog_subtests),
- test_case("Capability Discovery and Control feature",
- TAG_CAP_DISCOVERY_CONTROL,
- cdc_subtests),
- test_case_ext("Dynamic Auto Lipsync feature",
- TAG_DYNAMIC_AUTO_LIPSYNC,
- dal_subtests),
- test_case_ext("Audio Return Channel feature",
- TAG_ARC_CONTROL,
- arc_subtests),
- test_case_ext("System Audio Control feature",
- TAG_SYSTEM_AUDIO_CONTROL,
- sac_subtests),
- test_case_ext("Audio Rate Control feature",
- TAG_AUDIO_RATE_CONTROL,
- audio_rate_ctl_subtests),
- test_case_ext("One Touch Play feature",
- TAG_ONE_TOUCH_PLAY,
- one_touch_play_subtests),
- test_case("Routing Control feature",
- TAG_ROUTING_CONTROL,
- routing_control_subtests),
- test_case_ext("Standby/Resume and Power Status",
- TAG_POWER_STATUS | TAG_STANDBY_RESUME,
- standby_resume_subtests),
- test_case("Post-test checks",
- TAG_CORE,
- post_test_subtests),
+static const remote_test tests[] = {
+ { "Core", TAG_CORE, core_subtests },
+ { "Give Device Power Status feature", TAG_POWER_STATUS, power_status_subtests },
+ { "System Information feature", TAG_SYSTEM_INFORMATION, system_info_subtests },
+ { "Vendor Specific Commands feature", TAG_VENDOR_SPECIFIC_COMMANDS, vendor_specific_subtests },
+ { "Device OSD Transfer feature", TAG_DEVICE_OSD_TRANSFER, device_osd_transfer_subtests },
+ { "OSD String feature", TAG_OSD_DISPLAY, osd_string_subtests },
+ { "Remote Control Passthrough feature", TAG_REMOTE_CONTROL_PASSTHROUGH, rc_passthrough_subtests },
+ { "Device Menu Control feature", TAG_DEVICE_MENU_CONTROL, dev_menu_ctl_subtests },
+ { "Deck Control feature", TAG_DECK_CONTROL, deck_ctl_subtests },
+ { "Tuner Control feature", TAG_TUNER_CONTROL, tuner_ctl_subtests },
+ { "One Touch Record feature", TAG_ONE_TOUCH_RECORD, one_touch_rec_subtests },
+ { "Timer Programming feature", TAG_TIMER_PROGRAMMING, timer_prog_subtests },
+ { "Capability Discovery and Control feature", TAG_CAP_DISCOVERY_CONTROL, cdc_subtests },
+ { "Dynamic Auto Lipsync feature", TAG_DYNAMIC_AUTO_LIPSYNC, dal_subtests },
+ { "Audio Return Channel feature", TAG_ARC_CONTROL, arc_subtests },
+ { "System Audio Control feature", TAG_SYSTEM_AUDIO_CONTROL, sac_subtests },
+ { "Audio Rate Control feature", TAG_AUDIO_RATE_CONTROL, audio_rate_ctl_subtests },
+ { "Routing Control feature", TAG_ROUTING_CONTROL, routing_control_subtests },
+ { "Standby/Resume and Power Status", TAG_POWER_STATUS | TAG_STANDBY_RESUME, standby_resume_subtests },
+ { "Post-test checks", TAG_CORE, post_test_subtests },
};
-static const unsigned num_tests = sizeof(tests) / sizeof(struct remote_test);
-
static std::map<std::string, int> mapTests;
static std::map<std::string, bool> mapTestsNoWarnings;
@@ -1490,14 +1420,13 @@ void collectTests()
std::map<std::string, __u64> mapTestFuncs;
for (const auto &test : tests) {
- for (unsigned j = 0; j < test.num_subtests; j++) {
- std::string name = safename(test.subtests[j].name);
- auto func = (__u64)test.subtests[j].test_fn;
+ for (const auto &subtest : test.subtests) {
+ std::string name = safename(subtest.name);
+ auto func = (__u64)subtest.test_fn;
if (mapTestFuncs.find(name) != mapTestFuncs.end() &&
mapTestFuncs[name] != func) {
- fprintf(stderr, "Duplicate subtest name, but different tests: %s\n",
- test.subtests[j].name);
+ fprintf(stderr, "Duplicate subtest name, but different tests: %s\n", subtest.name);
std::exit(EXIT_FAILURE);
}
mapTestFuncs[name] = func;
@@ -1511,10 +1440,8 @@ void listTests()
{
for (const auto &test : tests) {
printf("%s:\n", test.name);
- for (unsigned j = 0; j < test.num_subtests; j++) {
- std::string name = safename(test.subtests[j].name);
-
- printf("\t%s\n", name.c_str());
+ for (const auto &subtest : test.subtests) {
+ printf("\t%s\n", safename(subtest.name).c_str());
}
}
}
@@ -1558,27 +1485,26 @@ void testRemote(struct node *node, unsigned me, unsigned la, unsigned test_tags,
continue;
printf("\t%s:\n", test.name);
- for (unsigned j = 0; j < test.num_subtests; j++) {
- const char *name = test.subtests[j].name;
+ for (const auto &subtest : test.subtests) {
+ const char *name = subtest.name;
- if (test.subtests[j].for_cec20 &&
- (node->remote[la].cec_version < CEC_OP_CEC_VERSION_2_0 ||
- !node->has_cec20))
+ if (subtest.for_cec20 &&
+ (node->remote[la].cec_version < CEC_OP_CEC_VERSION_2_0 || !node->has_cec20))
continue;
- if (test.subtests[j].in_standby) {
+ if (subtest.in_standby) {
struct cec_log_addrs laddrs = { };
doioctl(node, CEC_ADAP_G_LOG_ADDRS, &laddrs);
if (!laddrs.log_addr_mask)
continue;
}
- node->in_standby = test.subtests[j].in_standby;
+ node->in_standby = subtest.in_standby;
mode_set_initiator(node);
unsigned old_warnings = warnings;
- ret = test.subtests[j].test_fn(node, me, la, interactive);
+ ret = subtest.test_fn(node, me, la, interactive);
bool has_warnings = old_warnings < warnings;
- if (!(test.subtests[j].la_mask & (1 << la)) && !ret)
+ if (!(subtest.la_mask & (1 << la)) && !ret)
ret = OK_UNEXPECTED;
if (mapTests[safename(name)] != DONT_CARE) {
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index f6aa7c7d..c17265a5 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -148,7 +148,7 @@ struct node {
bool verbose;
-typedef std::vector<cec_msg> msg_vec;
+using msg_vec = std::vector<cec_msg>;
static struct option long_options[] = {
{ "device", required_argument, nullptr, OptSetDevice },
@@ -561,12 +561,17 @@ static int showTopologyDevice(struct node *node, unsigned i, unsigned la)
cec_msg_give_device_vendor_id(&msg, true);
doioctl(node, CEC_TRANSMIT, &msg);
printf("\t\tVendor ID : ");
- if (!cec_msg_status_is_ok(&msg))
+ if (!cec_msg_status_is_ok(&msg)) {
printf("%s\n", cec_status2s(msg).c_str());
- else
- printf("0x%02x%02x%02x %s\n",
- msg.msg[2], msg.msg[3], msg.msg[4],
- cec_vendor2s(msg.msg[2] << 16 | msg.msg[3] << 8 | msg.msg[4]));
+ } else {
+ __u32 vendor_id = msg.msg[2] << 16 | msg.msg[3] << 8 | msg.msg[4];
+ const char *vendor = cec_vendor2s(vendor_id);
+
+ if (vendor)
+ printf("0x%06x, %s\n", vendor_id, vendor);
+ else
+ printf("0x%06x, %u\n", vendor_id, vendor_id);
+ }
cec_msg_init(&msg, la, i);
cec_msg_give_osd_name(&msg, true);
@@ -1828,7 +1833,7 @@ static __u16 parse_phys_addr_from_edid(const char *edid_path)
static void *thread_edid_poll(void *arg)
{
- struct node *node = static_cast<struct node *>(arg);
+ auto node = static_cast<struct node *>(arg);
__u16 phys_addr;
bool has_edid;
char dummy;
diff --git a/utils/cec-ctl/cec-pin.cpp b/utils/cec-ctl/cec-pin.cpp
index f9ecac7f..30e5accf 100644
--- a/utils/cec-ctl/cec-pin.cpp
+++ b/utils/cec-ctl/cec-pin.cpp
@@ -17,8 +17,6 @@
#include "cec-ctl.h"
#include "cec-log.h"
-#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
-
static std::string find_opcode_name(__u8 opcode)
{
const char *name = cec_opcode2s(opcode);
diff --git a/utils/cec-follower/cec-follower.cpp b/utils/cec-follower/cec-follower.cpp
index bb63f90d..184cf16a 100644
--- a/utils/cec-follower/cec-follower.cpp
+++ b/utils/cec-follower/cec-follower.cpp
@@ -314,6 +314,7 @@ void state_init(struct node &node)
node.state.volume = 50;
node.state.mute = false;
tuner_dev_info_init(&node.state);
+ node.state.last_aud_rate_rx_ts = 0;
}
int main(int argc, char **argv)
diff --git a/utils/cec-follower/cec-follower.h b/utils/cec-follower/cec-follower.h
index 5b67a260..391b9ab4 100644
--- a/utils/cec-follower/cec-follower.h
+++ b/utils/cec-follower/cec-follower.h
@@ -20,9 +20,6 @@
#include <cec-info.h>
#include <cec-log.h>
-#define ARRAY_SIZE(a) \
- (sizeof(a) / sizeof(*a))
-
extern bool show_info;
extern bool show_msgs;
extern bool show_state;
@@ -54,6 +51,7 @@ struct state {
bool tuner_report_changes;
bool deck_report_changes;
unsigned toggle_power_status;
+ __u64 last_aud_rate_rx_ts;
};
struct node {
diff --git a/utils/cec-follower/cec-processing.cpp b/utils/cec-follower/cec-processing.cpp
index 83ffcc30..c76ec54e 100644
--- a/utils/cec-follower/cec-processing.cpp
+++ b/utils/cec-follower/cec-processing.cpp
@@ -29,8 +29,8 @@
/* Time between each polling message sent to a device */
#define POLL_PERIOD 15000
-#define ARRAY_SIZE(a) \
- (sizeof(a) / sizeof(*a))
+/* The maximum interval in nanoseconds between audio rate messages as defined in the spec */
+#define MAX_AUD_RATE_MSG_INTERVAL_NS (2 * 1000000000ULL)
struct cec_enum_values {
const char *type_name;
@@ -233,6 +233,25 @@ static __u8 current_power_state(struct node *node)
return CEC_OP_POWER_STATUS_TO_STANDBY;
}
+static void aud_rate_msg_interval_check(struct node *node, __u64 ts_new)
+{
+ /*
+ * The interval since the last audio rate message is only relevant
+ * if the Source is currently in audio rate controlled mode
+ * (i.e. state.last_aud_rate_rx_ts != 0).
+ */
+ __u64 ts_old = node->state.last_aud_rate_rx_ts;
+
+ if (ts_old) {
+ __u64 interval = ts_new - ts_old;
+
+ if (interval > MAX_AUD_RATE_MSG_INTERVAL_NS) {
+ warn("The interval since the last Audio Rate Control message was > 2s.\n");
+ node->state.last_aud_rate_rx_ts = 0;
+ }
+ }
+}
+
static void processMsg(struct node *node, struct cec_msg &msg, unsigned me)
{
__u8 to = cec_msg_destination(&msg);
@@ -778,18 +797,31 @@ static void processMsg(struct node *node, struct cec_msg &msg, unsigned me)
return;
- /*
- Audio Rate Control
-
- This is only a basic implementation.
-
- TODO: Set Audio Rate shall be sent at least every 2 seconds by
- the controlling device. This should be checked and kept track of.
- */
+ /* Audio Rate Control */
case CEC_MSG_SET_AUDIO_RATE:
- if (node->has_aud_rate)
+ if (!node->has_aud_rate)
+ break;
+
+ switch (msg.msg[2]) {
+ case CEC_OP_AUD_RATE_OFF:
+ aud_rate_msg_interval_check(node, msg.rx_ts);
+ node->state.last_aud_rate_rx_ts = 0;
return;
+ case CEC_OP_AUD_RATE_WIDE_STD:
+ case CEC_OP_AUD_RATE_WIDE_FAST:
+ case CEC_OP_AUD_RATE_WIDE_SLOW:
+ case CEC_OP_AUD_RATE_NARROW_STD:
+ case CEC_OP_AUD_RATE_NARROW_FAST:
+ case CEC_OP_AUD_RATE_NARROW_SLOW:
+ aud_rate_msg_interval_check(node, msg.rx_ts);
+ node->state.last_aud_rate_rx_ts = msg.rx_ts;
+ return;
+ default:
+ cec_msg_reply_feature_abort(&msg, CEC_OP_ABORT_INVALID_OP);
+ transmit(node, &msg);
+ break;
+ }
break;
@@ -1004,6 +1036,9 @@ void testProcessing(struct node *node, bool wallclock)
node->state.rc_state = NOPRESS;
}
}
+
+ if (node->has_aud_rate)
+ aud_rate_msg_interval_check(node, ts_now);
}
mode = CEC_MODE_INITIATOR;
doioctl(node, CEC_S_MODE, &mode);
diff --git a/utils/cec-follower/cec-tuner.cpp b/utils/cec-follower/cec-tuner.cpp
index ac5c4995..b9c21684 100644
--- a/utils/cec-follower/cec-tuner.cpp
+++ b/utils/cec-follower/cec-tuner.cpp
@@ -3,6 +3,7 @@
* Copyright 2016 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
*/
+#include <array>
#include <ctime>
#include <string>
@@ -13,10 +14,8 @@
#define NUM_ANALOG_FREQS 3
#define NUM_DIGITAL_CHANS 3
-#define TOT_ANALOG_FREQS (sizeof(analog_freqs_khz) / sizeof(analog_freqs_khz[0][0][0]))
-#define TOT_DIGITAL_CHANS ((sizeof(digital_arib_data) / sizeof(digital_arib_data[0][0])) + \
- (sizeof(digital_atsc_data) / sizeof(digital_atsc_data[0][0])) + \
- (sizeof(digital_dvb_data) / sizeof(digital_dvb_data[0][0])))
+#define TOT_ANALOG_FREQS analog_freqs_khz[0][0].size()
+#define TOT_DIGITAL_CHANS digital_arib_data[0].size() + digital_atsc_data[0].size() + digital_dvb_data[0].size()
struct service_info {
unsigned tsid;
@@ -45,22 +44,22 @@ struct service_info {
*
* https://sichbopvr.com/frequency-tables/Brazil/Rio%20de%20Janeiro/Rio%20De%20Janeiro
*/
-static const struct service_info digital_arib_data[2][NUM_DIGITAL_CHANS] =
-{
+using arib = std::array<service_info, NUM_DIGITAL_CHANS>;
+static constexpr std::array<arib, 2> digital_arib_data{
// satellite, arib-bs
- {
+ arib{
// tsid, onid, sid, fmt, major, minor
- { 1032, 1, 30203, 1, 0, 30203 },
- { 1046, 1, 30505, 1, 0, 30505 },
- { 1060, 1, 30609, 1, 0, 30609 }
+ service_info{ 1032, 1, 30203, 1, 0, 30203 },
+ service_info{ 1046, 1, 30505, 1, 0, 30505 },
+ service_info{ 1060, 1, 30609, 1, 0, 30609 },
},
// terrestrial, arib-t
- {
+ arib{
// tsid, onid, sid, fmt, major, minor
- { 1519, 1519, 48608, 1, 0, 48608 },
- { 1624, 1624, 51992, 1, 0, 51992 },
- { 1905, 1905, 60960, 1, 0, 60960 }
- }
+ service_info{ 1519, 1519, 48608, 1, 0, 48608 },
+ service_info{ 1624, 1624, 51992, 1, 0, 51992 },
+ service_info{ 1905, 1905, 60960, 1, 0, 60960 },
+ },
};
/*
@@ -84,22 +83,22 @@ static const struct service_info digital_arib_data[2][NUM_DIGITAL_CHANS] =
* ATSC does not use ONIDs and SID will be used as the program number. All ATSC
* channel number formats are 2 part.
*/
-static const struct service_info digital_atsc_data[2][NUM_DIGITAL_CHANS] =
-{
+using atsc = std::array<service_info, NUM_DIGITAL_CHANS>;
+static constexpr std::array<atsc, 2> digital_atsc_data{
// satellite, atsc-sat
- {
+ atsc{
// tsid, onid, sid, fmt, major, minor
- { 2065, 0, 50316, 2, 3, 50316 },
- { 2090, 0, 50882, 2, 3, 50882 },
- { 2122, 0, 55295, 2, 3, 55295 }
+ service_info{ 2065, 0, 50316, 2, 3, 50316 },
+ service_info{ 2090, 0, 50882, 2, 3, 50882 },
+ service_info{ 2122, 0, 55295, 2, 3, 55295 },
},
// terrestrial, atsc-t
- {
+ atsc{
// tsid, onid, sid, fmt, major, minor
- { 1675, 0, 1, 2, 4, 1 },
- { 1675, 0, 2, 2, 4, 2 },
- { 1675, 0, 3, 2, 4, 3 }
- }
+ service_info{ 1675, 0, 1, 2, 4, 1 },
+ service_info{ 1675, 0, 2, 2, 4, 2 },
+ service_info{ 1675, 0, 3, 2, 4, 3 },
+ },
};
/*
@@ -119,22 +118,22 @@ static const struct service_info digital_atsc_data[2][NUM_DIGITAL_CHANS] =
* https://sichbopvr.com/frequency-tables/Sweden/Skane%20Lan/Malm%c3%b6
*
*/
-static const struct service_info digital_dvb_data[2][NUM_DIGITAL_CHANS] =
-{
+using dvb = std::array<service_info, NUM_DIGITAL_CHANS>;
+static constexpr std::array<dvb, 2> digital_dvb_data{
// satellite, dvb-s2
- {
+ dvb{
// tsid, onid, sid, fmt, major, minor
- { 61, 70, 7193, 1, 0, 24 },
- { 65, 70, 7040, 1, 0, 72 },
- { 28, 70, 7012, 1, 0, 101 }
+ service_info{ 61, 70, 7193, 1, 0, 24 },
+ service_info{ 65, 70, 7040, 1, 0, 72 },
+ service_info{ 28, 70, 7012, 1, 0, 101 },
},
// terrestrial, dvb-t
- {
+ dvb{
// tsid, onid, sid, fmt, major, minor
- { 1002, 8400, 2025, 1, 0, 21 },
- { 1004, 8400, 84, 1, 0, 31 },
- { 1004, 8945, 1040, 1, 0, 1040 }
- }
+ service_info{ 1002, 8400, 2025, 1, 0, 21 },
+ service_info{ 1004, 8400, 84, 1, 0, 31 },
+ service_info{ 1004, 8945, 1040, 1, 0, 1040 },
+ },
};
/*
@@ -150,71 +149,72 @@ static const struct service_info digital_dvb_data[2][NUM_DIGITAL_CHANS] =
*
* https://en.wikipedia.org/wiki/Television_channel_frequencies
*/
-static unsigned int analog_freqs_khz[3][9][NUM_ANALOG_FREQS] =
-{
+using khz = std::array<unsigned int, NUM_ANALOG_FREQS>;
+using freqs = std::array<khz, 9>;
+static constexpr std::array<freqs, 3> analog_freqs_khz{
// cable
- {
+ freqs{
// pal-bg
- { 471250, 479250, 487250 },
+ khz{ 471250, 479250, 487250 },
// secam-lq
- { 615250, 623250, 631250 },
+ khz{ 615250, 623250, 631250 },
// pal-m
- { 501250, 507250, 513250 },
+ khz{ 501250, 507250, 513250 },
// ntsc-m
- { 519250, 525250, 531250 },
+ khz{ 519250, 525250, 531250 },
// pal-i
- { 45750, 53750, 61750 },
+ khz{ 45750, 53750, 61750 },
// secam-dk
- { 759250, 767250, 775250 },
+ khz{ 759250, 767250, 775250 },
// secam-bg
- { 495250, 503250, 511250 },
+ khz{ 495250, 503250, 511250 },
// secam-l
- { 639250, 647250, 655250 },
+ khz{ 639250, 647250, 655250 },
// pal-dk
- { 783250, 791250, 799250 }
+ khz{ 783250, 791250, 799250 },
},
// satellite
- {
+ freqs{
// pal-bg
- { 519250, 527250, 535250 },
+ khz{ 519250, 527250, 535250 },
// secam-lq
- { 663250, 671250, 679250 },
+ khz{ 663250, 671250, 679250 },
// pal-m
- { 537250, 543250, 549250 },
+ khz{ 537250, 543250, 549250 },
// ntsc-m
- { 555250, 561250, 567250 },
+ khz{ 555250, 561250, 567250 },
// pal-i
- { 175250, 183250, 191250 },
+ khz{ 175250, 183250, 191250 },
// secam-dk
- { 807250, 815250, 823250 },
+ khz{ 807250, 815250, 823250 },
// secam-bg
- { 543250, 551250, 559250 },
+ khz{ 543250, 551250, 559250 },
// secam-l
- { 687250, 695250, 703250 },
+ khz{ 687250, 695250, 703250 },
// pal-dk
- { 831250, 839250, 847250 }
+ khz{ 831250, 839250, 847250 },
},
// terrestrial
- {
+ freqs{
// pal-bg
- { 567250, 575250, 583250 },
+ khz{ 567250, 575250, 583250 },
// secam-lq
- { 711250, 719250, 727250 },
+ khz{ 711250, 719250, 727250 },
// pal-m
- { 573250, 579250, 585250 },
+ khz{ 573250, 579250, 585250 },
// ntsc-m
- { 591250, 597250, 603250 },
+ khz{ 591250, 597250, 603250 },
// pal-i
- { 199250, 207250, 215250 },
+ khz{ 199250, 207250, 215250 },
// secam-dk
- { 145250, 153250, 161250 },
+ khz{ 145250, 153250, 161250 },
// secam-bg
- { 591250, 599250, 607250 },
+ khz{ 591250, 599250, 607250 },
// secam-l
- { 735250, 743250, 751250 },
+ khz{ 735250, 743250, 751250 },
// pal-dk
- { 169250, 177250, 185250 }
- }
+ khz{ 169250, 177250, 185250 },
+ },
};
void tuner_dev_info_init(struct state *state)
diff --git a/utils/common/media-info.cpp b/utils/common/media-info.cpp
index 29a43fb3..3a5477e8 100644
--- a/utils/common/media-info.cpp
+++ b/utils/common/media-info.cpp
@@ -17,6 +17,10 @@
#include <linux/media.h>
#include <media-info.h>
+#ifndef __linux__
+#include <linux/videodev2.h>
+#include <fcntl.h>
+#endif
static std::string num2s(unsigned num, bool is_hex = true)
{
@@ -54,7 +58,7 @@ media_type mi_media_detect_type(const char *device)
if (stat(device, &sb) == -1)
return MEDIA_TYPE_CANT_STAT;
-
+#ifdef __linux__
std::string uevent_path("/sys/dev/char/");
uevent_path += num2s(major(sb.st_rdev), false) + ":" +
@@ -90,6 +94,23 @@ media_type mi_media_detect_type(const char *device)
}
uevent_file.close();
+#else // Not Linux
+ int fd = open(device, O_RDONLY);
+ if (fd >= 0) {
+ struct v4l2_capability caps;
+ int error = ioctl(fd, VIDIOC_QUERYCAP, &caps);
+ close(fd);
+ if (error == 0) {
+ if (caps.device_caps & V4L2_CAP_VIDEO_CAPTURE) {
+ return MEDIA_TYPE_VIDEO;
+ } else if (caps.device_caps & V4L2_CAP_VBI_CAPTURE) {
+ return MEDIA_TYPE_VBI;
+ } else if (caps.device_caps & V4L2_CAP_RADIO) {
+ return MEDIA_TYPE_RADIO;
+ }
+ }
+ }
+#endif
return MEDIA_TYPE_UNKNOWN;
}
@@ -118,10 +139,10 @@ std::string mi_media_get_device(__u32 major, __u32 minor)
return "";
}
-typedef struct {
+struct flag_def {
unsigned flag;
const char *str;
-} flag_def;
+};
static std::string flags2s(unsigned val, const flag_def *def)
{
diff --git a/utils/common/v4l2-info.cpp b/utils/common/v4l2-info.cpp
index fe4defd9..cb3cb91f 100644
--- a/utils/common/v4l2-info.cpp
+++ b/utils/common/v4l2-info.cpp
@@ -16,10 +16,10 @@ static std::string num2s(unsigned num, bool is_hex = true)
return buf;
}
-typedef struct {
+struct flag_def {
unsigned flag;
const char *str;
-} flag_def;
+};
static std::string flags2s(unsigned val, const flag_def *def)
{
diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c
index bae16050..3c3bcca1 100644
--- a/utils/ir-ctl/ir-ctl.c
+++ b/utils/ir-ctl/ir-ctl.c
@@ -314,7 +314,7 @@ static struct send *read_file_pulse_space(struct arguments *args, const char *fn
continue;
}
- if (strcmp(keyword, "space") == 0) {
+ if (!strcmp(keyword, "space") || !strcmp(keyword, "timeout")) {
if (arg == 0) {
fprintf(stderr, _("warning: %s:%d: invalid argument to space '%d'\n"), fname, lineno, arg);
continue;
@@ -331,7 +331,7 @@ static struct send *read_file_pulse_space(struct arguments *args, const char *fn
}
lastspace = lineno;
expect_pulse = true;
- } else if (strcmp(keyword, "pulse") == 0) {
+ } else if (!strcmp(keyword, "pulse")) {
if (arg == 0) {
fprintf(stderr, _("warning: %s:%d: invalid argument to pulse '%d'\n"), fname, lineno, arg);
continue;
@@ -341,7 +341,7 @@ static struct send *read_file_pulse_space(struct arguments *args, const char *fn
else
f->buf[len++] = arg;
expect_pulse = false;
- } else if (strcmp(keyword, "carrier") == 0) {
+ } else if (!strcmp(keyword, "carrier")) {
if (f->carrier != UNSET && f->carrier != arg) {
fprintf(stderr, _("warning: %s:%d: carrier already specified\n"), fname, lineno);
} else {
@@ -1200,10 +1200,9 @@ int lirc_receive(struct arguments *args, int fd, unsigned features)
} else {
switch (msg) {
case LIRC_MODE2_TIMEOUT:
+ fprintf(out, "-%u\n", val);
if (carrier)
- fprintf(out, "# carrier %uHz, timeout %u\n", carrier, val);
- else
- fprintf(out, "# timeout %u\n", val);
+ fprintf(out, " # carrier %uHz, timeout %u\n", carrier, val);
leading_space = true;
carrier = 0;
break;
diff --git a/utils/libcecutil/cec-gen.pl b/utils/libcecutil/cec-gen.pl
index 716ceb26..224d0ba2 100755
--- a/utils/libcecutil/cec-gen.pl
+++ b/utils/libcecutil/cec-gen.pl
@@ -147,6 +147,8 @@ sub process_func
$logswitch .= "\t\tlog_digital(\"$dash_name\", &$name);\n";
} elsif ($name eq "ui_cmd") {
$logswitch .= "\t\tlog_ui_command(\"$dash_name\", &$name);\n";
+ } elsif ($name eq "vendor_id") {
+ $logswitch .= "\t\tlog_vendor_id(\"$dash_name\", $name);\n";
} elsif ($name eq "rec_src") {
$logswitch .= "\t\tlog_rec_src(\"$dash_name\", &$name);\n";
} elsif ($name eq "tuner_dev_info") {
diff --git a/utils/libcecutil/cec-info.cpp b/utils/libcecutil/cec-info.cpp
index 37467b5c..0172e853 100644
--- a/utils/libcecutil/cec-info.cpp
+++ b/utils/libcecutil/cec-info.cpp
@@ -108,65 +108,67 @@ const char *cec_vendor2s(unsigned vendor)
switch (vendor) {
case 0x000039:
case 0x000ce7:
- return "(Toshiba)";
+ return "Toshiba";
case 0x0000f0:
- return "(Samsung)";
+ return "Samsung";
case 0x0005cd:
- return "(Denon)";
+ return "Denon";
case 0x000678:
- return "(Marantz)";
+ return "Marantz";
case 0x000982:
- return "(Loewe)";
+ return "Loewe";
case 0x0009b0:
- return "(Onkyo)";
+ return "Onkyo";
case 0x000c03:
- return "(HDMI)";
+ return "HDMI";
case 0x001582:
- return "(Pulse-Eight)";
+ return "Pulse-Eight";
case 0x001950:
case 0x9c645e:
- return "(Harman Kardon)";
+ return "Harman Kardon";
case 0x001a11:
- return "(Google)";
+ return "Google";
case 0x0020c7:
- return "(Akai)";
+ return "Akai";
case 0x002467:
- return "(AOC)";
+ return "AOC";
case 0x005060:
- return "(Cisco)";
+ return "Cisco";
case 0x008045:
- return "(Panasonic)";
+ return "Panasonic";
case 0x00903e:
- return "(Philips)";
+ return "Philips";
case 0x009053:
- return "(Daewoo)";
+ return "Daewoo";
case 0x00a0de:
- return "(Yamaha)";
+ return "Yamaha";
case 0x00d0d5:
- return "(Grundig)";
+ return "Grundig";
case 0x00d38d:
- return "(Hospitality Profile)";
+ return "Hospitality Profile";
case 0x00e036:
- return "(Pioneer)";
+ return "Pioneer";
case 0x00e091:
- return "(LG)";
+ return "LG";
case 0x08001f:
case 0x534850:
- return "(Sharp)";
+ return "Sharp";
case 0x080046:
- return "(Sony)";
+ return "Sony";
+ case 0x0acd8f:
+ return "CDDC";
case 0x18c086:
- return "(Broadcom)";
+ return "Broadcom";
case 0x5cad76:
- return "(TCL)";
+ return "TCL";
case 0x6b746d:
- return "(Vizio)";
+ return "Vizio";
case 0x743a65:
- return "(NEC)";
+ return "NEC";
case 0x8065e9:
- return "(Benq)";
+ return "Benq";
default:
- return "";
+ return nullptr;
}
}
@@ -423,9 +425,16 @@ void cec_driver_info(const struct cec_caps &caps,
cec_phys_addr_exp(phys_addr));
printf("\tLogical Address Mask : 0x%04x\n", laddrs.log_addr_mask);
printf("\tCEC Version : %s\n", cec_version2s(laddrs.cec_version));
- if (laddrs.vendor_id != CEC_VENDOR_ID_NONE)
- printf("\tVendor ID : 0x%06x %s\n",
- laddrs.vendor_id, cec_vendor2s(laddrs.vendor_id));
+ if (laddrs.vendor_id != CEC_VENDOR_ID_NONE) {
+ const char *vendor = cec_vendor2s(laddrs.vendor_id);
+
+ if (vendor)
+ printf("\tVendor ID : 0x%06x, %s\n",
+ laddrs.vendor_id, vendor);
+ else
+ printf("\tVendor ID : 0x%06x, %u\n",
+ laddrs.vendor_id, laddrs.vendor_id);
+ }
printf("\tOSD Name : '%s'\n", laddrs.osd_name);
printf("\tLogical Addresses : %u %s\n",
laddrs.num_log_addrs, laflags2s(laddrs.flags).c_str());
diff --git a/utils/libcecutil/cec-log.cpp b/utils/libcecutil/cec-log.cpp
index 323e3d61..e2178473 100644
--- a/utils/libcecutil/cec-log.cpp
+++ b/utils/libcecutil/cec-log.cpp
@@ -104,6 +104,7 @@ static void log_rec_src(const char *arg_name, const struct cec_op_record_src *re
static void log_tuner_dev_info(const char *arg_name, const struct cec_op_tuner_device_info *tuner_dev_info);
static void log_features(const struct cec_arg *arg, const char *arg_name, const __u8 *p);
static void log_ui_command(const char *arg_name, const struct cec_op_ui_command *ui_cmd);
+static void log_vendor_id(const char *arg_name, __u32 vendor_id);
static void log_descriptors(const char *arg_name, unsigned num, const __u32 *descriptors);
static void log_u8_array(const char *arg_name, unsigned num, const __u8 *vals);
static void log_unknown_msg(const struct cec_msg *msg);
@@ -226,6 +227,16 @@ static void log_ui_command(const char *arg_name,
}
}
+static void log_vendor_id(const char *arg_name, __u32 vendor_id)
+{
+ const char *vendor = cec_vendor2s(vendor_id);
+
+ if (vendor)
+ printf("\t%s: 0x%08x, %s\n", arg_name, vendor_id, vendor);
+ else
+ printf("\t%s: 0x%08x, %u\n", arg_name, vendor_id, vendor_id);
+}
+
static void log_descriptors(const char *arg_name, unsigned num, const __u32 *descriptors)
{
for (unsigned i = 0; i < num; i++)
@@ -248,7 +259,7 @@ static void log_htng_unknown_msg(const struct cec_msg *msg)
cec_ops_vendor_command_with_id(msg, &vendor_id, &size, &bytes);
printf("VENDOR_COMMAND_WITH_ID (0x%02x):\n",
CEC_MSG_VENDOR_COMMAND_WITH_ID);
- log_arg(&arg_vendor_id, "vendor-id", vendor_id);
+ log_vendor_id("vendor-id", vendor_id);
printf("\tvendor-specific-data:");
for (i = 0; i < size; i++)
printf(" 0x%02x", bytes[i]);
@@ -282,7 +293,7 @@ static void log_unknown_msg(const struct cec_msg *msg)
default:
printf("VENDOR_COMMAND_WITH_ID (0x%02x):\n",
CEC_MSG_VENDOR_COMMAND_WITH_ID);
- log_arg(&arg_vendor_id, "vendor-id", vendor_id);
+ log_vendor_id("vendor-id", vendor_id);
printf("\tvendor-specific-data:");
for (i = 0; i < size; i++)
printf(" 0x%02x", bytes[i]);
diff --git a/utils/qv4l2/qv4l2.h b/utils/qv4l2/qv4l2.h
index a585ac35..aaba74d0 100644
--- a/utils/qv4l2/qv4l2.h
+++ b/utils/qv4l2/qv4l2.h
@@ -51,10 +51,10 @@ class VbiTab;
class QCloseEvent;
class CaptureWin;
-typedef std::vector<unsigned> ClassIDVec;
-typedef std::map<unsigned, ClassIDVec> ClassMap;
-typedef std::map<unsigned, struct v4l2_query_ext_ctrl> CtrlMap;
-typedef std::map<unsigned, QWidget *> WidgetMap;
+using ClassIDVec = std::vector<unsigned>;
+using ClassMap = std::map<unsigned, ClassIDVec>;
+using CtrlMap = std::map<unsigned, v4l2_query_ext_ctrl>;
+using WidgetMap = std::map<unsigned, QWidget *>;
enum {
CTRL_UPDATE_ON_CHANGE = 0x10,
diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp
index 994fc9c4..8161aa45 100644
--- a/utils/rds-ctl/rds-ctl.cpp
+++ b/utils/rds-ctl/rds-ctl.cpp
@@ -27,9 +27,7 @@
#include <linux/videodev2.h>
#include <libv4l2rds.h>
-#define ARRAY_SIZE(arr) ((int)(sizeof(arr) / sizeof((arr)[0])))
-
-typedef std::vector<std::string> dev_vec;
+using dev_vec = std::vector<std::string>;
using dev_map = std::map<std::string, std::string>;
/* Short option list
diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp
index 9f71332c..90a50361 100644
--- a/utils/v4l2-compliance/v4l2-compliance.cpp
+++ b/utils/v4l2-compliance/v4l2-compliance.cpp
@@ -1460,7 +1460,7 @@ void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_
node.controls.find(VIVID_CID_DISCONNECT) != node.controls.end()) {
if (node.node2)
node.node2->close();
- node.node2 = NULL;
+ node.node2 = nullptr;
printf("\ttest Disconnect: %s\n\n", ok(testVividDisconnect(&node)));
}
diff --git a/utils/v4l2-compliance/v4l2-compliance.h b/utils/v4l2-compliance/v4l2-compliance.h
index 4d5c3a5c..c2835d95 100644
--- a/utils/v4l2-compliance/v4l2-compliance.h
+++ b/utils/v4l2-compliance/v4l2-compliance.h
@@ -70,18 +70,24 @@ enum poll_mode {
#define IS_ENCODER(node) ((node)->codec_mask & (JPEG_ENCODER | STATEFUL_ENCODER | STATELESS_ENCODER))
#define IS_DECODER(node) ((node)->codec_mask & (JPEG_DECODER | STATEFUL_DECODER | STATELESS_DECODER))
-#define V4L2_CTRL_CLASS_VIVID 0x00f00000
+#define V4L2_CTRL_CLASS_VIVID 0x00f00000
#define VIVID_CID_VIVID_BASE (V4L2_CTRL_CLASS_VIVID | 0xf000)
-#define VIVID_CID_DISCONNECT (VIVID_CID_VIVID_BASE + 65)
+#define VIVID_CID_DISCONNECT (VIVID_CID_VIVID_BASE + 65)
+#define VIVID_CID_DQBUF_ERROR (VIVID_CID_VIVID_BASE + 66)
+#define VIVID_CID_QUEUE_SETUP_ERROR (VIVID_CID_VIVID_BASE + 67)
+#define VIVID_CID_BUF_PREPARE_ERROR (VIVID_CID_VIVID_BASE + 68)
+#define VIVID_CID_START_STR_ERROR (VIVID_CID_VIVID_BASE + 69)
+#define VIVID_CID_QUEUE_ERROR (VIVID_CID_VIVID_BASE + 70)
+#define VIVID_CID_REQ_VALIDATE_ERROR (VIVID_CID_VIVID_BASE + 72)
struct test_query_ext_ctrl: v4l2_query_ext_ctrl {
__u64 menu_mask;
};
-typedef std::map<__u32, struct test_query_ext_ctrl> qctrl_map;
-typedef std::map<__u32, __u32> pixfmt_map;
-typedef std::set<__u64> frmsizes_set;
-typedef std::map<__u32, unsigned> frmsizes_count_map;
+using qctrl_map = std::map<__u32, test_query_ext_ctrl>;
+using pixfmt_map = std::map<__u32, __u32>;
+using frmsizes_set = std::set<__u64>;
+using frmsizes_count_map = std::map<__u32, unsigned>;
struct base_node;
diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp
index 131fedc6..045f8d54 100644
--- a/utils/v4l2-compliance/v4l2-test-buffers.cpp
+++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp
@@ -32,16 +32,6 @@
#include "v4l2-compliance.h"
-#define V4L2_CTRL_CLASS_VIVID 0x00f00000
-#define VIVID_CID_VIVID_BASE (V4L2_CTRL_CLASS_VIVID | 0xf000)
-#define VIVID_CID_DISCONNECT (VIVID_CID_VIVID_BASE + 65)
-#define VIVID_CID_DQBUF_ERROR (VIVID_CID_VIVID_BASE + 66)
-#define VIVID_CID_QUEUE_SETUP_ERROR (VIVID_CID_VIVID_BASE + 67)
-#define VIVID_CID_BUF_PREPARE_ERROR (VIVID_CID_VIVID_BASE + 68)
-#define VIVID_CID_START_STR_ERROR (VIVID_CID_VIVID_BASE + 69)
-#define VIVID_CID_QUEUE_ERROR (VIVID_CID_VIVID_BASE + 70)
-#define VIVID_CID_REQ_VALIDATE_ERROR (VIVID_CID_VIVID_BASE + 72)
-
static cv4l_fmt cur_fmt;
static cv4l_fmt cur_m2m_fmt;
static int stream_from_fd = -1;
@@ -93,7 +83,7 @@ enum QueryBufMode {
Dequeued
};
-typedef std::map<struct timeval, struct v4l2_buffer> buf_info_map;
+using buf_info_map = std::map<struct timeval, struct v4l2_buffer>;
static buf_info_map buffer_info;
#define FILE_HDR_ID v4l2_fourcc('V', 'h', 'd', 'r')
diff --git a/utils/v4l2-compliance/v4l2-test-media.cpp b/utils/v4l2-compliance/v4l2-test-media.cpp
index d7a83b0c..ef2982c0 100644
--- a/utils/v4l2-compliance/v4l2-test-media.cpp
+++ b/utils/v4l2-compliance/v4l2-test-media.cpp
@@ -73,7 +73,7 @@ static int checkDevice(__u32 major, __u32 minor, bool iface, __u32 id)
return 0;
}
-typedef std::set<__u32> id_set;
+using id_set = std::set<__u32>;
static media_v2_topology topology;
static media_v2_entity *v2_ents;
diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp
index 15b68b5e..17ad488d 100644
--- a/utils/v4l2-ctl/v4l2-ctl-common.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp
@@ -22,7 +22,7 @@ struct ctrl_subset {
unsigned size[V4L2_CTRL_MAX_DIMS];
};
-typedef std::map<unsigned, std::vector<struct v4l2_ext_control> > class2ctrls_map;
+using class2ctrls_map = std::map<unsigned int, std::vector<struct v4l2_ext_control> >;
using ctrl_qmap = std::map<std::string, struct v4l2_query_ext_ctrl>;
static ctrl_qmap ctrl_str2q;
diff --git a/utils/v4l2-ctl/v4l2-ctl-overlay.cpp b/utils/v4l2-ctl/v4l2-ctl-overlay.cpp
index 09de70c8..639a4175 100644
--- a/utils/v4l2-ctl/v4l2-ctl-overlay.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-overlay.cpp
@@ -1,3 +1,4 @@
+#include <array>
#include <vector>
#include <linux/fb.h>
@@ -121,16 +122,15 @@ struct bitfield2fmt {
__u32 pixfmt;
};
-static const struct bitfield2fmt fb_formats[] = {
- { 10, 5, 5, 5, 0, 5, 15, 1, V4L2_PIX_FMT_ARGB555 },
- { 11, 5, 5, 6, 0, 5, 0, 0, V4L2_PIX_FMT_RGB565 },
- { 1, 5, 6, 5, 11, 5, 0, 1, V4L2_PIX_FMT_RGB555X },
- { 0, 5, 5, 6, 11, 5, 0, 0, V4L2_PIX_FMT_RGB565X },
- { 16, 8, 8, 8, 0, 8, 0, 0, V4L2_PIX_FMT_BGR24 },
- { 0, 8, 8, 8, 16, 8, 0, 0, V4L2_PIX_FMT_RGB24 },
- { 16, 8, 8, 8, 0, 8, 24, 8, V4L2_PIX_FMT_ABGR32 },
- { 8, 8, 16, 8, 24, 8, 0, 8, V4L2_PIX_FMT_ARGB32 },
- { }
+static constexpr std::array<bitfield2fmt, 8> fb_formats{
+ bitfield2fmt{ 10, 5, 5, 5, 0, 5, 15, 1, V4L2_PIX_FMT_ARGB555 },
+ bitfield2fmt{ 11, 5, 5, 6, 0, 5, 0, 0, V4L2_PIX_FMT_RGB565 },
+ bitfield2fmt{ 1, 5, 6, 5, 11, 5, 0, 1, V4L2_PIX_FMT_RGB555X },
+ bitfield2fmt{ 0, 5, 5, 6, 11, 5, 0, 0, V4L2_PIX_FMT_RGB565X },
+ bitfield2fmt{ 16, 8, 8, 8, 0, 8, 0, 0, V4L2_PIX_FMT_BGR24 },
+ bitfield2fmt{ 0, 8, 8, 8, 16, 8, 0, 0, V4L2_PIX_FMT_RGB24 },
+ bitfield2fmt{ 16, 8, 8, 8, 0, 8, 24, 8, V4L2_PIX_FMT_ABGR32 },
+ bitfield2fmt{ 8, 8, 16, 8, 24, 8, 0, 8, V4L2_PIX_FMT_ARGB32 },
};
static bool match_bitfield(const struct fb_bitfield &bf, unsigned off, unsigned len)
@@ -182,9 +182,7 @@ static int fbuf_fill_from_fb(struct v4l2_framebuffer &fb, const char *fb_device)
if (vi.bits_per_pixel == 8)
fb.fmt.pixelformat = V4L2_PIX_FMT_GREY;
} else {
- for (int i = 0; fb_formats[i].pixfmt; i++) {
- const struct bitfield2fmt &p = fb_formats[i];
-
+ for (const auto &p : fb_formats) {
if (match_bitfield(vi.blue, p.blue_off, p.blue_len) &&
match_bitfield(vi.green, p.green_off, p.green_len) &&
match_bitfield(vi.red, p.red_off, p.red_len) &&
diff --git a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
index d0f391bb..ecfd3244 100644
--- a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
@@ -5,7 +5,7 @@ struct mbus_name {
__u32 code;
};
-static struct mbus_name mbus_names[] = {
+static const struct mbus_name mbus_names[] = {
{ "Fixed", MEDIA_BUS_FMT_FIXED },
#include "media-bus-format-names.h"
{ nullptr, 0 }
@@ -568,9 +568,8 @@ static void print_mbus_code(__u32 code)
static void print_mbus_codes(int fd, __u32 pad)
{
- struct v4l2_subdev_mbus_code_enum mbus_code;
+ struct v4l2_subdev_mbus_code_enum mbus_code = {};
- memset(&mbus_code, 0, sizeof(mbus_code));
mbus_code.pad = pad;
mbus_code.which = V4L2_SUBDEV_FORMAT_TRY;
diff --git a/utils/v4l2-ctl/v4l2-ctl.h b/utils/v4l2-ctl/v4l2-ctl.h
index f9bad45c..24eee3d7 100644
--- a/utils/v4l2-ctl/v4l2-ctl.h
+++ b/utils/v4l2-ctl/v4l2-ctl.h
@@ -277,11 +277,6 @@ extern __u32 vidcap_buftype;
extern __u32 vidout_buftype;
extern int verbose;
-typedef struct {
- unsigned flag;
- const char *str;
-} flag_def;
-
/* fmts specified */
#define FmtWidth (1L<<0)
#define FmtHeight (1L<<1)
diff --git a/utils/v4l2-dbg/v4l2-dbg-ac97.h b/utils/v4l2-dbg/v4l2-dbg-ac97.h
index a37c8784..263f3455 100644
--- a/utils/v4l2-dbg/v4l2-dbg-ac97.h
+++ b/utils/v4l2-dbg/v4l2-dbg-ac97.h
@@ -22,46 +22,46 @@
#define AC97_PREFIX "AC97_"
#define EM202_PREFIX "EM202_"
-static struct board_regs ac97_regs[] = {
+static const std::vector<board_regs> ac97_regs{
/* general ac97 registers */
- {0x00, AC97_PREFIX "RESET", 2},
- {0x02, AC97_PREFIX "MASTER_VOL", 2},
- {0x04, AC97_PREFIX "LINE_LEVEL_VOL", 2},
- {0x06, AC97_PREFIX "MASTER_MONO_VOL", 2},
- {0x0a, AC97_PREFIX "PC_BEEP_VOL", 2},
- {0x0c, AC97_PREFIX "PHONE_VOL", 2},
- {0x0e, AC97_PREFIX "MIC_VOL", 2},
- {0x10, AC97_PREFIX "LINEIN_VOL", 2},
- {0x12, AC97_PREFIX "CD_VOL", 2},
- {0x14, AC97_PREFIX "VIDEO_VOL", 2},
- {0x16, AC97_PREFIX "AUX_VOL", 2},
- {0x18, AC97_PREFIX "PCM_OUT_VOL", 2},
- {0x1a, AC97_PREFIX "RECORD_SELECT", 2},
- {0x1c, AC97_PREFIX "RECORD_GAIN", 2},
- {0x20, AC97_PREFIX "GENERAL_PURPOSE", 2},
- {0x22, AC97_PREFIX "3D_CTRL", 2},
- {0x24, AC97_PREFIX "AUD_INT_AND_PAG", 2},
- {0x26, AC97_PREFIX "POWER_DOWN_CTRL", 2},
- {0x28, AC97_PREFIX "EXT_AUD_ID", 2},
- {0x2a, AC97_PREFIX "EXT_AUD_CTRL", 2},
- {0x2c, AC97_PREFIX "PCM_OUT_FRONT_SRATE", 2},
- {0x2e, AC97_PREFIX "PCM_OUT_SURR_SRATE", 2},
- {0x30, AC97_PREFIX "PCM_OUT_LFE_SRATE", 2},
- {0x32, AC97_PREFIX "PCM_IN_SRATE", 2},
- {0x36, AC97_PREFIX "LFE_MASTER_VOL", 2},
- {0x38, AC97_PREFIX "SURR_MASTER_VOL", 2},
- {0x3a, AC97_PREFIX "SPDIF_OUT_CTRL", 2},
- {0x7c, AC97_PREFIX "VENDOR_ID1", 2},
- {0x7e, AC97_PREFIX "VENDOR_ID2", 2},
+ { 0x00, AC97_PREFIX "RESET", 2 },
+ { 0x02, AC97_PREFIX "MASTER_VOL", 2 },
+ { 0x04, AC97_PREFIX "LINE_LEVEL_VOL", 2 },
+ { 0x06, AC97_PREFIX "MASTER_MONO_VOL", 2 },
+ { 0x0a, AC97_PREFIX "PC_BEEP_VOL", 2 },
+ { 0x0c, AC97_PREFIX "PHONE_VOL", 2 },
+ { 0x0e, AC97_PREFIX "MIC_VOL", 2 },
+ { 0x10, AC97_PREFIX "LINEIN_VOL", 2 },
+ { 0x12, AC97_PREFIX "CD_VOL", 2 },
+ { 0x14, AC97_PREFIX "VIDEO_VOL", 2 },
+ { 0x16, AC97_PREFIX "AUX_VOL", 2 },
+ { 0x18, AC97_PREFIX "PCM_OUT_VOL", 2 },
+ { 0x1a, AC97_PREFIX "RECORD_SELECT", 2 },
+ { 0x1c, AC97_PREFIX "RECORD_GAIN", 2 },
+ { 0x20, AC97_PREFIX "GENERAL_PURPOSE", 2 },
+ { 0x22, AC97_PREFIX "3D_CTRL", 2 },
+ { 0x24, AC97_PREFIX "AUD_INT_AND_PAG", 2 },
+ { 0x26, AC97_PREFIX "POWER_DOWN_CTRL", 2 },
+ { 0x28, AC97_PREFIX "EXT_AUD_ID", 2 },
+ { 0x2a, AC97_PREFIX "EXT_AUD_CTRL", 2 },
+ { 0x2c, AC97_PREFIX "PCM_OUT_FRONT_SRATE", 2 },
+ { 0x2e, AC97_PREFIX "PCM_OUT_SURR_SRATE", 2 },
+ { 0x30, AC97_PREFIX "PCM_OUT_LFE_SRATE", 2 },
+ { 0x32, AC97_PREFIX "PCM_IN_SRATE", 2 },
+ { 0x36, AC97_PREFIX "LFE_MASTER_VOL", 2 },
+ { 0x38, AC97_PREFIX "SURR_MASTER_VOL", 2 },
+ { 0x3a, AC97_PREFIX "SPDIF_OUT_CTRL", 2 },
+ { 0x7c, AC97_PREFIX "VENDOR_ID1", 2 },
+ { 0x7e, AC97_PREFIX "VENDOR_ID2", 2 },
/* em202 vendor specific registers */
- {0x3e, EM202_PREFIX "EXT_MODEM_CTRL", 2},
- {0x4c, EM202_PREFIX "GPIO_CONF", 2},
- {0x4e, EM202_PREFIX "GPIO_POLARITY", 2},
- {0x50, EM202_PREFIX "GPIO_STICKY", 2},
- {0x52, EM202_PREFIX "GPIO_MASK", 2},
- {0x54, EM202_PREFIX "GPIO_STATUS", 2},
- {0x6a, EM202_PREFIX "SPDIF_OUT_SEL", 2},
- {0x72, EM202_PREFIX "ANTIPOP", 2},
- {0x74, EM202_PREFIX "EAPD_GPIO_ACCESS", 2},
+ { 0x3e, EM202_PREFIX "EXT_MODEM_CTRL", 2 },
+ { 0x4c, EM202_PREFIX "GPIO_CONF", 2 },
+ { 0x4e, EM202_PREFIX "GPIO_POLARITY", 2 },
+ { 0x50, EM202_PREFIX "GPIO_STICKY", 2 },
+ { 0x52, EM202_PREFIX "GPIO_MASK", 2 },
+ { 0x54, EM202_PREFIX "GPIO_STATUS", 2 },
+ { 0x6a, EM202_PREFIX "SPDIF_OUT_SEL", 2 },
+ { 0x72, EM202_PREFIX "ANTIPOP", 2 },
+ { 0x74, EM202_PREFIX "EAPD_GPIO_ACCESS", 2 },
};
diff --git a/utils/v4l2-dbg/v4l2-dbg-bttv.h b/utils/v4l2-dbg/v4l2-dbg-bttv.h
index f71cc0c1..38f1aeeb 100644
--- a/utils/v4l2-dbg/v4l2-dbg-bttv.h
+++ b/utils/v4l2-dbg/v4l2-dbg-bttv.h
@@ -21,77 +21,77 @@
/* Register name prefix */
#define BTTV_PREFIX "BT848_"
-static struct board_regs bt8xx_regs_other[] = {
- {0x000, BTTV_PREFIX "DSTATUS", 1},
- {0x054, BTTV_PREFIX "TEST", 1},
- {0x060, BTTV_PREFIX "ADELAY", 1},
- {0x064, BTTV_PREFIX "BDELAY", 1},
- {0x07C, BTTV_PREFIX "SRESET", 1},
- {0x100, BTTV_PREFIX "INT_STAT", 1},
- {0x110, BTTV_PREFIX "I2C", 1},
- {0x11C, BTTV_PREFIX "GPIO_REG_INP", 1},
- {0x120, BTTV_PREFIX "RISC_COUNT", 1},
+static const std::vector<board_regs> bt8xx_regs_other{
+ { 0x000, BTTV_PREFIX "DSTATUS", 1 },
+ { 0x054, BTTV_PREFIX "TEST", 1 },
+ { 0x060, BTTV_PREFIX "ADELAY", 1 },
+ { 0x064, BTTV_PREFIX "BDELAY", 1 },
+ { 0x07C, BTTV_PREFIX "SRESET", 1 },
+ { 0x100, BTTV_PREFIX "INT_STAT", 1 },
+ { 0x110, BTTV_PREFIX "I2C", 1 },
+ { 0x11C, BTTV_PREFIX "GPIO_REG_INP", 1 },
+ { 0x120, BTTV_PREFIX "RISC_COUNT", 1 },
/* This is also defined at bt8xx_regs with other name */
- {0x0fc, BTTV_PREFIX "VBI_PACK_DEL_VBI_HDELAY", 1},
+ { 0x0fc, BTTV_PREFIX "VBI_PACK_DEL_VBI_HDELAY", 1 },
};
-static struct board_regs bt8xx_regs[] = {
- {0x004, BTTV_PREFIX "IFORM", 1},
- {0x008, BTTV_PREFIX "TDEC", 1},
- {0x00C, BTTV_PREFIX "E_CROP", 1},
- {0x08C, BTTV_PREFIX "O_CROP", 1},
- {0x010, BTTV_PREFIX "E_VDELAY_LO", 1},
- {0x090, BTTV_PREFIX "O_VDELAY_LO", 1},
- {0x014, BTTV_PREFIX "E_VACTIVE_LO", 1},
- {0x094, BTTV_PREFIX "O_VACTIVE_LO", 1},
- {0x018, BTTV_PREFIX "E_HDELAY_LO", 1},
- {0x098, BTTV_PREFIX "O_HDELAY_LO", 1},
- {0x01C, BTTV_PREFIX "E_HACTIVE_LO", 1},
- {0x09C, BTTV_PREFIX "O_HACTIVE_LO", 1},
- {0x020, BTTV_PREFIX "E_HSCALE_HI", 1},
- {0x0A0, BTTV_PREFIX "O_HSCALE_HI", 1},
- {0x024, BTTV_PREFIX "E_HSCALE_LO", 1},
- {0x0A4, BTTV_PREFIX "O_HSCALE_LO", 1},
- {0x028, BTTV_PREFIX "BRIGHT", 1},
- {0x02C, BTTV_PREFIX "E_CONTROL", 1},
- {0x0AC, BTTV_PREFIX "O_CONTROL", 1},
- {0x030, BTTV_PREFIX "CONTRAST_LO", 1},
- {0x034, BTTV_PREFIX "SAT_U_LO", 1},
- {0x038, BTTV_PREFIX "SAT_V_LO", 1},
- {0x03C, BTTV_PREFIX "HUE", 1},
- {0x040, BTTV_PREFIX "E_SCLOOP", 1},
- {0x0C0, BTTV_PREFIX "O_SCLOOP", 1},
- {0x048, BTTV_PREFIX "OFORM", 1},
- {0x04C, BTTV_PREFIX "E_VSCALE_HI", 1},
- {0x0CC, BTTV_PREFIX "O_VSCALE_HI", 1},
- {0x050, BTTV_PREFIX "E_VSCALE_LO", 1},
- {0x0D0, BTTV_PREFIX "O_VSCALE_LO", 1},
- {0x068, BTTV_PREFIX "ADC", 1},
- {0x044, BTTV_PREFIX "WC_UP", 1},
- {0x078, BTTV_PREFIX "WC_DOWN", 1},
- {0x06C, BTTV_PREFIX "E_VTC", 1},
- {0x080, BTTV_PREFIX "TGCTRL", 1},
- {0x0EC, BTTV_PREFIX "O_VTC", 1},
- {0x0D4, BTTV_PREFIX "COLOR_FMT", 1},
- {0x0B0, BTTV_PREFIX "VTOTAL_LO", 1},
- {0x0B4, BTTV_PREFIX "VTOTAL_HI", 1},
- {0x0D8, BTTV_PREFIX "COLOR_CTL", 1},
- {0x0DC, BTTV_PREFIX "CAP_CTL", 1},
- {0x0E0, BTTV_PREFIX "VBI_PACK_SIZE", 1},
- {0x0E4, BTTV_PREFIX "VBI_PACK_DEL", 1},
- {0x0E8, BTTV_PREFIX "FCNTR", 1},
+static const std::vector<board_regs> bt8xx_regs{
+ { 0x004, BTTV_PREFIX "IFORM", 1 },
+ { 0x008, BTTV_PREFIX "TDEC", 1 },
+ { 0x00C, BTTV_PREFIX "E_CROP", 1 },
+ { 0x08C, BTTV_PREFIX "O_CROP", 1 },
+ { 0x010, BTTV_PREFIX "E_VDELAY_LO", 1 },
+ { 0x090, BTTV_PREFIX "O_VDELAY_LO", 1 },
+ { 0x014, BTTV_PREFIX "E_VACTIVE_LO", 1 },
+ { 0x094, BTTV_PREFIX "O_VACTIVE_LO", 1 },
+ { 0x018, BTTV_PREFIX "E_HDELAY_LO", 1 },
+ { 0x098, BTTV_PREFIX "O_HDELAY_LO", 1 },
+ { 0x01C, BTTV_PREFIX "E_HACTIVE_LO", 1 },
+ { 0x09C, BTTV_PREFIX "O_HACTIVE_LO", 1 },
+ { 0x020, BTTV_PREFIX "E_HSCALE_HI", 1 },
+ { 0x0A0, BTTV_PREFIX "O_HSCALE_HI", 1 },
+ { 0x024, BTTV_PREFIX "E_HSCALE_LO", 1 },
+ { 0x0A4, BTTV_PREFIX "O_HSCALE_LO", 1 },
+ { 0x028, BTTV_PREFIX "BRIGHT", 1 },
+ { 0x02C, BTTV_PREFIX "E_CONTROL", 1 },
+ { 0x0AC, BTTV_PREFIX "O_CONTROL", 1 },
+ { 0x030, BTTV_PREFIX "CONTRAST_LO", 1 },
+ { 0x034, BTTV_PREFIX "SAT_U_LO", 1 },
+ { 0x038, BTTV_PREFIX "SAT_V_LO", 1 },
+ { 0x03C, BTTV_PREFIX "HUE", 1 },
+ { 0x040, BTTV_PREFIX "E_SCLOOP", 1 },
+ { 0x0C0, BTTV_PREFIX "O_SCLOOP", 1 },
+ { 0x048, BTTV_PREFIX "OFORM", 1 },
+ { 0x04C, BTTV_PREFIX "E_VSCALE_HI", 1 },
+ { 0x0CC, BTTV_PREFIX "O_VSCALE_HI", 1 },
+ { 0x050, BTTV_PREFIX "E_VSCALE_LO", 1 },
+ { 0x0D0, BTTV_PREFIX "O_VSCALE_LO", 1 },
+ { 0x068, BTTV_PREFIX "ADC", 1 },
+ { 0x044, BTTV_PREFIX "WC_UP", 1 },
+ { 0x078, BTTV_PREFIX "WC_DOWN", 1 },
+ { 0x06C, BTTV_PREFIX "E_VTC", 1 },
+ { 0x080, BTTV_PREFIX "TGCTRL", 1 },
+ { 0x0EC, BTTV_PREFIX "O_VTC", 1 },
+ { 0x0D4, BTTV_PREFIX "COLOR_FMT", 1 },
+ { 0x0B0, BTTV_PREFIX "VTOTAL_LO", 1 },
+ { 0x0B4, BTTV_PREFIX "VTOTAL_HI", 1 },
+ { 0x0D8, BTTV_PREFIX "COLOR_CTL", 1 },
+ { 0x0DC, BTTV_PREFIX "CAP_CTL", 1 },
+ { 0x0E0, BTTV_PREFIX "VBI_PACK_SIZE", 1 },
+ { 0x0E4, BTTV_PREFIX "VBI_PACK_DEL", 1 },
+ { 0x0E8, BTTV_PREFIX "FCNTR", 1 },
- {0x0F0, BTTV_PREFIX "PLL_F_LO", 1},
- {0x0F4, BTTV_PREFIX "PLL_F_HI", 1},
- {0x0F8, BTTV_PREFIX "PLL_XCI", 1},
+ { 0x0F0, BTTV_PREFIX "PLL_F_LO", 1 },
+ { 0x0F4, BTTV_PREFIX "PLL_F_HI", 1 },
+ { 0x0F8, BTTV_PREFIX "PLL_XCI", 1 },
- {0x0FC, BTTV_PREFIX "DVSIF", 1},
+ { 0x0FC, BTTV_PREFIX "DVSIF", 1 },
- {0x104, BTTV_PREFIX "INT_MASK", 4},
- {0x10C, BTTV_PREFIX "GPIO_DMA_CTL", 2},
- {0x114, BTTV_PREFIX "RISC_STRT_ADD", 4},
- {0x118, BTTV_PREFIX "GPIO_OUT_EN", 4},
- {0x11a, BTTV_PREFIX "GPIO_OUT_EN_HIBYTE", 4},
- {0x200, BTTV_PREFIX "GPIO_DATA", 4},
+ { 0x104, BTTV_PREFIX "INT_MASK", 4 },
+ { 0x10C, BTTV_PREFIX "GPIO_DMA_CTL", 2 },
+ { 0x114, BTTV_PREFIX "RISC_STRT_ADD", 4 },
+ { 0x118, BTTV_PREFIX "GPIO_OUT_EN", 4 },
+ { 0x11a, BTTV_PREFIX "GPIO_OUT_EN_HIBYTE", 4 },
+ { 0x200, BTTV_PREFIX "GPIO_DATA", 4 },
};
diff --git a/utils/v4l2-dbg/v4l2-dbg-em28xx.h b/utils/v4l2-dbg/v4l2-dbg-em28xx.h
index 1cb32534..a50451e8 100644
--- a/utils/v4l2-dbg/v4l2-dbg-em28xx.h
+++ b/utils/v4l2-dbg/v4l2-dbg-em28xx.h
@@ -24,69 +24,48 @@
#define EM2880_PREFIX "EM2880_"
#define EM28XX_PREFIX "EM28XX_"
-static struct board_regs em28xx_regs[] = {
- {0x00, EM28XX_PREFIX "CHIPCFG", 1},
- {0x04, EM2880_PREFIX "GPO", 1},
- {0x08, EM28XX_PREFIX "GPIO", 1},
-
- {0x06, EM28XX_PREFIX "I2C_CLK", 1},
- {0x0a, EM28XX_PREFIX "CHIPID", 1},
- {0x0c, EM28XX_PREFIX "USBSUSP", 1},
-
- {0x0e, EM28XX_PREFIX "AUDIOSRC", 1},
- {0x0f, EM28XX_PREFIX "XCLK", 1},
-
- {0x10, EM28XX_PREFIX "VINMODE", 1},
- {0x11, EM28XX_PREFIX "VINCTRL", 1},
- {0x12, EM28XX_PREFIX "VINENABLE", 1},
-
- {0x14, EM28XX_PREFIX "GAMMA", 1},
- {0x15, EM28XX_PREFIX "RGAIN", 1},
- {0x16, EM28XX_PREFIX "GGAIN", 1},
- {0x17, EM28XX_PREFIX "BGAIN", 1},
- {0x18, EM28XX_PREFIX "ROFFSET", 1},
- {0x19, EM28XX_PREFIX "GOFFSET", 1},
- {0x1a, EM28XX_PREFIX "BOFFSET", 1},
-
- {0x1b, EM28XX_PREFIX "OFLOW", 1},
- {0x1c, EM28XX_PREFIX "HSTART", 1},
- {0x1d, EM28XX_PREFIX "VSTART", 1},
- {0x1e, EM28XX_PREFIX "CWIDTH", 1},
- {0x1f, EM28XX_PREFIX "CHEIGHT", 1},
-
- {0x20, EM28XX_PREFIX "YGAIN", 1},
- {0x21, EM28XX_PREFIX "YOFFSET", 1},
- {0x22, EM28XX_PREFIX "UVGAIN", 1},
- {0x23, EM28XX_PREFIX "UOFFSET", 1},
- {0x24, EM28XX_PREFIX "VOFFSET", 1},
- {0x25, EM28XX_PREFIX "SHARPNESS", 1},
-
- {0x26, EM28XX_PREFIX "COMPR", 1},
- {0x27, EM28XX_PREFIX "OUTFMT", 1},
-
- {0x28, EM28XX_PREFIX "XMIN", 1},
- {0x29, EM28XX_PREFIX "XMAX", 1},
- {0x2a, EM28XX_PREFIX "YMIN", 1},
- {0x2b, EM28XX_PREFIX "YMAX", 1},
-
- {0x30, EM28XX_PREFIX "HSCALELOW", 1},
- {0x31, EM28XX_PREFIX "HSCALEHIGH", 1},
- {0x32, EM28XX_PREFIX "VSCALELOW", 1},
- {0x33, EM28XX_PREFIX "VSCALEHIGH", 1},
-
- {0x40, EM28XX_PREFIX "AC97LSB", 1},
- {0x41, EM28XX_PREFIX "AC97MSB", 1},
- {0x42, EM28XX_PREFIX "AC97ADDR", 1},
- {0x43, EM28XX_PREFIX "AC97BUSY", 1},
-
- {0x45, EM28XX_PREFIX "IR", 1},
-
- {0x50, EM2874_PREFIX "IR_CONFIG", 1},
- {0x51, EM2874_PREFIX "IR", 1},
- {0x5f, EM2874_PREFIX "TS_ENABLE", 1},
- {0x80, EM2874_PREFIX "GPIO", 1},
+static const std::vector<board_regs> em28xx_regs{
+ { 0x00, EM28XX_PREFIX "CHIPCFG", 1 }, { 0x04, EM2880_PREFIX "GPO", 1 },
+ { 0x08, EM28XX_PREFIX "GPIO", 1 },
+
+ { 0x06, EM28XX_PREFIX "I2C_CLK", 1 }, { 0x0a, EM28XX_PREFIX "CHIPID", 1 },
+ { 0x0c, EM28XX_PREFIX "USBSUSP", 1 },
+
+ { 0x0e, EM28XX_PREFIX "AUDIOSRC", 1 }, { 0x0f, EM28XX_PREFIX "XCLK", 1 },
+
+ { 0x10, EM28XX_PREFIX "VINMODE", 1 }, { 0x11, EM28XX_PREFIX "VINCTRL", 1 },
+ { 0x12, EM28XX_PREFIX "VINENABLE", 1 },
+
+ { 0x14, EM28XX_PREFIX "GAMMA", 1 }, { 0x15, EM28XX_PREFIX "RGAIN", 1 },
+ { 0x16, EM28XX_PREFIX "GGAIN", 1 }, { 0x17, EM28XX_PREFIX "BGAIN", 1 },
+ { 0x18, EM28XX_PREFIX "ROFFSET", 1 }, { 0x19, EM28XX_PREFIX "GOFFSET", 1 },
+ { 0x1a, EM28XX_PREFIX "BOFFSET", 1 },
+
+ { 0x1b, EM28XX_PREFIX "OFLOW", 1 }, { 0x1c, EM28XX_PREFIX "HSTART", 1 },
+ { 0x1d, EM28XX_PREFIX "VSTART", 1 }, { 0x1e, EM28XX_PREFIX "CWIDTH", 1 },
+ { 0x1f, EM28XX_PREFIX "CHEIGHT", 1 },
+
+ { 0x20, EM28XX_PREFIX "YGAIN", 1 }, { 0x21, EM28XX_PREFIX "YOFFSET", 1 },
+ { 0x22, EM28XX_PREFIX "UVGAIN", 1 }, { 0x23, EM28XX_PREFIX "UOFFSET", 1 },
+ { 0x24, EM28XX_PREFIX "VOFFSET", 1 }, { 0x25, EM28XX_PREFIX "SHARPNESS", 1 },
+
+ { 0x26, EM28XX_PREFIX "COMPR", 1 }, { 0x27, EM28XX_PREFIX "OUTFMT", 1 },
+
+ { 0x28, EM28XX_PREFIX "XMIN", 1 }, { 0x29, EM28XX_PREFIX "XMAX", 1 },
+ { 0x2a, EM28XX_PREFIX "YMIN", 1 }, { 0x2b, EM28XX_PREFIX "YMAX", 1 },
+
+ { 0x30, EM28XX_PREFIX "HSCALELOW", 1 }, { 0x31, EM28XX_PREFIX "HSCALEHIGH", 1 },
+ { 0x32, EM28XX_PREFIX "VSCALELOW", 1 }, { 0x33, EM28XX_PREFIX "VSCALEHIGH", 1 },
+
+ { 0x40, EM28XX_PREFIX "AC97LSB", 1 }, { 0x41, EM28XX_PREFIX "AC97MSB", 1 },
+ { 0x42, EM28XX_PREFIX "AC97ADDR", 1 }, { 0x43, EM28XX_PREFIX "AC97BUSY", 1 },
+
+ { 0x45, EM28XX_PREFIX "IR", 1 },
+
+ { 0x50, EM2874_PREFIX "IR_CONFIG", 1 }, { 0x51, EM2874_PREFIX "IR", 1 },
+ { 0x5f, EM2874_PREFIX "TS_ENABLE", 1 }, { 0x80, EM2874_PREFIX "GPIO", 1 },
};
-static struct board_regs em28xx_alt_regs[] = {
- {0x08, EM2800_PREFIX "AUDIOSRC", 1},
+static const std::vector<board_regs> em28xx_alt_regs{
+ { 0x08, EM2800_PREFIX "AUDIOSRC", 1 },
};
diff --git a/utils/v4l2-dbg/v4l2-dbg-micron.h b/utils/v4l2-dbg/v4l2-dbg-micron.h
index 694e05de..52aee9aa 100644
--- a/utils/v4l2-dbg/v4l2-dbg-micron.h
+++ b/utils/v4l2-dbg/v4l2-dbg-micron.h
@@ -21,26 +21,16 @@
/* Register name prefix */
#define MT9V011_PREFIX "MT9V011_"
-static struct board_regs mt9v011_regs[] = {
- {0x00, MT9V011_PREFIX "CHIP_VERSION", 0},
- {0x01, MT9V011_PREFIX "ROWSTART", 0},
- {0x02, MT9V011_PREFIX "COLSTART", 0},
- {0x03, MT9V011_PREFIX "HEIGHT", 0},
- {0x04, MT9V011_PREFIX "WIDTH", 0},
- {0x05, MT9V011_PREFIX "HBLANK", 0},
- {0x06, MT9V011_PREFIX "VBLANK", 0},
- {0x07, MT9V011_PREFIX "OUT_CTRL", 0},
- {0x09, MT9V011_PREFIX "SHUTTER_WIDTH", 0},
- {0x0a, MT9V011_PREFIX "CLK_SPEED", 0},
- {0x0b, MT9V011_PREFIX "RESTART", 0},
- {0x0c, MT9V011_PREFIX "SHUTTER_DELAY", 0},
- {0x0d, MT9V011_PREFIX "RESET", 0},
- {0x1e, MT9V011_PREFIX "DIGITAL_ZOOM", 0},
- {0x20, MT9V011_PREFIX "READ_MODE", 0},
- {0x2b, MT9V011_PREFIX "GREEN_1_GAIN", 0},
- {0x2c, MT9V011_PREFIX "BLUE_GAIN", 0},
- {0x2d, MT9V011_PREFIX "RED_GAIN", 0},
- {0x2e, MT9V011_PREFIX "GREEN_2_GAIN", 0},
- {0x35, MT9V011_PREFIX "GLOBAL_GAIN", 0},
- {0xf1, MT9V011_PREFIX "CHIP_ENABLE", 0},
+static const std::vector<board_regs> mt9v011_regs{
+ { 0x00, MT9V011_PREFIX "CHIP_VERSION", 0 }, { 0x01, MT9V011_PREFIX "ROWSTART", 0 },
+ { 0x02, MT9V011_PREFIX "COLSTART", 0 }, { 0x03, MT9V011_PREFIX "HEIGHT", 0 },
+ { 0x04, MT9V011_PREFIX "WIDTH", 0 }, { 0x05, MT9V011_PREFIX "HBLANK", 0 },
+ { 0x06, MT9V011_PREFIX "VBLANK", 0 }, { 0x07, MT9V011_PREFIX "OUT_CTRL", 0 },
+ { 0x09, MT9V011_PREFIX "SHUTTER_WIDTH", 0 }, { 0x0a, MT9V011_PREFIX "CLK_SPEED", 0 },
+ { 0x0b, MT9V011_PREFIX "RESTART", 0 }, { 0x0c, MT9V011_PREFIX "SHUTTER_DELAY", 0 },
+ { 0x0d, MT9V011_PREFIX "RESET", 0 }, { 0x1e, MT9V011_PREFIX "DIGITAL_ZOOM", 0 },
+ { 0x20, MT9V011_PREFIX "READ_MODE", 0 }, { 0x2b, MT9V011_PREFIX "GREEN_1_GAIN", 0 },
+ { 0x2c, MT9V011_PREFIX "BLUE_GAIN", 0 }, { 0x2d, MT9V011_PREFIX "RED_GAIN", 0 },
+ { 0x2e, MT9V011_PREFIX "GREEN_2_GAIN", 0 }, { 0x35, MT9V011_PREFIX "GLOBAL_GAIN", 0 },
+ { 0xf1, MT9V011_PREFIX "CHIP_ENABLE", 0 },
};
diff --git a/utils/v4l2-dbg/v4l2-dbg-saa7134.h b/utils/v4l2-dbg/v4l2-dbg-saa7134.h
index a8c9a3ef..5823244f 100644
--- a/utils/v4l2-dbg/v4l2-dbg-saa7134.h
+++ b/utils/v4l2-dbg/v4l2-dbg-saa7134.h
@@ -23,119 +23,119 @@
#define SAA7135_PREFIX "SAA7135_"
#define SAA7133_PREFIX "SAA7133_"
-static struct board_regs saa7134_regs[] = {
- {0x101, SAA7134_PREFIX "INCR_DELAY", 1},
- {0x102, SAA7134_PREFIX "ANALOG_IN_CTRL1", 1},
- {0x103, SAA7134_PREFIX "ANALOG_IN_CTRL2", 1},
- {0x104, SAA7134_PREFIX "ANALOG_IN_CTRL3", 1},
- {0x105, SAA7134_PREFIX "ANALOG_IN_CTRL4", 1},
- {0x106, SAA7134_PREFIX "HSYNC_START", 1},
- {0x107, SAA7134_PREFIX "HSYNC_STOP", 1},
- {0x108, SAA7134_PREFIX "SYNC_CTRL", 1},
- {0x109, SAA7134_PREFIX "LUMA_CTRL", 1},
- {0x10a, SAA7134_PREFIX "DEC_LUMA_BRIGHT", 1},
- {0x10b, SAA7134_PREFIX "DEC_LUMA_CONTRAST", 1},
- {0x10c, SAA7134_PREFIX "DEC_CHROMA_SATURATION", 1},
- {0x10d, SAA7134_PREFIX "DEC_CHROMA_HUE", 1},
- {0x10e, SAA7134_PREFIX "CHROMA_CTRL1", 1},
- {0x10f, SAA7134_PREFIX "CHROMA_GAIN", 1},
- {0x110, SAA7134_PREFIX "CHROMA_CTRL2", 1},
- {0x111, SAA7134_PREFIX "MODE_DELAY_CTRL", 1},
- {0x114, SAA7134_PREFIX "ANALOG_ADC", 1},
- {0x115, SAA7134_PREFIX "VGATE_START", 1},
- {0x116, SAA7134_PREFIX "VGATE_STOP", 1},
- {0x117, SAA7134_PREFIX "MISC_VGATE_MSB", 1},
- {0x118, SAA7134_PREFIX "RAW_DATA_GAIN", 1},
- {0x119, SAA7134_PREFIX "RAW_DATA_OFFSET", 1},
- {0x11e, SAA7134_PREFIX "STATUS_VIDEO1", 1},
- {0x11f, SAA7134_PREFIX "STATUS_VIDEO2", 1},
- {0x300, SAA7134_PREFIX "OFMT_VIDEO_A", 1},
- {0x301, SAA7134_PREFIX "OFMT_DATA_A", 1},
- {0x302, SAA7134_PREFIX "OFMT_VIDEO_B", 1},
- {0x303, SAA7134_PREFIX "OFMT_DATA_B", 1},
- {0x304, SAA7134_PREFIX "ALPHA_NOCLIP", 1},
- {0x305, SAA7134_PREFIX "ALPHA_CLIP", 1},
- {0x308, SAA7134_PREFIX "UV_PIXEL", 1},
- {0x309, SAA7134_PREFIX "CLIP_RED", 1},
- {0x30a, SAA7134_PREFIX "CLIP_GREEN", 1},
- {0x30b, SAA7134_PREFIX "CLIP_BLUE", 1},
- {0x180, SAA7134_PREFIX "I2C_ATTR_STATUS", 1},
- {0x181, SAA7134_PREFIX "I2C_DATA", 1},
- {0x182, SAA7134_PREFIX "I2C_CLOCK_SELECT", 1},
- {0x183, SAA7134_PREFIX "I2C_TIMER", 1},
- {0x140, SAA7134_PREFIX "NICAM_ADD_DATA1", 1},
- {0x141, SAA7134_PREFIX "NICAM_ADD_DATA2", 1},
- {0x142, SAA7134_PREFIX "NICAM_STATUS", 1},
- {0x143, SAA7134_PREFIX "AUDIO_STATUS", 1},
- {0x144, SAA7134_PREFIX "NICAM_ERROR_COUNT", 1},
- {0x145, SAA7134_PREFIX "IDENT_SIF", 1},
- {0x146, SAA7134_PREFIX "LEVEL_READOUT1", 1},
- {0x147, SAA7134_PREFIX "LEVEL_READOUT2", 1},
- {0x148, SAA7134_PREFIX "NICAM_ERROR_LOW", 1},
- {0x149, SAA7134_PREFIX "NICAM_ERROR_HIGH", 1},
- {0x14a, SAA7134_PREFIX "DCXO_IDENT_CTRL", 1},
- {0x14b, SAA7134_PREFIX "DEMODULATOR", 1},
- {0x14c, SAA7134_PREFIX "AGC_GAIN_SELECT", 1},
- {0x150, SAA7134_PREFIX "CARRIER1_FREQ0", 1},
- {0x151, SAA7134_PREFIX "CARRIER1_FREQ1", 1},
- {0x152, SAA7134_PREFIX "CARRIER1_FREQ2", 1},
- {0x154, SAA7134_PREFIX "CARRIER2_FREQ0", 1},
- {0x155, SAA7134_PREFIX "CARRIER2_FREQ1", 1},
- {0x156, SAA7134_PREFIX "CARRIER2_FREQ2", 1},
- {0x158, SAA7134_PREFIX "NUM_SAMPLES0", 1},
- {0x159, SAA7134_PREFIX "NUM_SAMPLES1", 1},
- {0x15a, SAA7134_PREFIX "NUM_SAMPLES2", 1},
- {0x15b, SAA7134_PREFIX "AUDIO_FORMAT_CTRL", 1},
- {0x160, SAA7134_PREFIX "MONITOR_SELECT", 1},
- {0x161, SAA7134_PREFIX "FM_DEEMPHASIS", 1},
- {0x162, SAA7134_PREFIX "FM_DEMATRIX", 1},
- {0x163, SAA7134_PREFIX "CHANNEL1_LEVEL", 1},
- {0x164, SAA7134_PREFIX "CHANNEL2_LEVEL", 1},
- {0x165, SAA7134_PREFIX "NICAM_CONFIG", 1},
- {0x166, SAA7134_PREFIX "NICAM_LEVEL_ADJUST", 1},
- {0x167, SAA7134_PREFIX "STEREO_DAC_OUTPUT_SELECT", 1},
- {0x168, SAA7134_PREFIX "I2S_OUTPUT_FORMAT", 1},
- {0x169, SAA7134_PREFIX "I2S_OUTPUT_SELECT", 1},
- {0x16a, SAA7134_PREFIX "I2S_OUTPUT_LEVEL", 1},
- {0x16b, SAA7134_PREFIX "DSP_OUTPUT_SELECT", 1},
- {0x16c, SAA7134_PREFIX "AUDIO_MUTE_CTRL", 1},
- {0x16d, SAA7134_PREFIX "SIF_SAMPLE_FREQ", 1},
- {0x16e, SAA7134_PREFIX "ANALOG_IO_SELECT", 1},
- {0x170, SAA7134_PREFIX "AUDIO_CLOCK0", 1},
- {0x171, SAA7134_PREFIX "AUDIO_CLOCK1", 1},
- {0x172, SAA7134_PREFIX "AUDIO_CLOCK2", 1},
- {0x173, SAA7134_PREFIX "AUDIO_PLL_CTRL", 1},
- {0x174, SAA7134_PREFIX "AUDIO_CLOCKS_PER_FIELD0", 1},
- {0x175, SAA7134_PREFIX "AUDIO_CLOCKS_PER_FIELD1", 1},
- {0x176, SAA7134_PREFIX "AUDIO_CLOCKS_PER_FIELD2", 1},
- {0x190, SAA7134_PREFIX "VIDEO_PORT_CTRL0", 1},
- {0x191, SAA7134_PREFIX "VIDEO_PORT_CTRL1", 1},
- {0x192, SAA7134_PREFIX "VIDEO_PORT_CTRL2", 1},
- {0x193, SAA7134_PREFIX "VIDEO_PORT_CTRL3", 1},
- {0x194, SAA7134_PREFIX "VIDEO_PORT_CTRL4", 1},
- {0x195, SAA7134_PREFIX "VIDEO_PORT_CTRL5", 1},
- {0x196, SAA7134_PREFIX "VIDEO_PORT_CTRL6", 1},
- {0x197, SAA7134_PREFIX "VIDEO_PORT_CTRL7", 1},
- {0x198, SAA7134_PREFIX "VIDEO_PORT_CTRL8", 1},
- {0x1a0, SAA7134_PREFIX "TS_PARALLEL", 1},
- {0x1a1, SAA7134_PREFIX "TS_PARALLEL_SERIAL", 1},
- {0x1a2, SAA7134_PREFIX "TS_SERIAL0", 1},
- {0x1a3, SAA7134_PREFIX "TS_SERIAL1", 1},
- {0x1a4, SAA7134_PREFIX "TS_DMA0", 1},
- {0x1a5, SAA7134_PREFIX "TS_DMA1", 1},
- {0x1a6, SAA7134_PREFIX "TS_DMA2", 1},
- {0x1B0, SAA7134_PREFIX "GPIO_GPMODE0", 1},
- {0x1B1, SAA7134_PREFIX "GPIO_GPMODE1", 1},
- {0x1B2, SAA7134_PREFIX "GPIO_GPMODE2", 1},
- {0x1B3, SAA7134_PREFIX "GPIO_GPMODE3", 1},
- {0x1B4, SAA7134_PREFIX "GPIO_GPSTATUS0", 1},
- {0x1B5, SAA7134_PREFIX "GPIO_GPSTATUS1", 1},
- {0x1B6, SAA7134_PREFIX "GPIO_GPSTATUS2", 1},
- {0x1B7, SAA7134_PREFIX "GPIO_GPSTATUS3", 1},
- {0x1c0, SAA7134_PREFIX "I2S_AUDIO_OUTPUT", 1},
- {0x1d0, SAA7134_PREFIX "SPECIAL_MODE", 1},
- {0x1d1, SAA7134_PREFIX "PRODUCTION_TEST_MODE", 1},
- {0x580, SAA7135_PREFIX "DSP_RWSTATE", 1},
- {0x586, SAA7135_PREFIX "DSP_RWCLEAR", 1},
- {0x591, SAA7133_PREFIX "I2S_AUDIO_CONTROL", 1},
+static const std::vector<board_regs> saa7134_regs{
+ { 0x101, SAA7134_PREFIX "INCR_DELAY", 1 },
+ { 0x102, SAA7134_PREFIX "ANALOG_IN_CTRL1", 1 },
+ { 0x103, SAA7134_PREFIX "ANALOG_IN_CTRL2", 1 },
+ { 0x104, SAA7134_PREFIX "ANALOG_IN_CTRL3", 1 },
+ { 0x105, SAA7134_PREFIX "ANALOG_IN_CTRL4", 1 },
+ { 0x106, SAA7134_PREFIX "HSYNC_START", 1 },
+ { 0x107, SAA7134_PREFIX "HSYNC_STOP", 1 },
+ { 0x108, SAA7134_PREFIX "SYNC_CTRL", 1 },
+ { 0x109, SAA7134_PREFIX "LUMA_CTRL", 1 },
+ { 0x10a, SAA7134_PREFIX "DEC_LUMA_BRIGHT", 1 },
+ { 0x10b, SAA7134_PREFIX "DEC_LUMA_CONTRAST", 1 },
+ { 0x10c, SAA7134_PREFIX "DEC_CHROMA_SATURATION", 1 },
+ { 0x10d, SAA7134_PREFIX "DEC_CHROMA_HUE", 1 },
+ { 0x10e, SAA7134_PREFIX "CHROMA_CTRL1", 1 },
+ { 0x10f, SAA7134_PREFIX "CHROMA_GAIN", 1 },
+ { 0x110, SAA7134_PREFIX "CHROMA_CTRL2", 1 },
+ { 0x111, SAA7134_PREFIX "MODE_DELAY_CTRL", 1 },
+ { 0x114, SAA7134_PREFIX "ANALOG_ADC", 1 },
+ { 0x115, SAA7134_PREFIX "VGATE_START", 1 },
+ { 0x116, SAA7134_PREFIX "VGATE_STOP", 1 },
+ { 0x117, SAA7134_PREFIX "MISC_VGATE_MSB", 1 },
+ { 0x118, SAA7134_PREFIX "RAW_DATA_GAIN", 1 },
+ { 0x119, SAA7134_PREFIX "RAW_DATA_OFFSET", 1 },
+ { 0x11e, SAA7134_PREFIX "STATUS_VIDEO1", 1 },
+ { 0x11f, SAA7134_PREFIX "STATUS_VIDEO2", 1 },
+ { 0x300, SAA7134_PREFIX "OFMT_VIDEO_A", 1 },
+ { 0x301, SAA7134_PREFIX "OFMT_DATA_A", 1 },
+ { 0x302, SAA7134_PREFIX "OFMT_VIDEO_B", 1 },
+ { 0x303, SAA7134_PREFIX "OFMT_DATA_B", 1 },
+ { 0x304, SAA7134_PREFIX "ALPHA_NOCLIP", 1 },
+ { 0x305, SAA7134_PREFIX "ALPHA_CLIP", 1 },
+ { 0x308, SAA7134_PREFIX "UV_PIXEL", 1 },
+ { 0x309, SAA7134_PREFIX "CLIP_RED", 1 },
+ { 0x30a, SAA7134_PREFIX "CLIP_GREEN", 1 },
+ { 0x30b, SAA7134_PREFIX "CLIP_BLUE", 1 },
+ { 0x180, SAA7134_PREFIX "I2C_ATTR_STATUS", 1 },
+ { 0x181, SAA7134_PREFIX "I2C_DATA", 1 },
+ { 0x182, SAA7134_PREFIX "I2C_CLOCK_SELECT", 1 },
+ { 0x183, SAA7134_PREFIX "I2C_TIMER", 1 },
+ { 0x140, SAA7134_PREFIX "NICAM_ADD_DATA1", 1 },
+ { 0x141, SAA7134_PREFIX "NICAM_ADD_DATA2", 1 },
+ { 0x142, SAA7134_PREFIX "NICAM_STATUS", 1 },
+ { 0x143, SAA7134_PREFIX "AUDIO_STATUS", 1 },
+ { 0x144, SAA7134_PREFIX "NICAM_ERROR_COUNT", 1 },
+ { 0x145, SAA7134_PREFIX "IDENT_SIF", 1 },
+ { 0x146, SAA7134_PREFIX "LEVEL_READOUT1", 1 },
+ { 0x147, SAA7134_PREFIX "LEVEL_READOUT2", 1 },
+ { 0x148, SAA7134_PREFIX "NICAM_ERROR_LOW", 1 },
+ { 0x149, SAA7134_PREFIX "NICAM_ERROR_HIGH", 1 },
+ { 0x14a, SAA7134_PREFIX "DCXO_IDENT_CTRL", 1 },
+ { 0x14b, SAA7134_PREFIX "DEMODULATOR", 1 },
+ { 0x14c, SAA7134_PREFIX "AGC_GAIN_SELECT", 1 },
+ { 0x150, SAA7134_PREFIX "CARRIER1_FREQ0", 1 },
+ { 0x151, SAA7134_PREFIX "CARRIER1_FREQ1", 1 },
+ { 0x152, SAA7134_PREFIX "CARRIER1_FREQ2", 1 },
+ { 0x154, SAA7134_PREFIX "CARRIER2_FREQ0", 1 },
+ { 0x155, SAA7134_PREFIX "CARRIER2_FREQ1", 1 },
+ { 0x156, SAA7134_PREFIX "CARRIER2_FREQ2", 1 },
+ { 0x158, SAA7134_PREFIX "NUM_SAMPLES0", 1 },
+ { 0x159, SAA7134_PREFIX "NUM_SAMPLES1", 1 },
+ { 0x15a, SAA7134_PREFIX "NUM_SAMPLES2", 1 },
+ { 0x15b, SAA7134_PREFIX "AUDIO_FORMAT_CTRL", 1 },
+ { 0x160, SAA7134_PREFIX "MONITOR_SELECT", 1 },
+ { 0x161, SAA7134_PREFIX "FM_DEEMPHASIS", 1 },
+ { 0x162, SAA7134_PREFIX "FM_DEMATRIX", 1 },
+ { 0x163, SAA7134_PREFIX "CHANNEL1_LEVEL", 1 },
+ { 0x164, SAA7134_PREFIX "CHANNEL2_LEVEL", 1 },
+ { 0x165, SAA7134_PREFIX "NICAM_CONFIG", 1 },
+ { 0x166, SAA7134_PREFIX "NICAM_LEVEL_ADJUST", 1 },
+ { 0x167, SAA7134_PREFIX "STEREO_DAC_OUTPUT_SELECT", 1 },
+ { 0x168, SAA7134_PREFIX "I2S_OUTPUT_FORMAT", 1 },
+ { 0x169, SAA7134_PREFIX "I2S_OUTPUT_SELECT", 1 },
+ { 0x16a, SAA7134_PREFIX "I2S_OUTPUT_LEVEL", 1 },
+ { 0x16b, SAA7134_PREFIX "DSP_OUTPUT_SELECT", 1 },
+ { 0x16c, SAA7134_PREFIX "AUDIO_MUTE_CTRL", 1 },
+ { 0x16d, SAA7134_PREFIX "SIF_SAMPLE_FREQ", 1 },
+ { 0x16e, SAA7134_PREFIX "ANALOG_IO_SELECT", 1 },
+ { 0x170, SAA7134_PREFIX "AUDIO_CLOCK0", 1 },
+ { 0x171, SAA7134_PREFIX "AUDIO_CLOCK1", 1 },
+ { 0x172, SAA7134_PREFIX "AUDIO_CLOCK2", 1 },
+ { 0x173, SAA7134_PREFIX "AUDIO_PLL_CTRL", 1 },
+ { 0x174, SAA7134_PREFIX "AUDIO_CLOCKS_PER_FIELD0", 1 },
+ { 0x175, SAA7134_PREFIX "AUDIO_CLOCKS_PER_FIELD1", 1 },
+ { 0x176, SAA7134_PREFIX "AUDIO_CLOCKS_PER_FIELD2", 1 },
+ { 0x190, SAA7134_PREFIX "VIDEO_PORT_CTRL0", 1 },
+ { 0x191, SAA7134_PREFIX "VIDEO_PORT_CTRL1", 1 },
+ { 0x192, SAA7134_PREFIX "VIDEO_PORT_CTRL2", 1 },
+ { 0x193, SAA7134_PREFIX "VIDEO_PORT_CTRL3", 1 },
+ { 0x194, SAA7134_PREFIX "VIDEO_PORT_CTRL4", 1 },
+ { 0x195, SAA7134_PREFIX "VIDEO_PORT_CTRL5", 1 },
+ { 0x196, SAA7134_PREFIX "VIDEO_PORT_CTRL6", 1 },
+ { 0x197, SAA7134_PREFIX "VIDEO_PORT_CTRL7", 1 },
+ { 0x198, SAA7134_PREFIX "VIDEO_PORT_CTRL8", 1 },
+ { 0x1a0, SAA7134_PREFIX "TS_PARALLEL", 1 },
+ { 0x1a1, SAA7134_PREFIX "TS_PARALLEL_SERIAL", 1 },
+ { 0x1a2, SAA7134_PREFIX "TS_SERIAL0", 1 },
+ { 0x1a3, SAA7134_PREFIX "TS_SERIAL1", 1 },
+ { 0x1a4, SAA7134_PREFIX "TS_DMA0", 1 },
+ { 0x1a5, SAA7134_PREFIX "TS_DMA1", 1 },
+ { 0x1a6, SAA7134_PREFIX "TS_DMA2", 1 },
+ { 0x1B0, SAA7134_PREFIX "GPIO_GPMODE0", 1 },
+ { 0x1B1, SAA7134_PREFIX "GPIO_GPMODE1", 1 },
+ { 0x1B2, SAA7134_PREFIX "GPIO_GPMODE2", 1 },
+ { 0x1B3, SAA7134_PREFIX "GPIO_GPMODE3", 1 },
+ { 0x1B4, SAA7134_PREFIX "GPIO_GPSTATUS0", 1 },
+ { 0x1B5, SAA7134_PREFIX "GPIO_GPSTATUS1", 1 },
+ { 0x1B6, SAA7134_PREFIX "GPIO_GPSTATUS2", 1 },
+ { 0x1B7, SAA7134_PREFIX "GPIO_GPSTATUS3", 1 },
+ { 0x1c0, SAA7134_PREFIX "I2S_AUDIO_OUTPUT", 1 },
+ { 0x1d0, SAA7134_PREFIX "SPECIAL_MODE", 1 },
+ { 0x1d1, SAA7134_PREFIX "PRODUCTION_TEST_MODE", 1 },
+ { 0x580, SAA7135_PREFIX "DSP_RWSTATE", 1 },
+ { 0x586, SAA7135_PREFIX "DSP_RWCLEAR", 1 },
+ { 0x591, SAA7133_PREFIX "I2S_AUDIO_CONTROL", 1 },
};
diff --git a/utils/v4l2-dbg/v4l2-dbg-tvp5150.h b/utils/v4l2-dbg/v4l2-dbg-tvp5150.h
index 048ee421..d8451209 100644
--- a/utils/v4l2-dbg/v4l2-dbg-tvp5150.h
+++ b/utils/v4l2-dbg/v4l2-dbg-tvp5150.h
@@ -21,77 +21,77 @@
/* Register name prefix */
#define TVP5150_PREFIX "TVP5150_"
-static struct board_regs tvp5150_regs[] = {
- {0x00, TVP5150_PREFIX "VD_IN_SRC_SEL_1", 1},
- {0x01, TVP5150_PREFIX "ANAL_CHL_CTL", 1},
- {0x02, TVP5150_PREFIX "OP_MODE_CTL", 1},
- {0x03, TVP5150_PREFIX "MISC_CTL", 1},
- {0x04, TVP5150_PREFIX "AUTOSW_MSK", 1},
- {0x06, TVP5150_PREFIX "COLOR_KIL_THSH_CTL", 1},
- {0x07, TVP5150_PREFIX "LUMA_PROC_CTL_1", 1},
- {0x08, TVP5150_PREFIX "LUMA_PROC_CTL_2", 1},
- {0x09, TVP5150_PREFIX "BRIGHT_CTL", 1},
- {0x0a, TVP5150_PREFIX "SATURATION_CTL", 1},
- {0x0b, TVP5150_PREFIX "HUE_CTL", 1},
- {0x0c, TVP5150_PREFIX "CONTRAST_CTL", 1},
- {0x0d, TVP5150_PREFIX "DATA_RATE_SEL", 1},
- {0x0e, TVP5150_PREFIX "LUMA_PROC_CTL_3", 1},
- {0x0f, TVP5150_PREFIX "CONF_SHARED_PIN", 1},
- {0x11, TVP5150_PREFIX "ACT_VD_CROP_ST_MSB", 1},
- {0x12, TVP5150_PREFIX "ACT_VD_CROP_ST_LSB", 1},
- {0x13, TVP5150_PREFIX "ACT_VD_CROP_STP_MSB", 1},
- {0x14, TVP5150_PREFIX "ACT_VD_CROP_STP_LSB", 1},
- {0x15, TVP5150_PREFIX "GENLOCK", 1},
- {0x16, TVP5150_PREFIX "HORIZ_SYNC_START", 1},
- {0x18, TVP5150_PREFIX "VERT_BLANKING_START", 1},
- {0x19, TVP5150_PREFIX "VERT_BLANKING_STOP", 1},
- {0x1a, TVP5150_PREFIX "CHROMA_PROC_CTL_1", 1},
- {0x1b, TVP5150_PREFIX "CHROMA_PROC_CTL_2", 1},
- {0x1c, TVP5150_PREFIX "INT_RESET_REG_B", 1},
- {0x1d, TVP5150_PREFIX "INT_ENABLE_REG_B", 1},
- {0x1e, TVP5150_PREFIX "INTT_CONFIG_REG_B", 1},
- {0x28, TVP5150_PREFIX "VIDEO_STD", 1},
- {0x2c, TVP5150_PREFIX "CB_GAIN_FACT", 1},
- {0x2d, TVP5150_PREFIX "CR_GAIN_FACTOR", 1},
- {0x2e, TVP5150_PREFIX "MACROVISION_ON_CTR", 1},
- {0x2f, TVP5150_PREFIX "MACROVISION_OFF_CTR", 1},
- {0x30, TVP5150_PREFIX "REV_SELECT", 1},
- {0x80, TVP5150_PREFIX "MSB_DEV_ID", 1},
- {0x81, TVP5150_PREFIX "LSB_DEV_ID", 1},
- {0x82, TVP5150_PREFIX "ROM_MAJOR_VER", 1},
- {0x83, TVP5150_PREFIX "ROM_MINOR_VER", 1},
- {0x84, TVP5150_PREFIX "VERT_LN_COUNT_MSB", 1},
- {0x85, TVP5150_PREFIX "VERT_LN_COUNT_LSB", 1},
- {0x86, TVP5150_PREFIX "INT_STATUS_REG_B", 1},
- {0x87, TVP5150_PREFIX "INT_ACTIVE_REG_B", 1},
- {0x88, TVP5150_PREFIX "STATUS_REG_1", 1},
- {0x89, TVP5150_PREFIX "STATUS_REG_2", 1},
- {0x8a, TVP5150_PREFIX "STATUS_REG_3", 1},
- {0x8b, TVP5150_PREFIX "STATUS_REG_4", 1},
- {0x8c, TVP5150_PREFIX "STATUS_REG_5", 1},
- {0x90, TVP5150_PREFIX "CC_DATA", 4},
- {0x94, TVP5150_PREFIX "WSS_DATA", 6},
- {0x9a, TVP5150_PREFIX "VPS_DATA", 13},
- {0xa7, TVP5150_PREFIX "VITC_DATA", 9},
- {0xb0, TVP5150_PREFIX "VBI_FIFO_READ_DATA", 1},
- {0xb1, TVP5150_PREFIX "TELETEXT_FIL1", 5},
- {0xb6, TVP5150_PREFIX "TELETEXT_FIL2", 5},
- {0xbb, TVP5150_PREFIX "TELETEXT_FIL_ENA", 1},
- {0xc0, TVP5150_PREFIX "INT_STATUS_REG_A", 1},
- {0xc1, TVP5150_PREFIX "INT_ENABLE_REG_A", 1},
- {0xc2, TVP5150_PREFIX "INT_CONF", 1},
- {0xc3, TVP5150_PREFIX "VDP_CONF_RAM_DATA", 1},
- {0xc4, TVP5150_PREFIX "CONF_RAM_ADDR_LOW", 1},
- {0xc5, TVP5150_PREFIX "CONF_RAM_ADDR_HIGH", 1},
- {0xc6, TVP5150_PREFIX "VDP_STATUS_REG", 1},
- {0xc7, TVP5150_PREFIX "FIFO_WORD_COUNT", 1},
- {0xc8, TVP5150_PREFIX "FIFO_INT_THRESHOLD", 1},
- {0xc9, TVP5150_PREFIX "FIFO_RESET", 1},
- {0xca, TVP5150_PREFIX "LINE_NUMBER_INT", 1},
- {0xcb, TVP5150_PREFIX "PIX_ALIGN_REG_LOW", 1},
- {0xcc, TVP5150_PREFIX "PIX_ALIGN_REG_HIGH", 1},
- {0xcd, TVP5150_PREFIX "FIFO_OUT_CTRL", 1},
- {0xcf, TVP5150_PREFIX "FULL_FIELD_ENA", 1},
- {0xd0, TVP5150_PREFIX "LINE_MODE", 43},
- {0xfc, TVP5150_PREFIX "FULL_FIELD_MODE_REG", 1},
+static const std::vector<board_regs> tvp5150_regs{
+ { 0x00, TVP5150_PREFIX "VD_IN_SRC_SEL_1", 1 },
+ { 0x01, TVP5150_PREFIX "ANAL_CHL_CTL", 1 },
+ { 0x02, TVP5150_PREFIX "OP_MODE_CTL", 1 },
+ { 0x03, TVP5150_PREFIX "MISC_CTL", 1 },
+ { 0x04, TVP5150_PREFIX "AUTOSW_MSK", 1 },
+ { 0x06, TVP5150_PREFIX "COLOR_KIL_THSH_CTL", 1 },
+ { 0x07, TVP5150_PREFIX "LUMA_PROC_CTL_1", 1 },
+ { 0x08, TVP5150_PREFIX "LUMA_PROC_CTL_2", 1 },
+ { 0x09, TVP5150_PREFIX "BRIGHT_CTL", 1 },
+ { 0x0a, TVP5150_PREFIX "SATURATION_CTL", 1 },
+ { 0x0b, TVP5150_PREFIX "HUE_CTL", 1 },
+ { 0x0c, TVP5150_PREFIX "CONTRAST_CTL", 1 },
+ { 0x0d, TVP5150_PREFIX "DATA_RATE_SEL", 1 },
+ { 0x0e, TVP5150_PREFIX "LUMA_PROC_CTL_3", 1 },
+ { 0x0f, TVP5150_PREFIX "CONF_SHARED_PIN", 1 },
+ { 0x11, TVP5150_PREFIX "ACT_VD_CROP_ST_MSB", 1 },
+ { 0x12, TVP5150_PREFIX "ACT_VD_CROP_ST_LSB", 1 },
+ { 0x13, TVP5150_PREFIX "ACT_VD_CROP_STP_MSB", 1 },
+ { 0x14, TVP5150_PREFIX "ACT_VD_CROP_STP_LSB", 1 },
+ { 0x15, TVP5150_PREFIX "GENLOCK", 1 },
+ { 0x16, TVP5150_PREFIX "HORIZ_SYNC_START", 1 },
+ { 0x18, TVP5150_PREFIX "VERT_BLANKING_START", 1 },
+ { 0x19, TVP5150_PREFIX "VERT_BLANKING_STOP", 1 },
+ { 0x1a, TVP5150_PREFIX "CHROMA_PROC_CTL_1", 1 },
+ { 0x1b, TVP5150_PREFIX "CHROMA_PROC_CTL_2", 1 },
+ { 0x1c, TVP5150_PREFIX "INT_RESET_REG_B", 1 },
+ { 0x1d, TVP5150_PREFIX "INT_ENABLE_REG_B", 1 },
+ { 0x1e, TVP5150_PREFIX "INTT_CONFIG_REG_B", 1 },
+ { 0x28, TVP5150_PREFIX "VIDEO_STD", 1 },
+ { 0x2c, TVP5150_PREFIX "CB_GAIN_FACT", 1 },
+ { 0x2d, TVP5150_PREFIX "CR_GAIN_FACTOR", 1 },
+ { 0x2e, TVP5150_PREFIX "MACROVISION_ON_CTR", 1 },
+ { 0x2f, TVP5150_PREFIX "MACROVISION_OFF_CTR", 1 },
+ { 0x30, TVP5150_PREFIX "REV_SELECT", 1 },
+ { 0x80, TVP5150_PREFIX "MSB_DEV_ID", 1 },
+ { 0x81, TVP5150_PREFIX "LSB_DEV_ID", 1 },
+ { 0x82, TVP5150_PREFIX "ROM_MAJOR_VER", 1 },
+ { 0x83, TVP5150_PREFIX "ROM_MINOR_VER", 1 },
+ { 0x84, TVP5150_PREFIX "VERT_LN_COUNT_MSB", 1 },
+ { 0x85, TVP5150_PREFIX "VERT_LN_COUNT_LSB", 1 },
+ { 0x86, TVP5150_PREFIX "INT_STATUS_REG_B", 1 },
+ { 0x87, TVP5150_PREFIX "INT_ACTIVE_REG_B", 1 },
+ { 0x88, TVP5150_PREFIX "STATUS_REG_1", 1 },
+ { 0x89, TVP5150_PREFIX "STATUS_REG_2", 1 },
+ { 0x8a, TVP5150_PREFIX "STATUS_REG_3", 1 },
+ { 0x8b, TVP5150_PREFIX "STATUS_REG_4", 1 },
+ { 0x8c, TVP5150_PREFIX "STATUS_REG_5", 1 },
+ { 0x90, TVP5150_PREFIX "CC_DATA", 4 },
+ { 0x94, TVP5150_PREFIX "WSS_DATA", 6 },
+ { 0x9a, TVP5150_PREFIX "VPS_DATA", 13 },
+ { 0xa7, TVP5150_PREFIX "VITC_DATA", 9 },
+ { 0xb0, TVP5150_PREFIX "VBI_FIFO_READ_DATA", 1 },
+ { 0xb1, TVP5150_PREFIX "TELETEXT_FIL1", 5 },
+ { 0xb6, TVP5150_PREFIX "TELETEXT_FIL2", 5 },
+ { 0xbb, TVP5150_PREFIX "TELETEXT_FIL_ENA", 1 },
+ { 0xc0, TVP5150_PREFIX "INT_STATUS_REG_A", 1 },
+ { 0xc1, TVP5150_PREFIX "INT_ENABLE_REG_A", 1 },
+ { 0xc2, TVP5150_PREFIX "INT_CONF", 1 },
+ { 0xc3, TVP5150_PREFIX "VDP_CONF_RAM_DATA", 1 },
+ { 0xc4, TVP5150_PREFIX "CONF_RAM_ADDR_LOW", 1 },
+ { 0xc5, TVP5150_PREFIX "CONF_RAM_ADDR_HIGH", 1 },
+ { 0xc6, TVP5150_PREFIX "VDP_STATUS_REG", 1 },
+ { 0xc7, TVP5150_PREFIX "FIFO_WORD_COUNT", 1 },
+ { 0xc8, TVP5150_PREFIX "FIFO_INT_THRESHOLD", 1 },
+ { 0xc9, TVP5150_PREFIX "FIFO_RESET", 1 },
+ { 0xca, TVP5150_PREFIX "LINE_NUMBER_INT", 1 },
+ { 0xcb, TVP5150_PREFIX "PIX_ALIGN_REG_LOW", 1 },
+ { 0xcc, TVP5150_PREFIX "PIX_ALIGN_REG_HIGH", 1 },
+ { 0xcd, TVP5150_PREFIX "FIFO_OUT_CTRL", 1 },
+ { 0xcf, TVP5150_PREFIX "FULL_FIELD_ENA", 1 },
+ { 0xd0, TVP5150_PREFIX "LINE_MODE", 43 },
+ { 0xfc, TVP5150_PREFIX "FULL_FIELD_MODE_REG", 1 },
};
diff --git a/utils/v4l2-dbg/v4l2-dbg.cpp b/utils/v4l2-dbg/v4l2-dbg.cpp
index dd290435..47b1263c 100644
--- a/utils/v4l2-dbg/v4l2-dbg.cpp
+++ b/utils/v4l2-dbg/v4l2-dbg.cpp
@@ -46,66 +46,58 @@
#include "v4l2-dbg-tvp5150.h"
#include "v4l2-dbg-micron.h"
-#define ARRAY_SIZE(arr) ((int)(sizeof(arr) / sizeof((arr)[0])))
-
struct board_list {
const char *name;
int prefix; /* Register prefix size */
- const struct board_regs *regs;
- int regs_size;
- const struct board_regs *alt_regs;
- int alt_regs_size;
+ const std::vector<board_regs> &regs;
+ const std::vector<board_regs> &alt_regs;
};
-static const struct board_list boards[] = {
+static const std::vector<board_regs> empty{};
+
+static const std::vector<board_list> boards{
#define AC97_BOARD 0
- { /* From v4l2-dbg-ac97.h */
+ {
+ /* From v4l2-dbg-ac97.h */
AC97_IDENT,
sizeof(AC97_PREFIX) - 1,
ac97_regs,
- ARRAY_SIZE(ac97_regs),
- nullptr,
- 0,
+ empty,
},
- { /* From v4l2-dbg-bttv.h */
+ {
+ /* From v4l2-dbg-bttv.h */
BTTV_IDENT,
sizeof(BTTV_PREFIX) - 1,
bt8xx_regs,
- ARRAY_SIZE(bt8xx_regs),
bt8xx_regs_other,
- ARRAY_SIZE(bt8xx_regs_other),
},
- { /* From v4l2-dbg-saa7134.h */
+ {
+ /* From v4l2-dbg-saa7134.h */
SAA7134_IDENT,
sizeof(SAA7134_PREFIX) - 1,
saa7134_regs,
- ARRAY_SIZE(saa7134_regs),
- nullptr,
- 0,
+ empty,
},
- { /* From v4l2-dbg-em28xx.h */
+ {
+ /* From v4l2-dbg-em28xx.h */
EM28XX_IDENT,
sizeof(EM28XX_PREFIX) - 1,
em28xx_regs,
- ARRAY_SIZE(em28xx_regs),
em28xx_alt_regs,
- ARRAY_SIZE(em28xx_alt_regs),
},
- { /* From v4l2-dbg-tvp5150.h */
+ {
+ /* From v4l2-dbg-tvp5150.h */
TVP5150_IDENT,
sizeof(TVP5150_PREFIX) - 1,
tvp5150_regs,
- ARRAY_SIZE(tvp5150_regs),
- nullptr,
- 0,
+ empty,
},
- { /* From v4l2-dbg-micron.h */
+ {
+ /* From v4l2-dbg-micron.h */
MT9V011_IDENT,
sizeof(MT9V011_PREFIX) - 1,
mt9v011_regs,
- ARRAY_SIZE(mt9v011_regs),
- nullptr,
- 0,
+ empty,
},
};
@@ -294,16 +286,16 @@ static void print_name(struct v4l2_dbg_chip_info *chip)
static unsigned long long parse_reg(const struct board_list *curr_bd, const std::string &reg)
{
if (curr_bd) {
- for (int i = 0; i < curr_bd->regs_size; i++) {
- if (!strcasecmp(reg.c_str(), curr_bd->regs[i].name) ||
- !strcasecmp(reg.c_str(), curr_bd->regs[i].name + curr_bd->prefix)) {
- return curr_bd->regs[i].reg;
+ for (const auto &curr : curr_bd->regs) {
+ if (!strcasecmp(reg.c_str(), curr.name) ||
+ !strcasecmp(reg.c_str(), curr.name + curr_bd->prefix)) {
+ return curr.reg;
}
}
- for (int i = 0; i < curr_bd->alt_regs_size; i++) {
- if (!strcasecmp(reg.c_str(), curr_bd->alt_regs[i].name) ||
- !strcasecmp(reg.c_str(), curr_bd->alt_regs[i].name + curr_bd->prefix)) {
- return curr_bd->alt_regs[i].reg;
+ for (const auto &curr : curr_bd->alt_regs) {
+ if (!strcasecmp(reg.c_str(), curr.name) ||
+ !strcasecmp(reg.c_str(), curr.name + curr_bd->prefix)) {
+ return curr.reg;
}
}
}
@@ -313,13 +305,13 @@ static unsigned long long parse_reg(const struct board_list *curr_bd, const std:
static const char *reg_name(const struct board_list *curr_bd, unsigned long long reg)
{
if (curr_bd) {
- for (int i = 0; i < curr_bd->regs_size; i++) {
- if (reg == curr_bd->regs[i].reg)
- return curr_bd->regs[i].name;
+ for (const auto &curr : curr_bd->regs) {
+ if (reg == curr.reg)
+ return curr.name;
}
- for (int i = 0; i < curr_bd->alt_regs_size; i++) {
- if (reg == curr_bd->regs[i].reg)
- return curr_bd->regs[i].name;
+ for (const auto &curr : curr_bd->regs) {
+ if (reg == curr.reg)
+ return curr.name;
}
}
return nullptr;
@@ -572,9 +564,9 @@ int main(int argc, char **argv)
if (!strncasecmp(match.name, "ac97", 4)) {
curr_bd = &boards[AC97_BOARD];
} else {
- for (int board = ARRAY_SIZE(boards) - 1; board >= 0; board--) {
- if (!strcasecmp(chip_info.name, boards[board].name)) {
- curr_bd = &boards[board];
+ for (size_t board = boards.size(); board; board--) {
+ if (!strcasecmp(chip_info.name, boards[board - 1].name)) {
+ curr_bd = &boards[board - 1];
break;
}
}
@@ -685,9 +677,9 @@ int main(int argc, char **argv)
else
reg_max = parse_reg(curr_bd, reg_max_arg);
- for (int i = 0; i < curr_bd->regs_size; i++) {
- if (reg_min_arg.empty() || ((curr_bd->regs[i].reg >= reg_min) && curr_bd->regs[i].reg <= reg_max)) {
- get_reg.reg = curr_bd->regs[i].reg;
+ for (const auto &curr : curr_bd->regs) {
+ if (reg_min_arg.empty() || ((curr.reg >= reg_min) && curr.reg <= reg_max)) {
+ get_reg.reg = curr.reg;
if (ioctl(fd, VIDIOC_DBG_G_REGISTER, &get_reg) < 0)
fprintf(stderr, "ioctl: VIDIOC_DBG_G_REGISTER "
@@ -796,10 +788,10 @@ list_done:
}
else {
printf("Symbols for driver %s:\n", curr_bd->name);
- for (int i = 0; i < curr_bd->regs_size; i++)
- printf("0x%08x: %s\n", curr_bd->regs[i].reg, curr_bd->regs[i].name);
- for (int i = 0; i < curr_bd->alt_regs_size; i++)
- printf("0x%08x: %s\n", curr_bd->alt_regs[i].reg, curr_bd->alt_regs[i].name);
+ for (const auto &curr : curr_bd->regs)
+ printf("0x%08x: %s\n", curr.reg, curr.name);
+ for (const auto &curr : curr_bd->alt_regs)
+ printf("0x%08x: %s\n", curr.reg, curr.name);
}
}

Privacy Policy