From 71806d6cbfad009e2b5f5b98ae75dff9eda91bf0 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 4 Oct 2018 10:16:55 +0200 Subject: cec-ctl: fix destination for non-standard messages The code that allows for changing the destination between messages broke non-standard messages (poll, vendor messages): they now always used destination 0. Fix this by moving up the code that sets the destination instead of doing setting it in just the default case. Signed-off-by: Hans Verkuil --- utils/cec-ctl/cec-ctl.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'utils') diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp index 9b289cb4..10c5b27a 100644 --- a/utils/cec-ctl/cec-ctl.cpp +++ b/utils/cec-ctl/cec-ctl.cpp @@ -1797,8 +1797,8 @@ int main(int argc, char **argv) if (ch == -1) break; - if (ch > OptMessages || ch == OptPoll) - cec_msg_init(&msg, 0, 0); + cec_msg_init(&msg, 0, 0); + msg.msg[0] = cec_msg_is_broadcast(&msg) ? 0xf : (options[OptTo] ? to : 0xf0); options[(int)ch] = 1; switch (ch) { @@ -2135,7 +2135,6 @@ int main(int argc, char **argv) break; opt = opt2message[ch - OptMessages]; parse_msg_args(msg, reply, opt, ch); - msg.msg[0] = cec_msg_is_broadcast(&msg) ? 0xf : (options[OptTo] ? to : 0xf0); msgs.push_back(msg); break; } -- cgit v1.2.1