From: 金超-软件项目部 <jinchao@vivo.com>
To: Sean Young <sean@mess.org>
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>,
沈李川 <shenlichuan@vivo.com>
Subject: Re: [PATCH v1] media: rc-core: Modify the timeout waiting time for the infrared remote control.
Date: Fri, 11 Oct 2024 02:01:58 +0000 [thread overview]
Message-ID: <33b8bfc5-5316-41fe-ad53-73e03d44c39e@vivo.com> (raw)
In-Reply-To: <6d902c04-eae5-427a-a344-2662a71dca65@vivo.com>
在 2024/10/10 21:38, quqiwanzi 写道:
> Dear Young
>
> IR_MAX_DURATION is already half second; can you elaborate on the signal
> that the "Power" button on a Skyworth TV remote looks like? I doubt that
> a signal button press would produce more than 500ms of IR; that would be
> a lot IR for a single button, and would also have terrible latency for the
> user.
>
> My guess is that the signal is repeating, and you're trying to send
> the signals with the repeats in one go. It would be nice to hear what
> protocol this is and what it looks like encoded.
>
> Abnormal encoding does not repeat sending compared to normal encoding,
> but rather has a few extra lines of encoding causing timeout,the
> infrared encoding is as follows
>
> 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,
> 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
>
> Abnormal :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,
> 10-09 11:19:53.973 1023 1023 D ConsumerIrHal:
> 10-09 11:19:53.973 1023 1023 D ConsumerIrHal: IRTX: Send to driver
> 10-09 11:19:53.973 1023 1023 E ConsumerIrHal: irtx write fail, errno=22
>
>
>
> If the signal contains large gaps/spaces, then the signal can be split
> up into multiple sends. For example, if you have this signal
>
> +100 -150000 +150
>
> You can also send this like so (pseudo code):
>
> int fd = open("/dev/lirc0", O_RW);
> write(fd, [100], 1);
> usleep(150000);
> write(fd, [100], 1);
> close(fd);
>
> Currently unable to split into two shipments
>
>
> > This adjustment will allow for successful transmission of these extended
> > codes, thereby enhancing overall device compatibility and ensuring
> proper
> > functionality of remotes with long duration signals.
> >
> > Example log entries highlighting the issue:
> > D ConsumerIrHal: IRTX: Send to driver <268>
> > E ConsumerIrHal: irtx write fail, errno=22 <269>
> > D ConsumerIrHal: Done, Turn OFF IRTX <270>
>
> What software is this, anything you can share about it?
>
> The kukong apk used sends the code by pressing the power button.
> ConsumerIrHal is an MTK infrared remote control source file that
> involves code confidentiality. Unfortunately, we are unable to provide
> this part of the code
>
> Thanks !
>> ------------------------------------------------------------------------
>> *发件人:* 黄理鹏 <huanglipeng@vivo.com>
>> *发送时间:* 2024年10月8日 9:42
>> *收件人:* 金超-软件项目部 <jinchao@vivo.com>
>> *主题:* 转发: [PATCH v1] media: rc-core: Modify the timeout waiting time
>> for the infrared remote control.
>>
>> ------------------------------------------------------------------------
>> *发件人:* Sean Young <sean@mess.org>
>> *发送时间:* 2024年10月3日 4:46
>> *收件人:* 沈李川 <shenlichuan@vivo.com>
>> *抄送:* 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>; opensource.kernel
>> <opensource.kernel@vivo.com>
>> *主题:* Re: [PATCH v1] media: rc-core: Modify the timeout waiting time
>> for the infrared remote control.
>> On Fri, Sep 27, 2024 at 06:58:08PM +0800, Shen Lichuan wrote:
>> > When transmitting codes from certain infrared remote controls, the
>> kernel
>> > occasionally fails to receive them due to a timeout during
>> transmission.
>> >
>> > This issue arises specifically in instances where the duration of the
>> > signal exceeds the predefined limit (`IR_MAX_DURATION`) in the code
>> > handling logic located within `lirc_dev.c`:
>> >
>> > if (txbuf[i] > IR_MAX_DURATION - duration || !txbuf[i]) {
>> > pr_err("lirc_transmit duration out range[%d] txbuf:%d
>> duration:%d\n",
>> > i, txbuf[i], duration);
>> > ret = -EINVAL;
>> > goto out_kfree;
>> > }
>> >
>> > The error manifests as an `EINVAL` (error number 22) being returned
>> when
>> > attempting to send infrared signals whose individual elements
>> exceed the
>> > maximum allowed duration (`xbuf[i] > IR_MAX_DURATION - duration`).
>> >
>> > As evidenced by logs, attempts to send commands with extended
>> durations,
>> > such as those associated with the "Power" button on a Skyworth TV
>> remote,
>> > fail with this error.
>> >
>> > To rectify this and ensure compatibility with a broader range of
>> infrared
>> > remote controls, particularly those with lengthy code sequences,
>> this patch
>> > proposes to increase the value of `IR_MAX_DURATION`.
>>
>> IR_MAX_DURATION is already half second; can you elaborate on the signal
>> that the "Power" button on a Skyworth TV remote looks like? I doubt that
>> a signal button press would produce more than 500ms of IR; that would be
>> a lot IR for a single button, and would also have terrible latency
>> for the
>> user.
>>
>> My guess is that the signal is repeating, and you're trying to send
>> the signals with the repeats in one go. It would be nice to hear what
>> protocol this is and what it looks like encoded.
>>
>> If the signal contains large gaps/spaces, then the signal can be split
>> up into multiple sends. For example, if you have this signal
>>
>> +100 -150000 +150
>>
>> You can also send this like so (pseudo code):
>>
>> int fd = open("/dev/lirc0", O_RW);
>> write(fd, [100], 1);
>> usleep(150000);
>> write(fd, [100], 1);
>> close(fd);
>>
>> This overcomes the limitation of the IR_MAX_DURATION, and also makes it
>> possible to send on much larger variety of infrared hardware, lots of
>> them
>> do not support sending large gaps or long signals.
>>
>> > This adjustment will allow for successful transmission of these
>> extended
>> > codes, thereby enhancing overall device compatibility and ensuring
>> proper
>> > functionality of remotes with long duration signals.
>> >
>> > Example log entries highlighting the issue:
>> > D ConsumerIrHal: IRTX: Send to driver <268>
>> > E ConsumerIrHal: irtx write fail, errno=22 <269>
>> > D ConsumerIrHal: Done, Turn OFF IRTX <270>
>>
>> What software is this, anything you can share about it?
>>
>> > Modifying the maximum timeout time in this area can solve this issue.
>>
>> We hold various locks during the transmit, and keeping it to a minimum
>> is much nicer. The gpio-ir-tx driver disables interrupts for this
>> duration,
>> and many other drivers hold the rcdev mutex.
>>
>> Thanks,
>>
>> Sean
>>
>> >
>> > Signed-off-by: Huang Lipeng <huanglipeng@vivo.com>
>> > Signed-off-by: Shen Lichuan <shenlichuan@vivo.com>
>> > ---
>> > include/media/rc-core.h | 2 +-
>> > 1 file changed, 1 insertion(+), 1 deletion(-)
>> >
>> > diff --git a/include/media/rc-core.h b/include/media/rc-core.h
>> > index d095908073ef..2f575c18b6b6 100644
>> > --- a/include/media/rc-core.h
>> > +++ b/include/media/rc-core.h
>> > @@ -303,7 +303,7 @@ struct ir_raw_event {
>> >
>> > #define US_TO_NS(usec) ((usec) * 1000)
>> > #define MS_TO_US(msec) ((msec) * 1000)
>> > -#define IR_MAX_DURATION MS_TO_US(500)
>> > +#define IR_MAX_DURATION MS_TO_US(1000)
>> > #define IR_DEFAULT_TIMEOUT MS_TO_US(125)
>> > #define IR_MAX_TIMEOUT LIRC_VALUE_MASK
>> >
>> > --
>> > 2.17.1
>
>
next prev parent reply other threads:[~2024-10-11 2:02 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 ` 金超-软件项目部 [this message]
2024-10-11 14:34 ` 回复: " Sean Young
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=33b8bfc5-5316-41fe-ad53-73e03d44c39e@vivo.com \
--to=jinchao@vivo.com \
--cc=huanglipeng@vivo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=sean@mess.org \
--cc=shenlichuan@vivo.com \
/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®