[1/2] cec-ctl: add support for CEC_MSG_FL_REPLY_VENDOR_ID
Commit Message
Add support for the new CEC_MSG_FL_REPLY_VENDOR_ID flag and the
new CEC_CAP_REPLY_VENDOR_ID capability.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
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(-)
@@ -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;
@@ -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;
}
@@ -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"