aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2019-10-02 10:48:55 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2019-10-02 10:48:55 +0200
commit2bce951d7b7b23a7bb1a24f962cd843c8a988c84 (patch)
tree82e655e60eeafd97a63deb1ba55957cd3e85530e
parentca747c9fc0824a625ea4ac939ffc5e44cbb2b994 (diff)
cec utils: support CEC_ADAP_G_CONNECTOR_INFO
Add support for this new CEC ioctl. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--utils/cec-compliance/cec-compliance.cpp11
-rw-r--r--utils/cec-ctl/cec-ctl.cpp14
-rw-r--r--utils/cec-follower/cec-follower.cpp8
-rw-r--r--utils/common/cec-info.cpp18
-rw-r--r--utils/common/cec-info.h3
5 files changed, 44 insertions, 10 deletions
diff --git a/utils/cec-compliance/cec-compliance.cpp b/utils/cec-compliance/cec-compliance.cpp
index faaaa432..47ed6744 100644
--- a/utils/cec-compliance/cec-compliance.cpp
+++ b/utils/cec-compliance/cec-compliance.cpp
@@ -1359,10 +1359,15 @@ int main(int argc, char **argv)
}
- if (options[OptSkipInfo])
+ if (options[OptSkipInfo]) {
printf("\n");
- else
- cec_driver_info(caps, laddrs, node.phys_addr);
+ } else {
+ struct cec_connector_info conn_info = {};
+
+ doioctl(&node, CEC_ADAP_G_CONNECTOR_INFO, &conn_info);
+
+ cec_driver_info(caps, laddrs, node.phys_addr, conn_info);
+ }
bool missing_pa = node.phys_addr == CEC_PHYS_ADDR_INVALID && (node.caps & CEC_CAP_PHYS_ADDR);
bool missing_la = laddrs.num_log_addrs == 0 && (node.caps & CEC_CAP_LOG_ADDRS);
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index 10cba50e..0e607e12 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -951,10 +951,11 @@ static void log_event(struct cec_event &ev, bool show)
case CEC_EVENT_STATE_CHANGE:
pa = ev.state_change.phys_addr;
if (show)
- printf("Event: State Change: PA: %x.%x.%x.%x, LA mask: 0x%04x\n",
+ printf("Event: State Change: PA: %x.%x.%x.%x, LA mask: 0x%04x, Conn Info: %s\n",
pa >> 12, (pa >> 8) & 0xf,
(pa >> 4) & 0xf, pa & 0xf,
- ev.state_change.log_addr_mask);
+ ev.state_change.log_addr_mask,
+ ev.state_change.have_conn_info ? "yes" : "no");
break;
case CEC_EVENT_LOST_MSGS:
if (show)
@@ -2745,8 +2746,13 @@ int main(int argc, char **argv)
phys_addrs[la] = (phys_addr << 8) | la;
}
- if (!options[OptSkipInfo])
- cec_driver_info(caps, laddrs, phys_addr);
+ if (!options[OptSkipInfo]) {
+ struct cec_connector_info conn_info = {};
+
+ doioctl(&node, CEC_ADAP_G_CONNECTOR_INFO, &conn_info);
+
+ cec_driver_info(caps, laddrs, phys_addr, conn_info);
+ }
if (node.num_log_addrs == 0) {
if (options[OptMonitor] || options[OptMonitorAll] ||
diff --git a/utils/cec-follower/cec-follower.cpp b/utils/cec-follower/cec-follower.cpp
index 4243fdd9..789fef4a 100644
--- a/utils/cec-follower/cec-follower.cpp
+++ b/utils/cec-follower/cec-follower.cpp
@@ -443,7 +443,13 @@ int main(int argc, char **argv)
node.cec_version = laddrs.cec_version;
printf("\n");
- cec_driver_info(caps, laddrs, node.phys_addr);
+
+ struct cec_connector_info conn_info = {};
+
+ doioctl(&node, CEC_ADAP_G_CONNECTOR_INFO, &conn_info);
+
+ cec_driver_info(caps, laddrs, node.phys_addr, conn_info);
+
if (laddrs.cec_version >= CEC_OP_CEC_VERSION_2_0) {
bool is_dev_feat = false;
diff --git a/utils/common/cec-info.cpp b/utils/common/cec-info.cpp
index 31fb09fd..7db1f51c 100644
--- a/utils/common/cec-info.cpp
+++ b/utils/common/cec-info.cpp
@@ -33,6 +33,8 @@ static std::string caps2s(unsigned caps)
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;
}
@@ -360,7 +362,8 @@ 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_log_addrs &laddrs, __u16 phys_addr,
+ const struct cec_connector_info &conn_info)
{
printf("Driver Info:\n");
printf("\tDriver Name : %s\n", caps.driver);
@@ -373,6 +376,19 @@ void cec_driver_info(const struct cec_caps &caps,
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));
diff --git a/utils/common/cec-info.h b/utils/common/cec-info.h
index e979b5ab..3ad6eaf5 100644
--- a/utils/common/cec-info.h
+++ b/utils/common/cec-info.h
@@ -24,7 +24,8 @@ 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_log_addrs &laddrs, __u16 phys_addr,
+ const struct cec_connector_info &conn_info);
std::string cec_device_find(const char *driver, const char *adapter);

Privacy Policy