summaryrefslogtreecommitdiffstats
path: root/drivers/media/cec/cec-core.c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2017-08-07 09:31:24 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-08-20 09:59:34 -0400
commita9a249a2c997506a64eaee22f1458fda893f62a8 (patch)
treef42ca4cf769e6f42431e67348d42dd3b232df78e /drivers/media/cec/cec-core.c
parentd57ea877af38057b0ef31758cf3b99765dc33695 (diff)
downloadop-kernel-dev-a9a249a2c997506a64eaee22f1458fda893f62a8.zip
op-kernel-dev-a9a249a2c997506a64eaee22f1458fda893f62a8.tar.gz
media: cec: fix remote control passthrough
The 'Press and Hold' operation was not correctly implemented, in particular the requirement that the repeat doesn't start until the second identical keypress arrives. The REP_DELAY value also had to be adjusted (see the comment in the code) to achieve the desired behavior. The 'enabled_protocols' field was also never set, fix that too. Since CEC is a fixed protocol the driver has to set this field. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/cec/cec-core.c')
-rw-r--r--drivers/media/cec/cec-core.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/media/cec/cec-core.c b/drivers/media/cec/cec-core.c
index efb7bbb..fcd01577 100644
--- a/drivers/media/cec/cec-core.c
+++ b/drivers/media/cec/cec-core.c
@@ -276,9 +276,11 @@ struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
adap->rc->input_id.version = 1;
adap->rc->driver_name = CEC_NAME;
adap->rc->allowed_protocols = RC_BIT_CEC;
+ adap->rc->enabled_protocols = RC_BIT_CEC;
adap->rc->priv = adap;
adap->rc->map_name = RC_MAP_CEC;
adap->rc->timeout = MS_TO_NS(100);
+ adap->rc_last_scancode = -1;
#endif
return adap;
}
@@ -310,6 +312,17 @@ int cec_register_adapter(struct cec_adapter *adap,
adap->rc = NULL;
return res;
}
+ /*
+ * The REP_DELAY for CEC is really the time between the initial
+ * 'User Control Pressed' message and the second. The first
+ * keypress is always seen as non-repeating, the second
+ * (provided it has the same UI Command) will start the 'Press
+ * and Hold' (aka repeat) behavior. By setting REP_DELAY to the
+ * same value as REP_PERIOD the expected CEC behavior is
+ * reproduced.
+ */
+ adap->rc->input_dev->rep[REP_DELAY] =
+ adap->rc->input_dev->rep[REP_PERIOD];
}
#endif
OpenPOWER on IntegriCloud