Commit 42980da2 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] cec: initiator should be the same as the destination for, poll

Poll messages that are used to allocate a logical address should
use the same initiator as the destination. Instead, it expected that
the initiator was 0xf which is not according to the standard.

This also had consequences for the message checks in cec_transmit_msg_fh
that incorrectly rejected poll messages with the same initiator and
destination.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 35879ee4
...@@ -612,8 +612,7 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, ...@@ -612,8 +612,7 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg,
} }
memset(msg->msg + msg->len, 0, sizeof(msg->msg) - msg->len); memset(msg->msg + msg->len, 0, sizeof(msg->msg) - msg->len);
if (msg->len == 1) { if (msg->len == 1) {
if (cec_msg_initiator(msg) != 0xf || if (cec_msg_destination(msg) == 0xf) {
cec_msg_destination(msg) == 0xf) {
dprintk(1, "cec_transmit_msg: invalid poll message\n"); dprintk(1, "cec_transmit_msg: invalid poll message\n");
return -EINVAL; return -EINVAL;
} }
...@@ -638,7 +637,7 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, ...@@ -638,7 +637,7 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg,
dprintk(1, "cec_transmit_msg: destination is the adapter itself\n"); dprintk(1, "cec_transmit_msg: destination is the adapter itself\n");
return -EINVAL; return -EINVAL;
} }
if (cec_msg_initiator(msg) != 0xf && if (msg->len > 1 && adap->is_configured &&
!cec_has_log_addr(adap, cec_msg_initiator(msg))) { !cec_has_log_addr(adap, cec_msg_initiator(msg))) {
dprintk(1, "cec_transmit_msg: initiator has unknown logical address %d\n", dprintk(1, "cec_transmit_msg: initiator has unknown logical address %d\n",
cec_msg_initiator(msg)); cec_msg_initiator(msg));
...@@ -1072,7 +1071,7 @@ static int cec_config_log_addr(struct cec_adapter *adap, ...@@ -1072,7 +1071,7 @@ static int cec_config_log_addr(struct cec_adapter *adap,
/* Send poll message */ /* Send poll message */
msg.len = 1; msg.len = 1;
msg.msg[0] = 0xf0 | log_addr; msg.msg[0] = (log_addr << 4) | log_addr;
err = cec_transmit_msg_fh(adap, &msg, NULL, true); err = cec_transmit_msg_fh(adap, &msg, NULL, true);
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment