[PATCH 1/2] cec-ctl: add support for CEC_MSG_FL_REPLY_VENDOR_ID

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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(-)

diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index f7ba7409..eec16377 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -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;
diff --git a/utils/libcecutil/cec-info.cpp b/utils/libcecutil/cec-info.cpp
index dce7effd..bc2a0ca6 100644
--- a/utils/libcecutil/cec-info.cpp
+++ b/utils/libcecutil/cec-info.cpp
@@ -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;
 }
 
diff --git a/utils/libcecutil/cec-parse.cpp b/utils/libcecutil/cec-parse.cpp
index aa703136..f78a8f8a 100644
--- a/utils/libcecutil/cec-parse.cpp
+++ b/utils/libcecutil/cec-parse.cpp
@@ -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"
-- 
2.43.0





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux