Skip to contentSkip to conversation

cec-ctl/compliance: support new HPD_PRESENT feature

PATCH New Hans Verkuil 1 participant 1 message Nov 5 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cec-ctl/compliance: support new HPD_PRESENT feature

Support the new CAP, LOG_ADDRS and EVENT flags signaling the presence of the HPD.

---
The patch add support to v4l-utils for the new HPD_PRESENT CEC feature from this patch series:

https://patchwork.linuxtv.org/project/linux-media/list/?series=33337

---
 utils/cec-compliance/cec-test-adapter.cpp |  3 ++-
 utils/cec-ctl/cec-ctl.cpp                 | 12 ++++++++----
 utils/libcecutil/cec-info.cpp             |  4 ++++
 3 files changed, 14 insertions(+), 5 deletions(-)
utils/cec-compliance/cec-test-adapter.cpp +2 -1
index eb00d6ac..af76cf5e 100644
@@ -74,7 +74,8 @@ static int testDQEvent(struct node *node)
 	memset(&ev, 0xff, sizeof(ev));
 	fail_on_test(doioctl(node, CEC_DQEVENT, &ev));
 	fail_on_test(!(ev.flags & CEC_EVENT_FL_INITIAL_STATE));
-	fail_on_test(ev.flags & ~CEC_EVENT_FL_INITIAL_STATE);
+	fail_on_test(ev.flags & ~(CEC_EVENT_FL_INITIAL_STATE |
+				  CEC_EVENT_FL_STATE_HPD_PRESENT));
 	fail_on_test(ev.ts == 0 || ev.ts == ~0ULL);
 	fail_on_test(ev.event != CEC_EVENT_STATE_CHANGE);
 	fail_on_test(ev.state_change.log_addr_mask == 0xffff);
utils/cec-ctl/cec-ctl.cpp +8 -4
index 82094665..05e09444 100644
@@ -511,6 +511,8 @@ static void log_event(struct cec_event &ev, bool show, bool pin_logging = false)
 {
 	bool is_high = ev.event == CEC_EVENT_PIN_CEC_HIGH;
 	bool is_initial = ev.flags & CEC_EVENT_FL_INITIAL_STATE;
+	const char *edid = (ev.flags & CEC_EVENT_FL_STATE_HPD_PRESENT) ?
+		", HPD: Present" : "";
 	__u16 pa;
 
 	if (ev.event != CEC_EVENT_PIN_CEC_LOW && ev.event != CEC_EVENT_PIN_CEC_HIGH &&
@@ -535,13 +537,15 @@ static void log_event(struct cec_event &ev, bool show, bool pin_logging = false)
 	case CEC_EVENT_STATE_CHANGE:
 		pa = ev.state_change.phys_addr;
 		if (show && pin_logging)
-			printf("Event: State Change: PA: %x.%x.%x.%x, LA mask: 0x%04x\n",
-			       cec_phys_addr_exp(pa), ev.state_change.log_addr_mask);
+			printf("Event: State Change: PA: %x.%x.%x.%x, LA mask: 0x%04x%s\n",
+			       cec_phys_addr_exp(pa), ev.state_change.log_addr_mask,
+			       edid);
 		else if (show)
-			printf("Event: State Change: PA: %x.%x.%x.%x, LA mask: 0x%04x, Conn Info: %s\n",
+			printf("Event: State Change: PA: %x.%x.%x.%x, LA mask: 0x%04x, Conn Info: %s%s\n",
 			       cec_phys_addr_exp(pa),
 			       ev.state_change.log_addr_mask,
-			       ev.state_change.have_conn_info ? "yes" : "no");
+			       ev.state_change.have_conn_info ? "yes" : "no",
+			       edid);
 		break;
 	case CEC_EVENT_LOST_MSGS:
 		if (show)
utils/libcecutil/cec-info.cpp +4 -0
index 0b0d56b9..06a4d7ad 100644
@@ -66,6 +66,8 @@ static std::string caps2s(unsigned caps)
 		s += "\t\tConnector Info\n";
 	if (caps & CEC_CAP_REPLY_VENDOR_ID)
 		s += "\t\tReply Vendor ID\n";
+	if (caps & CEC_CAP_HAS_HPD_PRESENT)
+		s += "\t\tHas HPD Present\n";
 	return s;
 }
 
@@ -85,6 +87,8 @@ static std::string laflags2s(unsigned flags)
 		s += "CDC-Only, ";
 	if (flags & CEC_LOG_ADDRS_FL_CONFIG_FAILED)
 		s += "Config-Failed, ";
+	if (flags & CEC_LOG_ADDRS_FL_HPD_PRESENT)
+		s += "HPD-Present, ";
 	if (s.length() > 2)
 		s.erase(s.length() - 2, 2);
 	return s + ")";
Signature · 1 line
2.53.0