public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: "Marko Mäkelä" <marko.makela@iki.fi>
To: Sean Young <sean@mess.org>
Cc: linux-media@vger.kernel.org,
	Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Subject: Re: Inconsistent RC5 ir-keytable events
Date: Tue, 4 Jan 2022 18:07:06 +0200	[thread overview]
Message-ID: <YdRwqt1pwb8osT6V@jyty> (raw)
In-Reply-To: <YdLqL2ViSwWzS/Ig@jyty>

[-- Attachment #1: Type: text/plain, Size: 6087 bytes --]

Mon, Jan 03, 2022 at 02:21:05PM +0200, Marko Mäkelä wrote:
>If the correct threshold is 106ms and your suggestion of 100 does not 
>work, I will try a lower value, such as 94 or 95, to get 94+9.741 < 
>106.

With the value 100, I got rather nice output from ir-keytable -t. Here 
is a short press of OK followed by a long press:

Testing events. Please, press CTRL-C to abort.
85.406113: lirc protocol(rc5): scancode = 0x1e25
85.406129: event type EV_MSC(0x04): scancode = 0x1e25
85.406129: event type EV_KEY(0x01) key_down: KEY_OK(0x0160)
85.406129: event type EV_SYN(0x00).
85.536094: event type EV_KEY(0x01) key_up: KEY_OK(0x0160)
85.536094: event type EV_SYN(0x00).
87.286097: lirc protocol(rc5): scancode = 0x1e25 toggle=1
87.286108: event type EV_MSC(0x04): scancode = 0x1e25
87.286108: event type EV_KEY(0x01) key_down: KEY_OK(0x0160)
87.286108: event type EV_SYN(0x00).
87.398095: lirc protocol(rc5): scancode = 0x1e25 toggle=1
87.398103: event type EV_MSC(0x04): scancode = 0x1e25
87.398103: event type EV_SYN(0x00).
87.510073: lirc protocol(rc5): scancode = 0x1e25 toggle=1
87.510081: event type EV_MSC(0x04): scancode = 0x1e25
87.510081: event type EV_SYN(0x00).
87.622079: lirc protocol(rc5): scancode = 0x1e25 toggle=1
87.622088: event type EV_MSC(0x04): scancode = 0x1e25
87.622088: event type EV_SYN(0x00).
87.734090: lirc protocol(rc5): scancode = 0x1e25 toggle=1
87.734099: event type EV_MSC(0x04): scancode = 0x1e25
87.734099: event type EV_SYN(0x00).
87.804051: event type EV_KEY(0x01) key_down: KEY_OK(0x0160)
87.804051: event type EV_SYN(0x00).
[snip]
88.854090: lirc protocol(rc5): scancode = 0x1e25 toggle=1
88.854098: event type EV_MSC(0x04): scancode = 0x1e25
88.854098: event type EV_SYN(0x00).
88.860050: event type EV_KEY(0x01) key_down: KEY_OK(0x0160)
88.860050: event type EV_SYN(0x00).
88.860050: event type EV_KEY(0x01) key_up: KEY_OK(0x0160)
88.860050: event type EV_SYN(0x00).

There was no unexpected key_up during the long press.

I suppose that the key_down events are for the repeated keypresses. This 
was with the default settings for the repeat.

Based on the timestamps, the RC5 messages would seem to arrive at 
112-millisecond intervals.

I also tried smaller values (94, 90, 70), and it got worse. With 94, it 
worked most of the time, but there were occasional glitches (key_up 
events while the RC5 messages kept arriving) like this:

292.842137: lirc protocol(rc5): scancode = 0x1e25
292.776051: event type EV_MSC(0x04): scancode = 0x1e25
292.776051: event type EV_SYN(0x00).
292.908053: event type EV_KEY(0x01) key_down: KEY_OK(0x0160)
292.908053: event type EV_SYN(0x00).
292.954082: lirc protocol(rc5): scancode = 0x1e25
292.908053: event type EV_MSC(0x04): scancode = 0x1e25
292.908053: event type EV_SYN(0x00).
293.040051: event type EV_KEY(0x01) key_down: KEY_OK(0x0160)
293.040051: event type EV_SYN(0x00).
293.040051: event type EV_KEY(0x01) key_up: KEY_OK(0x0160)
293.040051: event type EV_SYN(0x00).
293.162075: lirc protocol(rc5): scancode = 0x1e25
293.162085: event type EV_MSC(0x04): scancode = 0x1e25
293.162085: event type EV_KEY(0x01) key_down: KEY_OK(0x0160)
293.162085: event type EV_SYN(0x00).
293.292069: event type EV_KEY(0x01) key_up: KEY_OK(0x0160)
293.292069: event type EV_SYN(0x00).

With the value 70, every single RC5 message would result in both 
key_down and key_up events:

497.970089: lirc protocol(rc5): scancode = 0x1e0d
497.970104: event type EV_MSC(0x04): scancode = 0x1e0d
497.970104: event type EV_KEY(0x01) key_down: KEY_MENU(0x008b)
497.970104: event type EV_SYN(0x00).
498.100064: event type EV_KEY(0x01) key_up: KEY_MENU(0x008b)
498.100064: event type EV_SYN(0x00).
498.138082: lirc protocol(rc5): scancode = 0x1e0d
498.138096: event type EV_MSC(0x04): scancode = 0x1e0d
498.138096: event type EV_KEY(0x01) key_down: KEY_MENU(0x008b)
498.138096: event type EV_SYN(0x00).
498.268059: event type EV_KEY(0x01) key_up: KEY_MENU(0x008b)
498.268059: event type EV_SYN(0x00).

I got rather good volume+/volume- response in GNOME desktop when I used 
the value 100 (as in the attached patch) and set the following:
ir-keytable --period=111 --delay=111

I tested once more without the patch (using the value 200), both with 
the defaults (--period=125 --delay=500) and the 111ms values, and the 
experience was bad (about half the speed, and frequent intermittent 
pauses).

However, the patch breaks the NEC protocol. With the bundled remote 
control unit of the adapter, I initially get some key_down and key_up, 
but then I only get 'repeat' events if I hit the same (or even 
different) button again. Here is a sample with almost 8 seconds of pause 
in between:

2035.461973: lirc protocol(nec): scancode = 0x1e repeat
2035.461981: event type EV_MSC(0x04): scancode = 0x1e
2035.461981: event type EV_SYN(0x00).
2035.573955: lirc protocol(nec): scancode = 0x1e repeat
2035.573963: event type EV_MSC(0x04): scancode = 0x1e
2035.573963: event type EV_SYN(0x00).
2043.425920: lirc protocol(nec): scancode = 0x1e repeat
2043.425932: event type EV_MSC(0x04): scancode = 0x1e
2043.425932: event type EV_SYN(0x00).

I tested once more the stock driver (value=200) with the NEC protocol.  
The GNOME volume control would only react to the initial press of the 
button, not on the repeats. Also in ir-keytable -t, I only see one 
key_down/key_up followed by LIRC-only messages:

2776.698529: lirc protocol(nec): scancode = 0x1e
2776.698539: event type EV_MSC(0x04): scancode = 0x1e
2776.698539: event type EV_KEY(0x01) key_down: KEY_VOLUMEUP(0x0073)
2776.698539: event type EV_SYN(0x00).
2776.824077: event type EV_KEY(0x01) key_up: KEY_VOLUMEUP(0x0073)
2776.824077: event type EV_SYN(0x00).
2776.909965: lirc protocol(nec): scancode = 0x1e repeat
2776.909973: event type EV_MSC(0x04): scancode = 0x1e
2776.909973: event type EV_SYN(0x00).
2777.121976: lirc protocol(nec): scancode = 0x1e repeat
2777.121983: event type EV_MSC(0x04): scancode = 0x1e
2777.121983: event type EV_SYN(0x00).

I am happy to test any patches, now that I have a compiled kernel where 
I can easily rmmod and insmod the module.

	Marko

[-- Attachment #2: rtl28xxu-rc5.patch --]
[-- Type: text/x-diff, Size: 566 bytes --]

diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index 795a012d4020..9504d6f94a58 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -1807,7 +1807,7 @@ static int rtl2832u_get_rc_config(struct dvb_usb_device *d,
 	rc->allowed_protos = RC_PROTO_BIT_ALL_IR_DECODER;
 	rc->driver_type = RC_DRIVER_IR_RAW;
 	rc->query = rtl2832u_rc_query;
-	rc->interval = 200;
+	rc->interval = 100;
 	/* we program idle len to 0xc0, set timeout to one less */
 	rc->timeout = 0xbf * 51;
 

  reply	other threads:[~2022-01-04 16:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <YdKdPosyzj2urFpS@jyty>
2022-01-03  9:21 ` Inconsistent RC5 ir-keytable events Sean Young
2022-01-03 10:35   ` Marko Mäkelä
2022-01-03 11:07     ` Sean Young
2022-01-03 12:21       ` Marko Mäkelä
2022-01-04 16:07         ` Marko Mäkelä [this message]
2022-01-05  9:53           ` Sean Young
2022-01-06 11:41             ` Marko Mäkelä
2022-01-13 16:55               ` Sean Young
2022-01-14  6:31                 ` Marko Mäkelä
2022-01-29 17:15                   ` Marko Mäkelä
2022-02-08 16:46                     ` Sean Young
2022-02-09  8:12                       ` Marko Mäkelä
2022-02-12 11:16                         ` Sean Young
2022-02-12 16:34                           ` Sean Young
2022-02-13 17:12                             ` Marko Mäkelä
2022-03-26 18:44                               ` Marko Mäkelä
2022-04-10 14:07                                 ` Marko Mäkelä

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YdRwqt1pwb8osT6V@jyty \
    --to=marko.makela@iki.fi \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab+huawei@kernel.org \
    --cc=sean@mess.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox