mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sean Young <sean@mess.org>
To: 金超-软件项目部 <jinchao@vivo.com>
Cc: "mchehab@kernel.org" <mchehab@kernel.org>,
	黄理鹏 <huanglipeng@vivo.com>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: 回复: [PATCH v1] media: rc-core: Modify the timeout waiting time for the infrared remote control.
Date: Fri, 11 Oct 2024 15:34:43 +0100	[thread overview]
Message-ID: <Zwk3g-B6dJWgqE41@gofer.mess.org> (raw)
In-Reply-To: <KL1PR0601MB445295795E1DBE993238FB17DB7F2@KL1PR0601MB4452.apcprd06.prod.outlook.com>

Hi,

On Wed, Oct 09, 2024 at 07:03:57AM +0000, 金超-软件项目部 wrote:
> NORMAL: The kukong apk control remote control sends codes for other buttons
> 10-09 11:20:18.219  1023  1023 D ConsumerIrHal: pattern[0]: 4500, 4500, 560, 560, 560, 1680, 560, 1680
> 10-09 11:20:18.219  1023  1023 D ConsumerIrHal: pattern[8]: 560, 1680, 560, 560, 560, 560, 560, 560
> 10-09 11:20:18.219  1023  1023 D ConsumerIrHal: pattern[16]: 560, 560, 560, 560, 560, 1680, 560, 1680
> 10-09 11:20:18.219  1023  1023 D ConsumerIrHal: pattern[24]: 560, 1680, 560, 560, 560, 560, 560, 560
> 10-09 11:20:18.219  1023  1023 D ConsumerIrHal: pattern[32]: 560, 560, 560, 1680, 560, 560, 560, 1680
> 10-09 11:20:18.219  1023  1023 D ConsumerIrHal: pattern[40]: 560, 1680, 560, 560, 560, 560, 560, 560
> 10-09 11:20:18.219  1023  1023 D ConsumerIrHal: pattern[48]: 560, 560, 560, 560, 560, 1680, 560, 560
> 10-09 11:20:18.219  1023  1023 D ConsumerIrHal: pattern[56]: 560, 560, 560, 1680, 560, 1680, 560, 1680
> 10-09 11:20:18.219  1023  1023 D ConsumerIrHal: pattern[64]: 560, 1680, 560, 46920, 4500, 4500, 560, 1680
> 10-09 11:20:18.219  1023  1023 D ConsumerIrHal: 0x560,
> 10-09 11:20:18.219  1023  1023 D ConsumerIrHal: 0x96200,

If I sum all these lengths, I get 216000 microseconds. That's well clear
of IR_MAX_DURATION (500ms).

Note that the last two values 0x560 and 0x96200 look really weird, they are
not hex values are all, and there is no "pattern[...]: " prefix.

> 10-09 11:20:18.219  1023  1023 D ConsumerIrHal:
> 10-09 11:20:18.220  1023  1023 D ConsumerIrHal: IRTX: Send to driver
> 10-09 11:20:18.469  1023  1023 D ConsumerIrHal: Done, Turn OFF IRTX
> 
> SPECIAL :Sending the power button on the remote control of the kukong app may result in additional lines of coding, leading to transmission failure (72-88 extra)
> 10-09 11:19:53.973  1023  1023 D ConsumerIrHal: pattern[0]: 4500, 4500, 560, 560, 560, 1680, 560, 1680
> 10-09 11:19:53.973  1023  1023 D ConsumerIrHal: pattern[8]: 560, 1680, 560, 560, 560, 560, 560, 560
> 10-09 11:19:53.973  1023  1023 D ConsumerIrHal: pattern[16]: 560, 560, 560, 560, 560, 1680, 560, 1680
> 10-09 11:19:53.973  1023  1023 D ConsumerIrHal: pattern[24]: 560, 1680, 560, 560, 560, 560, 560, 560
> 10-09 11:19:53.973  1023  1023 D ConsumerIrHal: pattern[32]: 560, 560, 560, 560, 560, 560, 560, 1680
> 10-09 11:19:53.973  1023  1023 D ConsumerIrHal: pattern[40]: 560, 1680, 560, 560, 560, 560, 560, 560
> 10-09 11:19:53.973  1023  1023 D ConsumerIrHal: pattern[48]: 560, 560, 560, 1680, 560, 1680, 560, 560
> 10-09 11:19:53.973  1023  1023 D ConsumerIrHal: pattern[56]: 560, 560, 560, 1680, 560, 1680, 560, 1680
> 10-09 11:19:53.973  1023  1023 D ConsumerIrHal: pattern[64]: 560, 1680, 560, 46920, 4500, 4500, 560, 1680
> 10-09 11:19:53.973  1023  1023 D ConsumerIrHal: pattern[72]: 560, 96200, 4500, 4500, 560, 1680, 560, 96200
> 10-09 11:19:53.973  1023  1023 D ConsumerIrHal: pattern[80]: 4500, 4500, 560, 1680, 560, 96200, 4500, 4500
> 10-09 11:19:53.973  1023  1023 D ConsumerIrHal: pattern[88]: 560, 1680, 560, 96200, 4500, 4500, 560, 1680
> 10-09 11:19:53.973  1023  1023 D ConsumerIrHal: 0x560,
> 10-09 11:19:53.973  1023  1023 D ConsumerIrHal: 0x96200,

If I sum all these lengths I get 648000 microseconds, so quit a bit more
than IR_MAX_DURATION, which is why the send fails. Again the last two values
are printed like garbage.

The signal looks like NECx1: http://hifi-remote.com/wiki/index.php/NECx1

So there is the main signal, follow by a bunch of repeats. Each repeat
looks like +4500 -4500 +560 -1680 +560 -96200; the -96200 is the trailing
gap. To avoid going over IR_MAX_DURATION, don't include the -96200 gap
but replaced with a usleep(96200), i.e. in psuedo code:

        int i, fd = open("/dev/lirc0", O_RDWR);
        write(fd, [4500 4500 560 560 560 1680 560 1680 560 1680 560 560 560 560 560 560 560 560 560 560 560 1680 560 1680 560 1680 560 560 560 560 560 560 560 560 560 560 560 560 560 1680 560 1680 560 560 560 560 560 560 560 560 560 1680 560 1680 560 560 560 560 560 1680 560 1680 560 1680 560 1680 560]);
        usleep(46920);
        for (i=0; i<4; i++) {
                write(fd, [4500 4500 560 1680 560]);
                usleep(96200);
        }

Note that this what the lirc daemon also does for transmits; it's a well
established way of sending. The write() to a lirc chardev won't return until
the transmit has been successful. It might be interruptted by a signal, so
you should disable signals during write (I don't think lirc daemon bothers
though).


Hope this helps

Sean

  parent reply	other threads:[~2024-10-11 14:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-27 10:58 Shen Lichuan
2024-10-02 20:46 ` Sean Young
     [not found]   ` <TYZPR06MB6895415657AFF1C1723F9020DF7E2@TYZPR06MB6895.apcprd06.prod.outlook.com>
     [not found]     ` <KL1PR0601MB445295795E1DBE993238FB17DB7F2@KL1PR0601MB4452.apcprd06.prod.outlook.com>
     [not found]       ` <6d902c04-eae5-427a-a344-2662a71dca65@vivo.com>
2024-10-11  2:01         ` 金超-软件项目部
2024-10-11 14:34       ` Sean Young [this message]
2024-10-12  3:09         ` 回复: " 金超-软件项目部
2024-10-17  7:15           ` 金超-软件项目部
2024-10-17  7:57             ` Sean Young
     [not found]               ` <964bdb7a-8e40-4fbe-b85f-571692694b8b@vivo.com>
2024-10-18 17:11                 ` Sean Young

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=Zwk3g-B6dJWgqE41@gofer.mess.org \
    --to=sean@mess.org \
    --cc=huanglipeng@vivo.com \
    --cc=jinchao@vivo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.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

all inboxes | Powered by JetHome®