public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] media: rc-core: Modify the timeout waiting time for the infrared remote control.
@ 2024-09-27 10:58 Shen Lichuan
  2024-10-02 20:46 ` Sean Young
  0 siblings, 1 reply; 8+ messages in thread
From: Shen Lichuan @ 2024-09-27 10:58 UTC (permalink / raw)
  To: sean, mchehab
  Cc: huanglipeng, linux-media, linux-kernel, opensource.kernel,
	Shen Lichuan

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`. 

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>

Modifying the maximum timeout time in this area can solve this issue.

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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-10-18 17:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-27 10:58 [PATCH v1] media: rc-core: Modify the timeout waiting time for the infrared remote control 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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox