aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2019-10-02 17:23:23 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2019-10-03 09:47:03 +0200
commit84386e3387185b3c2fc59f200b40c4e0c6614244 (patch)
tree2dfbae2b8e73fd17acfc324156801db46f9853f7
parent25122c77b5e0909bf579f5f61654feaa92ca3a24 (diff)
utils/common/cec*: remove unused cec files
All CEC utilities are now using the new cec utilities library, so these files are no longer used and can be removed. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--utils/common/cec-info.cpp496
-rw-r--r--utils/common/cec-info.h32
-rw-r--r--utils/common/cec-log.cpp344
-rw-r--r--utils/common/cec-log.h13
4 files changed, 0 insertions, 885 deletions
diff --git a/utils/common/cec-info.cpp b/utils/common/cec-info.cpp
deleted file mode 100644
index 7db1f51c..00000000
--- a/utils/common/cec-info.cpp
+++ /dev/null
@@ -1,496 +0,0 @@
-// SPDX-License-Identifier: LGPL-2.1-only
-/*
- * CEC common helper functions
- *
- * Copyright 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
- */
-
-#include <stdio.h>
-#include <string>
-#include <unistd.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <sys/ioctl.h>
-#include <cec-info.h>
-
-static std::string caps2s(unsigned caps)
-{
- std::string s;
-
- if (caps & CEC_CAP_PHYS_ADDR)
- s += "\t\tPhysical Address\n";
- if (caps & CEC_CAP_LOG_ADDRS)
- s += "\t\tLogical Addresses\n";
- if (caps & CEC_CAP_TRANSMIT)
- s += "\t\tTransmit\n";
- if (caps & CEC_CAP_PASSTHROUGH)
- s += "\t\tPassthrough\n";
- if (caps & CEC_CAP_RC)
- s += "\t\tRemote Control Support\n";
- if (caps & CEC_CAP_MONITOR_ALL)
- s += "\t\tMonitor All\n";
- if (caps & CEC_CAP_NEEDS_HPD)
- s += "\t\tNeeds HPD\n";
- if (caps & CEC_CAP_MONITOR_PIN)
- s += "\t\tMonitor Pin\n";
- if (caps & CEC_CAP_CONNECTOR_INFO)
- s += "\t\tConnector Info\n";
- return s;
-}
-
-static std::string laflags2s(unsigned flags)
-{
- std::string s;
-
- if (!flags)
- return s;
-
- s = "(";
- if (flags & CEC_LOG_ADDRS_FL_ALLOW_UNREG_FALLBACK)
- s += "Allow Fallback to Unregistered, ";
- if (flags & CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU)
- s += "Allow RC Passthrough, ";
- if (flags & CEC_LOG_ADDRS_FL_CDC_ONLY)
- s += "CDC-Only, ";
- if (s.length())
- s.erase(s.length() - 2, 2);
- return s + ")";
-}
-
-const char *version2s(unsigned version)
-{
- switch (version) {
- case CEC_OP_CEC_VERSION_1_3A:
- return "1.3a";
- case CEC_OP_CEC_VERSION_1_4:
- return "1.4";
- case CEC_OP_CEC_VERSION_2_0:
- return "2.0";
- default:
- return "Unknown";
- }
-}
-
-/*
- * Most of these vendor IDs come from include/cectypes.h from libcec.
- */
-const char *vendor2s(unsigned vendor)
-{
- switch (vendor) {
- case 0x000039:
- case 0x000ce7:
- return "(Toshiba)";
- case 0x0000f0:
- return "(Samsung)";
- case 0x0005cd:
- return "(Denon)";
- case 0x000678:
- return "(Marantz)";
- case 0x000982:
- return "(Loewe)";
- case 0x0009b0:
- return "(Onkyo)";
- case 0x000c03:
- return "(HDMI)";
- case 0x001582:
- return "(Pulse-Eight)";
- case 0x001950:
- case 0x9c645e:
- return "(Harman Kardon)";
- case 0x001a11:
- return "(Google)";
- case 0x0020c7:
- return "(Akai)";
- case 0x002467:
- return "(AOC)";
- case 0x005060:
- return "(Cisco)";
- case 0x008045:
- return "(Panasonic)";
- case 0x00903e:
- return "(Philips)";
- case 0x009053:
- return "(Daewoo)";
- case 0x00a0de:
- return "(Yamaha)";
- case 0x00d0d5:
- return "(Grundig)";
- case 0x00d38d:
- return "(Hospitality Profile)";
- case 0x00e036:
- return "(Pioneer)";
- case 0x00e091:
- return "(LG)";
- case 0x08001f:
- case 0x534850:
- return "(Sharp)";
- case 0x080046:
- return "(Sony)";
- case 0x18c086:
- return "(Broadcom)";
- case 0x5cad76:
- return "(TCL)";
- case 0x6b746d:
- return "(Vizio)";
- case 0x743a65:
- return "(NEC)";
- case 0x8065e9:
- return "(Benq)";
- default:
- return "";
- }
-}
-
-const char *prim_type2s(unsigned type)
-{
- switch (type) {
- case CEC_OP_PRIM_DEVTYPE_TV:
- return "TV";
- case CEC_OP_PRIM_DEVTYPE_RECORD:
- return "Record";
- case CEC_OP_PRIM_DEVTYPE_TUNER:
- return "Tuner";
- case CEC_OP_PRIM_DEVTYPE_PLAYBACK:
- return "Playback";
- case CEC_OP_PRIM_DEVTYPE_AUDIOSYSTEM:
- return "Audio System";
- case CEC_OP_PRIM_DEVTYPE_SWITCH:
- return "Switch";
- case CEC_OP_PRIM_DEVTYPE_PROCESSOR:
- return "Processor";
- default:
- return "Unknown";
- }
-}
-
-const char *la_type2s(unsigned type)
-{
- switch (type) {
- case CEC_LOG_ADDR_TYPE_TV:
- return "TV";
- case CEC_LOG_ADDR_TYPE_RECORD:
- return "Record";
- case CEC_LOG_ADDR_TYPE_TUNER:
- return "Tuner";
- case CEC_LOG_ADDR_TYPE_PLAYBACK:
- return "Playback";
- case CEC_LOG_ADDR_TYPE_AUDIOSYSTEM:
- return "Audio System";
- case CEC_LOG_ADDR_TYPE_SPECIFIC:
- return "Specific";
- case CEC_LOG_ADDR_TYPE_UNREGISTERED:
- return "Unregistered";
- default:
- return "Unknown";
- }
-}
-
-const char *la2s(unsigned la)
-{
- switch (la & 0xf) {
- case 0:
- return "TV";
- case 1:
- return "Recording Device 1";
- case 2:
- return "Recording Device 2";
- case 3:
- return "Tuner 1";
- case 4:
- return "Playback Device 1";
- case 5:
- return "Audio System";
- case 6:
- return "Tuner 2";
- case 7:
- return "Tuner 3";
- case 8:
- return "Playback Device 2";
- case 9:
- return "Recording Device 3";
- case 10:
- return "Tuner 4";
- case 11:
- return "Playback Device 3";
- case 12:
- return "Reserved 1";
- case 13:
- return "Reserved 2";
- case 14:
- return "Specific";
- case 15:
- default:
- return "Unregistered";
- }
-}
-
-std::string all_dev_types2s(unsigned types)
-{
- std::string s;
-
- if (types & CEC_OP_ALL_DEVTYPE_TV)
- s += "TV, ";
- if (types & CEC_OP_ALL_DEVTYPE_RECORD)
- s += "Record, ";
- if (types & CEC_OP_ALL_DEVTYPE_TUNER)
- s += "Tuner, ";
- if (types & CEC_OP_ALL_DEVTYPE_PLAYBACK)
- s += "Playback, ";
- if (types & CEC_OP_ALL_DEVTYPE_AUDIOSYSTEM)
- s += "Audio System, ";
- if (types & CEC_OP_ALL_DEVTYPE_SWITCH)
- s += "Switch, ";
- if (s.length())
- return s.erase(s.length() - 2, 2);
- return s;
-}
-
-std::string rc_src_prof2s(unsigned prof, const std::string &prefix)
-{
- std::string s;
-
- prof &= 0x1f;
- if (prof == 0)
- return prefix + "\t\tNone\n";
- if (prof & CEC_OP_FEAT_RC_SRC_HAS_DEV_ROOT_MENU)
- s += prefix + "\t\tSource Has Device Root Menu\n";
- if (prof & CEC_OP_FEAT_RC_SRC_HAS_DEV_SETUP_MENU)
- s += prefix + "\t\tSource Has Device Setup Menu\n";
- if (prof & CEC_OP_FEAT_RC_SRC_HAS_MEDIA_CONTEXT_MENU)
- s += prefix + "\t\tSource Has Contents Menu\n";
- if (prof & CEC_OP_FEAT_RC_SRC_HAS_MEDIA_TOP_MENU)
- s += prefix + "\t\tSource Has Media Top Menu\n";
- if (prof & CEC_OP_FEAT_RC_SRC_HAS_MEDIA_CONTEXT_MENU)
- s += prefix + "\t\tSource Has Media Context-Sensitive Menu\n";
- return s;
-}
-
-std::string dev_feat2s(unsigned feat, const std::string &prefix)
-{
- std::string s;
-
- feat &= 0x7e;
- if (feat == 0)
- return prefix + "\t\tNone\n";
- if (feat & CEC_OP_FEAT_DEV_HAS_RECORD_TV_SCREEN)
- s += prefix + "\t\tTV Supports <Record TV Screen>\n";
- if (feat & CEC_OP_FEAT_DEV_HAS_SET_OSD_STRING)
- s += prefix + "\t\tTV Supports <Set OSD String>\n";
- if (feat & CEC_OP_FEAT_DEV_HAS_DECK_CONTROL)
- s += prefix + "\t\tSupports Deck Control\n";
- if (feat & CEC_OP_FEAT_DEV_HAS_SET_AUDIO_RATE)
- s += prefix + "\t\tSource Supports <Set Audio Rate>\n";
- if (feat & CEC_OP_FEAT_DEV_SINK_HAS_ARC_TX)
- s += prefix + "\t\tSink Supports ARC Tx\n";
- if (feat & CEC_OP_FEAT_DEV_SOURCE_HAS_ARC_RX)
- s += prefix + "\t\tSource Supports ARC Rx\n";
- return s;
-}
-
-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_ABORTED)
- s += ", Aborted";
- if (stat & CEC_TX_STATUS_TIMEOUT)
- s += ", Timeout";
- 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";
- if (stat & CEC_RX_STATUS_ABORTED)
- s += ", Aborted";
- 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;
-}
-
-void cec_driver_info(const struct cec_caps &caps,
- const struct cec_log_addrs &laddrs, __u16 phys_addr,
- const struct cec_connector_info &conn_info)
-{
- printf("Driver Info:\n");
- printf("\tDriver Name : %s\n", caps.driver);
- printf("\tAdapter Name : %s\n", caps.name);
- printf("\tCapabilities : 0x%08x\n", caps.capabilities);
- printf("%s", caps2s(caps.capabilities).c_str());
- printf("\tDriver version : %d.%d.%d\n",
- caps.version >> 16,
- (caps.version >> 8) & 0xff,
- caps.version & 0xff);
- printf("\tAvailable Logical Addresses: %u\n",
- caps.available_log_addrs);
- switch (conn_info.type) {
- case CEC_CONNECTOR_TYPE_NO_CONNECTOR:
- printf("\tConnector Info : None\n");
- break;
- case CEC_CONNECTOR_TYPE_DRM:
- printf("\tDRM Connector Info : card %u, connector %u\n",
- conn_info.drm.card_no, conn_info.drm.connector_id);
- break;
- default:
- printf("\tConnector Info : Type %u\n",
- conn_info.type);
- break;
- }
-
- printf("\tPhysical Address : %x.%x.%x.%x\n",
- cec_phys_addr_exp(phys_addr));
- printf("\tLogical Address Mask : 0x%04x\n", laddrs.log_addr_mask);
- printf("\tCEC Version : %s\n", version2s(laddrs.cec_version));
- if (laddrs.vendor_id != CEC_VENDOR_ID_NONE)
- printf("\tVendor ID : 0x%06x %s\n",
- laddrs.vendor_id, vendor2s(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());
- for (unsigned i = 0; i < laddrs.num_log_addrs; i++) {
- if (laddrs.log_addr[i] == CEC_LOG_ADDR_INVALID)
- printf("\n\t Logical Address : Not Allocated\n");
- else
- printf("\n\t Logical Address : %d (%s)\n",
- laddrs.log_addr[i], la2s(laddrs.log_addr[i]));
- printf("\t Primary Device Type : %s\n",
- prim_type2s(laddrs.primary_device_type[i]));
- printf("\t Logical Address Type : %s\n",
- la_type2s(laddrs.log_addr_type[i]));
- if (laddrs.cec_version < CEC_OP_CEC_VERSION_2_0)
- continue;
- printf("\t All Device Types : %s\n",
- all_dev_types2s(laddrs.all_device_types[i]).c_str());
-
- bool is_dev_feat = false;
- for (unsigned idx = 0; idx < sizeof(laddrs.features[0]); idx++) {
- __u8 byte = laddrs.features[i][idx];
-
- if (!is_dev_feat) {
- if (byte & 0x40) {
- printf("\t RC Source Profile :\n%s",
- rc_src_prof2s(byte, "").c_str());
- } else {
- const char *s = "Reserved";
-
- switch (byte & 0xf) {
- case 0:
- s = "None";
- break;
- case 2:
- s = "RC Profile 1";
- break;
- case 6:
- s = "RC Profile 2";
- break;
- case 10:
- s = "RC Profile 3";
- break;
- case 14:
- s = "RC Profile 4";
- break;
- }
- printf("\t RC TV Profile : %s\n", s);
- }
- } else {
- printf("\t Device Features :\n%s",
- dev_feat2s(byte, "").c_str());
- }
- if (byte & CEC_OP_FEAT_EXT)
- continue;
- if (!is_dev_feat)
- is_dev_feat = true;
- else
- break;
- }
- }
-}
-
-std::string cec_device_find(const char *driver, const char *adapter)
-{
- DIR *dp;
- struct dirent *ep;
- std::string name;
-
- dp = opendir("/dev");
- if (dp == NULL) {
- perror("Couldn't open the directory");
- return name;
- }
- while ((ep = readdir(dp)))
- if (!memcmp(ep->d_name, "cec", 3) && isdigit(ep->d_name[3])) {
- std::string devname("/dev/");
- struct cec_caps caps;
- int fd;
-
- devname += ep->d_name;
- fd = open(devname.c_str(), O_RDWR);
-
- if (fd < 0)
- continue;
- int err = ioctl(fd, CEC_ADAP_G_CAPS, &caps);
- close(fd);
- if (err)
- continue;
- if ((!driver || !strcmp(driver, caps.driver)) &&
- (!adapter || !strcmp(adapter, caps.name))) {
- name = devname;
- break;
- }
- }
- closedir(dp);
- return name;
-}
diff --git a/utils/common/cec-info.h b/utils/common/cec-info.h
deleted file mode 100644
index 3ad6eaf5..00000000
--- a/utils/common/cec-info.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* SPDX-License-Identifier: LGPL-2.1-only */
-/*
- * CEC common helper functions
- *
- * Copyright 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
- */
-
-#ifndef _CEC_INFO_H_
-#define _CEC_INFO_H_
-
-#include <linux/cec.h>
-
-#define cec_phys_addr_exp(pa) \
- ((pa) >> 12), ((pa) >> 8) & 0xf, ((pa) >> 4) & 0xf, (pa) & 0xf
-
-const char *la2s(unsigned la);
-const char *la_type2s(unsigned type);
-const char *prim_type2s(unsigned type);
-const char *version2s(unsigned version);
-const char *vendor2s(unsigned vendor);
-std::string all_dev_types2s(unsigned types);
-std::string rc_src_prof2s(unsigned prof, const std::string &prefix);
-std::string dev_feat2s(unsigned feat, const std::string &prefix);
-std::string status2s(const struct cec_msg &msg);
-
-void cec_driver_info(const struct cec_caps &caps,
- const struct cec_log_addrs &laddrs, __u16 phys_addr,
- const struct cec_connector_info &conn_info);
-
-std::string cec_device_find(const char *driver, const char *adapter);
-
-#endif
diff --git a/utils/common/cec-log.cpp b/utils/common/cec-log.cpp
deleted file mode 100644
index 850fc58c..00000000
--- a/utils/common/cec-log.cpp
+++ /dev/null
@@ -1,344 +0,0 @@
-// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
-/*
- * Copyright 2016 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
- */
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <inttypes.h>
-#include <stdarg.h>
-#include <string>
-#include <linux/cec-funcs.h>
-#include "cec-htng-funcs.h"
-#include "cec-info.h"
-#include "../common/cec-log.h"
-
-#define CEC_MAX_ARGS 16
-
-#define xstr(s) str(s)
-#define str(s) #s
-
-struct cec_enum_values {
- const char *type_name;
- __u8 value;
-};
-
-enum cec_types {
- CEC_TYPE_U8,
- CEC_TYPE_U16,
- CEC_TYPE_U32,
- CEC_TYPE_STRING,
- CEC_TYPE_ENUM,
-};
-
-struct arg {
- enum cec_types type;
- __u8 num_enum_values;
- const struct cec_enum_values *values;
-};
-
-static const struct arg arg_u8 = {
- CEC_TYPE_U8,
-};
-
-static const struct arg arg_u16 = {
- CEC_TYPE_U16,
-};
-
-static const struct arg arg_u32 = {
- CEC_TYPE_U32,
-};
-
-static const struct arg arg_string = {
- CEC_TYPE_STRING,
-};
-
-struct message {
- __u8 msg;
- __u8 num_args;
- const char *arg_names[CEC_MAX_ARGS+1];
- const struct arg *args[CEC_MAX_ARGS];
- const char *msg_name;
-};
-
-static void log_arg(const struct arg *arg, const char *arg_name, __u32 val)
-{
- unsigned i;
-
- switch (arg->type) {
- case CEC_TYPE_ENUM:
- for (i = 0; i < arg->num_enum_values; i++) {
- if (arg->values[i].value == val) {
- printf("\t%s: %s (0x%02x)\n", arg_name,
- arg->values[i].type_name, val);
- return;
- }
- }
- /* fall through */
- case CEC_TYPE_U8:
- printf("\t%s: %u (0x%02x)\n", arg_name, val, val);
- return;
- case CEC_TYPE_U16:
- if (strstr(arg_name, "phys-addr"))
- printf("\t%s: %x.%x.%x.%x\n", arg_name,
- val >> 12, (val >> 8) & 0xf, (val >> 4) & 0xf, val & 0xf);
- else
- printf("\t%s: %u (0x%04x)\n", arg_name, val, val);
- return;
- case CEC_TYPE_U32:
- printf("\t%s: %u (0x%08x)\n", arg_name, val, val);
- return;
- default:
- break;
- }
- printf("\t%s: unknown type\n", arg_name);
-}
-
-static void log_arg(const struct arg *arg, const char *arg_name,
- const char *s)
-{
- switch (arg->type) {
- case CEC_TYPE_STRING:
- printf("\t%s: %s\n", arg_name, s);
- return;
- default:
- break;
- }
- printf("\t%s: unknown type\n", arg_name);
-}
-
-static const struct cec_enum_values type_rec_src_type[] = {
- { "own", CEC_OP_RECORD_SRC_OWN },
- { "digital", CEC_OP_RECORD_SRC_DIGITAL },
- { "analog", CEC_OP_RECORD_SRC_ANALOG },
- { "ext-plug", CEC_OP_RECORD_SRC_EXT_PLUG },
- { "ext-phys-addr", CEC_OP_RECORD_SRC_EXT_PHYS_ADDR },
-};
-
-static const struct arg arg_rec_src_type = {
- CEC_TYPE_ENUM, 5, type_rec_src_type
-};
-
-static void log_digital(const char *arg_name, const struct cec_op_digital_service_id *digital);
-static void log_rec_src(const char *arg_name, const struct cec_op_record_src *rec_src);
-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 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_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);
-static void log_htng_unknown_msg(const struct cec_msg *msg);
-
-#include "cec-log-gen.h"
-
-static void log_digital(const char *arg_name, const struct cec_op_digital_service_id *digital)
-{
- log_arg(&arg_service_id_method, "service-id-method", digital->service_id_method);
- log_arg(&arg_dig_bcast_system, "dig-bcast-system", digital->dig_bcast_system);
- if (digital->service_id_method == CEC_OP_SERVICE_ID_METHOD_BY_CHANNEL) {
- log_arg(&arg_channel_number_fmt, "channel-number-fmt", digital->channel.channel_number_fmt);
- log_arg(&arg_u16, "major", digital->channel.major);
- log_arg(&arg_u16, "minor", digital->channel.minor);
- return;
- }
-
- switch (digital->dig_bcast_system) {
- case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_GEN:
- case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_CABLE:
- case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_SAT:
- case CEC_OP_DIG_SERVICE_BCAST_SYSTEM_ATSC_T:
- log_arg(&arg_u16, "transport-id", digital->atsc.transport_id);
- log_arg(&arg_u16, "program-number", digital->atsc.program_number);
- break;
- default:
- log_arg(&arg_u16, "transport-id", digital->dvb.transport_id);
- log_arg(&arg_u16, "service-id", digital->dvb.service_id);
- log_arg(&arg_u16, "orig-network-id", digital->dvb.orig_network_id);
- break;
- }
-}
-
-static void log_rec_src(const char *arg_name, const struct cec_op_record_src *rec_src)
-{
- log_arg(&arg_rec_src_type, "rec-src-type", rec_src->type);
- switch (rec_src->type) {
- case CEC_OP_RECORD_SRC_OWN:
- default:
- break;
- case CEC_OP_RECORD_SRC_DIGITAL:
- log_digital(arg_name, &rec_src->digital);
- break;
- case CEC_OP_RECORD_SRC_ANALOG:
- log_arg(&arg_ana_bcast_type, "ana-bcast-type", rec_src->analog.ana_bcast_type);
- log_arg(&arg_u16, "ana-freq", rec_src->analog.ana_freq);
- log_arg(&arg_bcast_system, "bcast-system", rec_src->analog.bcast_system);
- break;
- case CEC_OP_RECORD_SRC_EXT_PLUG:
- log_arg(&arg_u8, "plug", rec_src->ext_plug.plug);
- break;
- case CEC_OP_RECORD_SRC_EXT_PHYS_ADDR:
- log_arg(&arg_u16, "phys-addr", rec_src->ext_phys_addr.phys_addr);
- break;
- }
-}
-
-static void log_tuner_dev_info(const char *arg_name, const struct cec_op_tuner_device_info *tuner_dev_info)
-{
- log_arg(&arg_rec_flag, "rec-flag", tuner_dev_info->rec_flag);
- log_arg(&arg_tuner_display_info, "tuner-display-info", tuner_dev_info->tuner_display_info);
- if (tuner_dev_info->is_analog) {
- log_arg(&arg_ana_bcast_type, "ana-bcast-type", tuner_dev_info->analog.ana_bcast_type);
- log_arg(&arg_u16, "ana-freq", tuner_dev_info->analog.ana_freq);
- log_arg(&arg_bcast_system, "bcast-system", tuner_dev_info->analog.bcast_system);
- } else {
- log_digital(arg_name, &tuner_dev_info->digital);
- }
-}
-
-static void log_features(const struct arg *arg,
- const char *arg_name, const __u8 *p)
-{
- do {
- log_arg(arg, arg_name, (__u32)((*p) & ~CEC_OP_FEAT_EXT));
- } while ((*p++) & CEC_OP_FEAT_EXT);
-}
-
-static void log_ui_command(const char *arg_name,
- const struct cec_op_ui_command *ui_cmd)
-{
- log_arg(&arg_ui_cmd, arg_name, ui_cmd->ui_cmd);
- if (!ui_cmd->has_opt_arg)
- return;
- switch (ui_cmd->ui_cmd) {
- case CEC_OP_UI_CMD_SELECT_BROADCAST_TYPE:
- log_arg(&arg_ui_bcast_type, "ui-broadcast-type",
- ui_cmd->ui_broadcast_type);
- break;
- case CEC_OP_UI_CMD_SELECT_SOUND_PRESENTATION:
- log_arg(&arg_ui_snd_pres_ctl, "ui-sound-presentation-control",
- ui_cmd->ui_sound_presentation_control);
- break;
- case CEC_OP_UI_CMD_PLAY_FUNCTION:
- log_arg(&arg_u8, "play-mode", ui_cmd->play_mode);
- break;
- case CEC_OP_UI_CMD_TUNE_FUNCTION:
- log_arg(&arg_channel_number_fmt, "channel-number-fmt",
- ui_cmd->channel_identifier.channel_number_fmt);
- log_arg(&arg_u16, "major", ui_cmd->channel_identifier.major);
- log_arg(&arg_u16, "minor", ui_cmd->channel_identifier.minor);
- break;
- case CEC_OP_UI_CMD_SELECT_MEDIA_FUNCTION:
- log_arg(&arg_u8, "ui-function-media", ui_cmd->ui_function_media);
- break;
- case CEC_OP_UI_CMD_SELECT_AV_INPUT_FUNCTION:
- log_arg(&arg_u8, "ui-function-select-av-input", ui_cmd->ui_function_select_av_input);
- break;
- case CEC_OP_UI_CMD_SELECT_AUDIO_INPUT_FUNCTION:
- log_arg(&arg_u8, "ui-function-select-audio-input", ui_cmd->ui_function_select_audio_input);
- break;
- }
-}
-
-static void log_descriptors(const char *arg_name, unsigned num, const __u32 *descriptors)
-{
- for (unsigned i = 0; i < num; i++)
- log_arg(&arg_u32, arg_name, descriptors[i]);
-}
-
-static void log_u8_array(const char *arg_name, unsigned num, const __u8 *vals)
-{
- for (unsigned i = 0; i < num; i++)
- log_arg(&arg_u8, arg_name, vals[i]);
-}
-
-static void log_htng_unknown_msg(const struct cec_msg *msg)
-{
- __u32 vendor_id;
- const __u8 *bytes;
- __u8 size;
- unsigned i;
-
- cec_ops_vendor_command_with_id(msg, &vendor_id, &size, &bytes);
- printf("CEC_MSG_VENDOR_COMMAND_WITH_ID (0x%02x):\n",
- CEC_MSG_VENDOR_COMMAND_WITH_ID);
- log_arg(&arg_vendor_id, "vendor-id", vendor_id);
- printf("\tvendor-specific-data:");
- for (i = 0; i < size; i++)
- printf(" 0x%02x", bytes[i]);
- printf("\n");
-}
-
-static void log_unknown_msg(const struct cec_msg *msg)
-{
- __u32 vendor_id;
- __u16 phys_addr;
- const __u8 *bytes;
- __u8 size;
- unsigned i;
-
- switch (msg->msg[1]) {
- case CEC_MSG_VENDOR_COMMAND:
- printf("CEC_MSG_VENDOR_COMMAND (0x%02x):\n",
- CEC_MSG_VENDOR_COMMAND);
- cec_ops_vendor_command(msg, &size, &bytes);
- printf("\tvendor-specific-data:");
- for (i = 0; i < size; i++)
- printf(" 0x%02x", bytes[i]);
- printf("\n");
- break;
- case CEC_MSG_VENDOR_COMMAND_WITH_ID:
- cec_ops_vendor_command_with_id(msg, &vendor_id, &size, &bytes);
- switch (vendor_id) {
- case VENDOR_ID_HTNG:
- log_htng_msg(msg);
- break;
- default:
- printf("CEC_MSG_VENDOR_COMMAND_WITH_ID (0x%02x):\n",
- CEC_MSG_VENDOR_COMMAND_WITH_ID);
- log_arg(&arg_vendor_id, "vendor-id", vendor_id);
- printf("\tvendor-specific-data:");
- for (i = 0; i < size; i++)
- printf(" 0x%02x", bytes[i]);
- printf("\n");
- break;
- }
- break;
- case CEC_MSG_VENDOR_REMOTE_BUTTON_DOWN:
- printf("CEC_MSG_VENDOR_REMOTE_BUTTON_DOWN (0x%02x):\n",
- CEC_MSG_VENDOR_REMOTE_BUTTON_DOWN);
- cec_ops_vendor_remote_button_down(msg, &size, &bytes);
- printf("\tvendor-specific-rc-code:");
- for (i = 0; i < size; i++)
- printf(" 0x%02x", bytes[i]);
- printf("\n");
- break;
- case CEC_MSG_CDC_MESSAGE:
- phys_addr = (msg->msg[2] << 8) | msg->msg[3];
-
- printf("CEC_MSG_CDC_MESSAGE (0x%02x): 0x%02x:\n",
- CEC_MSG_CDC_MESSAGE, msg->msg[4]);
- log_arg(&arg_u16, "phys-addr", phys_addr);
- printf("\tpayload:");
- for (i = 5; i < msg->len; i++)
- printf(" 0x%02x", msg->msg[i]);
- printf("\n");
- break;
- default:
- printf("CEC_MSG (0x%02x)%s", msg->msg[1], msg->len > 2 ? ":\n\tpayload:" : "");
- for (i = 2; i < msg->len; i++)
- printf(" 0x%02x", msg->msg[i]);
- printf("\n");
- break;
- }
-}
-
-const char *ui_cmd_string(__u8 ui_cmd)
-{
- for (unsigned i = 0; i < arg_ui_cmd.num_enum_values; i++) {
- if (type_ui_cmd[i].value == ui_cmd)
- return type_ui_cmd[i].type_name;
- }
- return NULL;
-}
diff --git a/utils/common/cec-log.h b/utils/common/cec-log.h
deleted file mode 100644
index edeef6c1..00000000
--- a/utils/common/cec-log.h
+++ /dev/null
@@ -1,13 +0,0 @@
-// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
-/*
- * Copyright 2019 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
- */
-
-#ifndef _CEC_LOG_H_
-#define _CEC_LOG_H_
-
-void log_msg(const struct cec_msg *msg);
-void log_htng_msg(const struct cec_msg *msg);
-const char *ui_cmd_string(__u8 ui_cmd);
-
-#endif

Privacy Policy