[mythtv-users] Remote keys repeating way too fast
Doug Scoular (dscoular)
dscoular at cisco.com
Sun Apr 18 01:37:31 UTC 2021
Hi Stephen et al,
Success!!!
I tried reverting the problem c592cca3691db commit against 5.8.0-50.56
and was rewarded with a working remote. Although, by mistake, I only
reverted two of the three impacted files:
* drivers/media/rc/ir-mce_kbd-decoder.c
* drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
I totally missed that this file was involved as well:
* drivers/media/rc/serial_ir.c
Reverting the two files seems to have been enough to fix my
MCE remote spurious repeats. I guess I'll now have to see
how I go about reporting this as a kernel bug.
For anyone wondering what the changes in the commit actually
were. I include them here:
root at lisa:/mnt/store1/src/groovy# PAGER= git show c592cca3691db
commit c592cca3691dbfefa2a7177bd42fc9eee50b7108
Author: Matthias Reichl <hias at horus.com>
Date: Tue Jan 5 10:30:23 2021 +0100
media: rc: fix timeout handling after switch to microsecond durations
BugLink: https://bugs.launchpad.net/bugs/1918516
commit 06b831588b639ad9d94e4789b0250562228722c2 upstream.
Commit 528222d853f92 ("media: rc: harmonize infrared durations to
microseconds") missed to switch some timeout calculations from
nanoseconds to microseconds. This resulted in spurious key_up+key_down
events at the last scancode if the rc device uses a long timeout
(eg 100ms on nuvoton-cir) as the device timeout wasn't properly
accounted for in the keyup timeout calculation.
Fix this by applying the proper conversion functions.
Cc: stable at vger.kernel.org
Fixes: 528222d853f92 ("media: rc: harmonize infrared durations to microseconds")
Signed-off-by: Matthias Reichl <hias at horus.com>
Signed-off-by: Sean Young <sean at mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei at kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg at canonical.com>
diff --git a/drivers/media/rc/ir-mce_kbd-decoder.c b/drivers/media/rc/ir-mce_kbd-decoder.c
index cfe837f773c1..5f51bad53772 100644
--- a/drivers/media/rc/ir-mce_kbd-decoder.c
+++ b/drivers/media/rc/ir-mce_kbd-decoder.c
@@ -320,7 +320,7 @@ static int ir_mce_kbd_decode(struct rc_dev *dev, struct ir_raw_event ev)
data->body);
spin_lock(&data->keylock);
if (scancode) {
- delay = nsecs_to_jiffies(dev->timeout) +
+ delay = usecs_to_jiffies(dev->timeout) +
msecs_to_jiffies(100);
mod_timer(&data->rx_timeout, jiffies + delay);
} else {
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 38aa0c2de243..b86e16897444 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -737,7 +737,7 @@ static unsigned int repeat_period(int protocol)
void rc_repeat(struct rc_dev *dev)
{
unsigned long flags;
- unsigned int timeout = nsecs_to_jiffies(dev->timeout) +
+ unsigned int timeout = usecs_to_jiffies(dev->timeout) +
msecs_to_jiffies(repeat_period(dev->last_protocol));
struct lirc_scancode sc = {
.scancode = dev->last_scancode, .rc_proto = dev->last_protocol,
@@ -855,7 +855,7 @@ void rc_keydown(struct rc_dev *dev, enum rc_proto protocol, u64 scancode,
ir_do_keydown(dev, protocol, scancode, keycode, toggle);
if (dev->keypressed) {
- dev->keyup_jiffies = jiffies + nsecs_to_jiffies(dev->timeout) +
+ dev->keyup_jiffies = jiffies + usecs_to_jiffies(dev->timeout) +
msecs_to_jiffies(repeat_period(protocol));
mod_timer(&dev->timer_keyup, dev->keyup_jiffies);
}
diff --git a/drivers/media/rc/serial_ir.c b/drivers/media/rc/serial_ir.c
index d77507ba0fb5..ce5b1fd1e3f4 100644
--- a/drivers/media/rc/serial_ir.c
+++ b/drivers/media/rc/serial_ir.c
@@ -385,7 +385,7 @@ static irqreturn_t serial_ir_irq_handler(int i, void *blah)
} while (!(sinp(UART_IIR) & UART_IIR_NO_INT)); /* still pending ? */
mod_timer(&serial_ir.timeout_timer,
- jiffies + nsecs_to_jiffies(serial_ir.rcdev->timeout));
+ jiffies + usecs_to_jiffies(serial_ir.rcdev->timeout));
ir_raw_event_handle(serial_ir.rcdev);
Of course, I still don't really understand the context for the change from
nanoseconds to microseconds but at least I have a working remote
under the latest groovy 5.8.0-50.56 kernel. Hooray!!!
Cheers,
Doug
More information about the mythtv-users
mailing list