aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2021-04-13 11:18:26 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2021-04-13 11:19:50 +0200
commitcd138c90d94385a816fb463d47f62b21fdc29106 (patch)
treee30c63c38cd2aee3693be0c07d9b1170808813fb
parent01f2c6c58e6f4441df7df8e27eb7919f1f01e310 (diff)
cec: improve vendor ID logging
Always log the translated vendor ID string if available. This helps debugging. Also add a new vendor ID string. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--utils/cec-compliance/cec-compliance.cpp10
-rw-r--r--utils/cec-ctl/cec-ctl.cpp15
-rwxr-xr-xutils/libcecutil/cec-gen.pl2
-rw-r--r--utils/libcecutil/cec-info.cpp73
-rw-r--r--utils/libcecutil/cec-log.cpp15
5 files changed, 74 insertions, 41 deletions
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-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index f6aa7c7d..98c06ecf 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -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);
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..22a68776 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 NULL;
}
}
@@ -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]);

Privacy Policy