v4l-utils: add support for CEC_MSG_FL_REPLY_VENDOR_ID
cover v4l-utils: add support for CEC_MSG_FL_REPLY_VENDOR_ID
This relies on the uAPI CEC changes from (1).
It adds support for the new flag to cec-ctl and corresponding compliance tests to cec-compliance.
Regards,
Hans
(1): https://lore.kernel.org/linux-media/[email protected]/T/#m3dbb0e6242db004eb827d17012635be4cf83644f
Hans Verkuil (2):
cec-ctl: add support for CEC_MSG_FL_REPLY_VENDOR_ID
cec-compliance: add tests for CEC_MSG_FL_REPLY_VENDOR_ID
utils/cec-compliance/cec-compliance.cpp | 2 + utils/cec-compliance/cec-compliance.h | 2 + utils/cec-compliance/cec-test-adapter.cpp | 90 ++++++++++++++++++++++- utils/cec-ctl/cec-ctl.cpp | 9 ++- utils/libcecutil/cec-info.cpp | 2 + utils/libcecutil/cec-parse.cpp | 2 +- 6 files changed, 103 insertions(+), 4 deletions(-)
Signature · 1 line
2.43.0
PATCH 1/2 cec-ctl: add support for CEC_MSG_FL_REPLY_VENDOR_ID
Add support for the new CEC_MSG_FL_REPLY_VENDOR_ID flag and the new CEC_CAP_REPLY_VENDOR_ID capability.
--- utils/cec-ctl/cec-ctl.cpp | 9 +++++++-- utils/libcecutil/cec-info.cpp | 2 ++ utils/libcecutil/cec-parse.cpp | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-)
utils/cec-ctl/cec-ctl.cpp +7 -2
@@ -2609,6 +2609,7 @@ int main(int argc, char **argv) case OptVendorCommandWithID: { static constexpr const char *arg_names[] = { "vendor-id", + "reply", "cmd", nullptr };
@@ -2623,6 +2624,10 @@ int main(int argc, char **argv) vendor_id = strtol(value, nullptr, 0); break; case 1: + msg.reply = strtol(value, &endptr, 0L); + msg.flags = CEC_MSG_FL_REPLY_VENDOR_ID; + break; + case 2: while (size < sizeof(bytes)) { bytes[size++] = strtol(value, &endptr, 0L); if (endptr == value) {
@@ -3164,9 +3169,9 @@ int main(int argc, char **argv) to = msg.msg[0] & 0xf; printf("\nTransmit from %s to %s (%d to %d):\n", cec_la2s(from), to == 0xf ? "all" : cec_la2s(to), from, to); - msg.flags = options[OptReplyToFollowers] ? CEC_MSG_FL_REPLY_TO_FOLLOWERS : 0; + msg.flags |= options[OptReplyToFollowers] ? CEC_MSG_FL_REPLY_TO_FOLLOWERS : 0; msg.flags |= options[OptRawMsg] ? CEC_MSG_FL_RAW : 0; - msg.timeout = msg.reply ? timeout : 0; + msg.timeout = (msg.flags & CEC_MSG_FL_REPLY_VENDOR_ID) || msg.reply ? timeout : 0; cec_log_msg(&msg); if (doioctl(&node, CEC_TRANSMIT, &msg)) continue;
utils/libcecutil/cec-info.cpp +2 -0
@@ -64,6 +64,8 @@ static std::string caps2s(unsigned caps) s += "\t\tMonitor Pin\n"; if (caps & CEC_CAP_CONNECTOR_INFO) s += "\t\tConnector Info\n"; + if (caps & CEC_CAP_REPLY_VENDOR_ID) + s += "\t\tReply Vendor ID\n"; return s; }
utils/libcecutil/cec-parse.cpp +1 -1
@@ -208,7 +208,7 @@ static unsigned parse_latency(const char *value) #define VENDOR_EXTRA \ " --vendor-command payload=<byte>[:<byte>]*\n" \ " Send VENDOR_COMMAND message (" xstr(CEC_MSG_VENDOR_COMMAND) ")\n" \ - " --vendor-command-with-id vendor-id=<val>,cmd=<byte>[:<byte>]*\n" \ + " --vendor-command-with-id vendor-id=<val>,[reply=<reply>,]cmd=<byte>[:<byte>]*\n" \ " Send VENDOR_COMMAND_WITH_ID message (" xstr(CEC_MSG_VENDOR_COMMAND_WITH_ID) ")\n" \ " --vendor-remote-button-down rc-code=<byte>[:<byte>]*\n" \ " Send VENDOR_REMOTE_BUTTON_DOWN message (" xstr(CEC_MSG_VENDOR_REMOTE_BUTTON_DOWN) ")\n"
Signature · 1 line
2.43.0
PATCH 2/2 cec-compliance: add tests for CEC_MSG_FL_REPLY_VENDOR_ID
In reply to Hans VerkuilWhile some simple generic checks are possible, most of the tests are only performed if the CEC driver is 'vivid', since that has a well defined <Vendor Command With ID> implementation, specifically created to regression test this flag.
--- utils/cec-compliance/cec-compliance.cpp | 2 + utils/cec-compliance/cec-compliance.h | 2 + utils/cec-compliance/cec-test-adapter.cpp | 90 ++++++++++++++++++++++- 3 files changed, 93 insertions(+), 1 deletion(-)
utils/cec-compliance/cec-compliance.cpp +2 -0
@@ -1072,6 +1072,7 @@ int main(int argc, char **argv) doioctl(&node, CEC_ADAP_G_CAPS, &caps); node.caps = caps.capabilities; node.available_log_addrs = caps.available_log_addrs; + node.is_vivid = !strcmp(caps.driver, "vivid"); if (options[OptTestAudioRateControl]) test_tags |= TAG_AUDIO_RATE_CONTROL;
@@ -1169,6 +1170,7 @@ int main(int argc, char **argv) struct cec_log_addrs laddrs = { }; doioctl(&node, CEC_ADAP_G_LOG_ADDRS, &laddrs); + node.vendor_id = laddrs.vendor_id; if (node.phys_addr == CEC_PHYS_ADDR_INVALID && !(node.caps & (CEC_CAP_PHYS_ADDR | CEC_CAP_NEEDS_HPD)) &&
utils/cec-compliance/cec-compliance.h +2 -0
@@ -151,6 +151,7 @@ struct remote {struct node {int fd;const char *device; +bool is_vivid;bool has_cec20;unsigned caps;unsigned available_log_addrs;
@@ -160,6 +161,7 @@ struct node {unsigned remote_la_mask;struct remote remote[16 ];__u16 phys_addr; +__u32 vendor_id;bool in_standby;__u8 prim_devtype;time_t current_time;
utils/cec-compliance/cec-test-adapter.cpp +89 -1
114 lines not on this page · raw message
Signature · 1 line
2.43.0