aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2021-06-04 09:00:31 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2021-06-04 09:10:14 +0200
commit57a0264cd163793e4f86e907098baeb74f2e9723 (patch)
tree45ec34561b2c1ad72ec59323989ae0895fb21d27
parent1d4b23f1db35077a12da43c3a93d74645281625c (diff)
cec-compliance: move CDC helper functions to cec-test.cpp
Several CDC helper functions were in cec-compliance.cpp, but they belong to cec-test.cpp where the CDC tests happen. Move them to cec-test.cpp. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--utils/cec-compliance/cec-compliance.cpp60
-rw-r--r--utils/cec-compliance/cec-compliance.h4
-rw-r--r--utils/cec-compliance/cec-test.cpp60
3 files changed, 60 insertions, 64 deletions
diff --git a/utils/cec-compliance/cec-compliance.cpp b/utils/cec-compliance/cec-compliance.cpp
index 8321d933..322bc772 100644
--- a/utils/cec-compliance/cec-compliance.cpp
+++ b/utils/cec-compliance/cec-compliance.cpp
@@ -358,66 +358,6 @@ const char *dig_bcast_system2s(__u8 bcast_system)
}
}
-const char *hec_func_state2s(__u8 hfs)
-{
- switch (hfs) {
- case CEC_OP_HEC_FUNC_STATE_NOT_SUPPORTED:
- return "HEC Not Supported";
- case CEC_OP_HEC_FUNC_STATE_INACTIVE:
- return "HEC Inactive";
- case CEC_OP_HEC_FUNC_STATE_ACTIVE:
- return "HEC Active";
- case CEC_OP_HEC_FUNC_STATE_ACTIVATION_FIELD:
- return "HEC Activation Field";
- default:
- return "Unknown";
- }
-}
-
-const char *host_func_state2s(__u8 hfs)
-{
- switch (hfs) {
- case CEC_OP_HOST_FUNC_STATE_NOT_SUPPORTED:
- return "Host Not Supported";
- case CEC_OP_HOST_FUNC_STATE_INACTIVE:
- return "Host Inactive";
- case CEC_OP_HOST_FUNC_STATE_ACTIVE:
- return "Host Active";
- default:
- return "Unknown";
- }
-}
-
-const char *enc_func_state2s(__u8 efs)
-{
- switch (efs) {
- case CEC_OP_ENC_FUNC_STATE_EXT_CON_NOT_SUPPORTED:
- return "Ext Con Not Supported";
- case CEC_OP_ENC_FUNC_STATE_EXT_CON_INACTIVE:
- return "Ext Con Inactive";
- case CEC_OP_ENC_FUNC_STATE_EXT_CON_ACTIVE:
- return "Ext Con Active";
- default:
- return "Unknown";
- }
-}
-
-const char *cdc_errcode2s(__u8 cdc_errcode)
-{
- switch (cdc_errcode) {
- case CEC_OP_CDC_ERROR_CODE_NONE:
- return "No error";
- case CEC_OP_CDC_ERROR_CODE_CAP_UNSUPPORTED:
- return "Initiator does not have requested capability";
- case CEC_OP_CDC_ERROR_CODE_WRONG_STATE:
- return "Initiator is in wrong state";
- case CEC_OP_CDC_ERROR_CODE_OTHER:
- return "Other error";
- default:
- return "Unknown";
- }
-}
-
std::string opcode2s(const struct cec_msg *msg)
{
std::stringstream oss;
diff --git a/utils/cec-compliance/cec-compliance.h b/utils/cec-compliance/cec-compliance.h
index 617598d3..fc50e6d9 100644
--- a/utils/cec-compliance/cec-compliance.h
+++ b/utils/cec-compliance/cec-compliance.h
@@ -415,10 +415,6 @@ const char *ok(int res);
const char *power_status2s(__u8 power_status);
const char *bcast_system2s(__u8 bcast_system);
const char *dig_bcast_system2s(__u8 bcast_system);
-const char *hec_func_state2s(__u8 hfs);
-const char *host_func_state2s(__u8 hfs);
-const char *enc_func_state2s(__u8 efs);
-const char *cdc_errcode2s(__u8 cdc_errcode);
int check_0(const void *p, int len);
int util_receive(struct node *node, unsigned la, unsigned timeout,
struct cec_msg *msg, __u8 sent_msg,
diff --git a/utils/cec-compliance/cec-test.cpp b/utils/cec-compliance/cec-test.cpp
index fb57d10b..15f1b3c7 100644
--- a/utils/cec-compliance/cec-test.cpp
+++ b/utils/cec-compliance/cec-test.cpp
@@ -1270,6 +1270,66 @@ static const vec_remote_subtests timer_prog_subtests{
{ "Timer Cleared Status", CEC_LOG_ADDR_MASK_RECORD, timer_prog_timer_clear_status },
};
+static const char *hec_func_state2s(__u8 hfs)
+{
+ switch (hfs) {
+ case CEC_OP_HEC_FUNC_STATE_NOT_SUPPORTED:
+ return "HEC Not Supported";
+ case CEC_OP_HEC_FUNC_STATE_INACTIVE:
+ return "HEC Inactive";
+ case CEC_OP_HEC_FUNC_STATE_ACTIVE:
+ return "HEC Active";
+ case CEC_OP_HEC_FUNC_STATE_ACTIVATION_FIELD:
+ return "HEC Activation Field";
+ default:
+ return "Unknown";
+ }
+}
+
+static const char *host_func_state2s(__u8 hfs)
+{
+ switch (hfs) {
+ case CEC_OP_HOST_FUNC_STATE_NOT_SUPPORTED:
+ return "Host Not Supported";
+ case CEC_OP_HOST_FUNC_STATE_INACTIVE:
+ return "Host Inactive";
+ case CEC_OP_HOST_FUNC_STATE_ACTIVE:
+ return "Host Active";
+ default:
+ return "Unknown";
+ }
+}
+
+static const char *enc_func_state2s(__u8 efs)
+{
+ switch (efs) {
+ case CEC_OP_ENC_FUNC_STATE_EXT_CON_NOT_SUPPORTED:
+ return "Ext Con Not Supported";
+ case CEC_OP_ENC_FUNC_STATE_EXT_CON_INACTIVE:
+ return "Ext Con Inactive";
+ case CEC_OP_ENC_FUNC_STATE_EXT_CON_ACTIVE:
+ return "Ext Con Active";
+ default:
+ return "Unknown";
+ }
+}
+
+static const char *cdc_errcode2s(__u8 cdc_errcode)
+{
+ switch (cdc_errcode) {
+ case CEC_OP_CDC_ERROR_CODE_NONE:
+ return "No error";
+ case CEC_OP_CDC_ERROR_CODE_CAP_UNSUPPORTED:
+ return "Initiator does not have requested capability";
+ case CEC_OP_CDC_ERROR_CODE_WRONG_STATE:
+ return "Initiator is in wrong state";
+ case CEC_OP_CDC_ERROR_CODE_OTHER:
+ return "Other error";
+ default:
+ return "Unknown";
+ }
+}
+
static int cdc_hec_discover(struct node *node, unsigned me, unsigned la, bool print)
{
/* TODO: For future use cases, it might be necessary to store the results

Privacy Policy