aboutsummaryrefslogtreecommitdiffstats
path: root/utils/cec-compliance
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2018-10-04 12:57:55 +0200
committerHans Verkuil <hans.verkuil@cisco.com>2018-10-04 12:57:55 +0200
commitc926790d303bdf85c0b829e89a05ba40e9e795fd (patch)
tree11c2ab94fefa87d3cefe9c07bc69ff0c10f108f4 /utils/cec-compliance
parent71806d6cbfad009e2b5f5b98ae75dff9eda91bf0 (diff)
cec: move status2s functions to cec-info.cpp
All three cec utilities used the same code to construct a string with the message status. Move this code to cec-info.cpp and use it in all three utilities. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Diffstat (limited to 'utils/cec-compliance')
-rw-r--r--utils/cec-compliance/cec-compliance.cpp68
1 files changed, 0 insertions, 68 deletions
diff --git a/utils/cec-compliance/cec-compliance.cpp b/utils/cec-compliance/cec-compliance.cpp
index ad6c5744..990c38bf 100644
--- a/utils/cec-compliance/cec-compliance.cpp
+++ b/utils/cec-compliance/cec-compliance.cpp
@@ -242,74 +242,6 @@ static std::string ts2s(__u64 ts)
return s + "." + buf;
}
-static std::string tx_status2s(const struct cec_msg &msg)
-{
- std::string s;
- char num[4];
- unsigned stat = msg.tx_status;
-
- if (stat)
- s += "Tx";
- if (stat & CEC_TX_STATUS_OK)
- s += ", OK";
- if (stat & CEC_TX_STATUS_ARB_LOST) {
- sprintf(num, "%u", msg.tx_arb_lost_cnt);
- s += ", Arbitration Lost";
- if (msg.tx_arb_lost_cnt)
- s += " (" + std::string(num) + ")";
- }
- if (stat & CEC_TX_STATUS_NACK) {
- sprintf(num, "%u", msg.tx_nack_cnt);
- s += ", Not Acknowledged";
- if (msg.tx_nack_cnt)
- s += " (" + std::string(num) + ")";
- }
- if (stat & CEC_TX_STATUS_LOW_DRIVE) {
- sprintf(num, "%u", msg.tx_low_drive_cnt);
- s += ", Low Drive";
- if (msg.tx_low_drive_cnt)
- s += " (" + std::string(num) + ")";
- }
- if (stat & CEC_TX_STATUS_ERROR) {
- sprintf(num, "%u", msg.tx_error_cnt);
- s += ", Error";
- if (msg.tx_error_cnt)
- s += " (" + std::string(num) + ")";
- }
- if (stat & CEC_TX_STATUS_MAX_RETRIES)
- s += ", Max Retries";
- return s;
-}
-
-static std::string rx_status2s(unsigned stat)
-{
- std::string s;
-
- if (stat)
- s += "Rx";
- if (stat & CEC_RX_STATUS_OK)
- s += ", OK";
- if (stat & CEC_RX_STATUS_TIMEOUT)
- s += ", Timeout";
- if (stat & CEC_RX_STATUS_FEATURE_ABORT)
- s += ", Feature Abort";
- return s;
-}
-
-std::string status2s(const struct cec_msg &msg)
-{
- std::string s;
-
- if (msg.tx_status)
- s = tx_status2s(msg);
- if (msg.rx_status) {
- if (!s.empty())
- s += ", ";
- s += rx_status2s(msg.rx_status);
- }
- return s;
-}
-
const char *power_status2s(__u8 power_status)
{
switch (power_status) {

Privacy Policy