Message ID | 20220705085358.44418-1-marko.makela@iki.fi (mailing list archive) |
---|---|
State | Obsoleted |
Delegated to: | Sean Young |
Headers |
Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from <linux-media-owner@vger.kernel.org>) id 1o8eK5-00FPfW-LF; Tue, 05 Jul 2022 08:54:21 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231153AbiGEIyU (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Tue, 5 Jul 2022 04:54:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229933AbiGEIyT (ORCPT <rfc822;linux-media@vger.kernel.org>); Tue, 5 Jul 2022 04:54:19 -0400 Received: from meesny.iki.fi (meesny.iki.fi [IPv6:2001:67c:2b0:1c1::201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1516B116B for <linux-media@vger.kernel.org>; Tue, 5 Jul 2022 01:54:18 -0700 (PDT) Received: from localhost (dsl-hkibng31-58c389-173.dhcp.inet.fi [88.195.137.173]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: msmakela) by meesny.iki.fi (Postfix) with ESMTPSA id 02F1E20191; Tue, 5 Jul 2022 11:54:13 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1657011254; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sfC6G4taA3+DNf0Uc1lz77iXINmBfKFzBeXvcki9CZM=; b=nv69mqyDw9YNVHGNzAaj49XustuC6Vb6C+RFDjyYTSaLQotDoD8xgYCrBUO6gabJrM1xJc jEtKbcB4EvSijiM9Qd1HlFF9v7+ENkFysYdPJICRJVCKgBlxrynKow32UBO2zEDOF5QB6t XLxrxZk+Ravhb0SeoebI+ljNDpPH9Nw= From: =?utf-8?b?TWFya28gTcOka2Vsw6Q=?= <marko.makela@iki.fi> To: linux-media@vger.kernel.org Cc: Sean Young <sean@mess.org>, =?utf-8?b?TWFya28gTcOka2Vsw6Q=?= <marko.makela@iki.fi> Subject: [PATCH] media: rc: Always report LIRC repeat flag Date: Tue, 5 Jul 2022 11:53:58 +0300 Message-Id: <20220705085358.44418-1-marko.makela@iki.fi> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1657011254; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=sfC6G4taA3+DNf0Uc1lz77iXINmBfKFzBeXvcki9CZM=; b=H1Z7aHjf+agGhLtXUGks5C+SMDGD7tyoMMYE+E/sBXF4BOmu0W+4QfF4Ws+v1DE8oX0qIV E057ZGKA8L04SqdaJK1flufQyF+J+HuH0jtaOWbPU2V9ng6gsGL2CtQWFfKjDDQSOLZZ3b etLweF/qiVm0kBvlkw4X8QloUkcdLQg= ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=msmakela smtp.mailfrom=marko.makela@iki.com ARC-Seal: i=1; s=meesny; d=iki.fi; t=1657011254; a=rsa-sha256; cv=none; b=TwLvVnjRMYczhxM9Y+EsMz2qnQW18bWjsWcSvZjZeBAjhEU3lEagXWTdC6wgzeJLh6W1kK hUN4n9aAiD8ml938syUUyn3xmETV8QCoV+T4FLDz9mCPsKy4TdBHTBzekw2TwQzk1FwLvM HMf2ELkuDQyO1EVCp6Dl8AdU2T5RsEw= X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,T_SPF_PERMERROR autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.5 (--) X-LSpam-Report: No, score=-2.5 required=5.0 tests=BAYES_00=-1.9,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1 autolearn=ham autolearn_force=no |
Series |
media: rc: Always report LIRC repeat flag
|
|
Commit Message
Marko Mäkelä
July 5, 2022, 8:53 a.m. UTC
The flag LIRC_SCANCODE_FLAG_REPEAT was never set by rc_keydown().
Previously it was only set by rc_repeat(), but not all protocol
decoders invoke that function.
Signed-off-by: Marko Mäkelä <marko.makela@iki.fi>
---
drivers/media/rc/rc-main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
Hi Marko, On Tue, Jul 05, 2022 at 11:53:58AM +0300, Marko Mäkelä wrote: > The flag LIRC_SCANCODE_FLAG_REPEAT was never set by rc_keydown(). > Previously it was only set by rc_repeat(), but not all protocol > decoders invoke that function. This should say _why_ you are making this change, not _what_ the change is. See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes This also applies the first line of the commit. Thanks Sean > > Signed-off-by: Marko Mäkelä <marko.makela@iki.fi> > --- > drivers/media/rc/rc-main.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c > index b90438a71c80..d914197245eb 100644 > --- a/drivers/media/rc/rc-main.c > +++ b/drivers/media/rc/rc-main.c > @@ -786,7 +786,8 @@ static void ir_do_keydown(struct rc_dev *dev, enum rc_proto protocol, > dev->last_toggle != toggle); > struct lirc_scancode sc = { > .scancode = scancode, .rc_proto = protocol, > - .flags = toggle ? LIRC_SCANCODE_FLAG_TOGGLE : 0, > + .flags = (toggle ? LIRC_SCANCODE_FLAG_TOGGLE : 0) | > + (!new_event ? LIRC_SCANCODE_FLAG_REPEAT : 0), > .keycode = keycode > }; > > -- > 2.36.1
Hi Sean, Tue, Jul 05, 2022 at 06:43:55PM +0100, Sean Young wrote: >On Tue, Jul 05, 2022 at 11:53:58AM +0300, Marko Mäkelä wrote: >> The flag LIRC_SCANCODE_FLAG_REPEAT was never set by rc_keydown(). >> Previously it was only set by rc_repeat(), but not all protocol >> decoders invoke that function. > >This should say _why_ you are making this change, not _what_ the change >is. How would you find the following? --- media: lirc: ensure lirc device receives repeats Commit de142c32410649e64d44928505ffad2176a96a9e ("media: lirc: implement reading scancode") would never set the LIRC_SCANCODE_FLAG_REPEAT flag in the LIRC messages. Commit b66218fddfd29f315a103db811152ab0c95fb054 ("media: lirc: ensure lirc device receives nec repeats") fixed it up for those protocol drivers that may call rc_repeat(). --- Would you prefer to be mentioned as a co-developer? Best regards, Marko
Hi Marko, On Wed, Jul 06, 2022 at 07:39:17PM +0300, Marko Mäkelä wrote: > Tue, Jul 05, 2022 at 06:43:55PM +0100, Sean Young wrote: > > On Tue, Jul 05, 2022 at 11:53:58AM +0300, Marko Mäkelä wrote: > > > The flag LIRC_SCANCODE_FLAG_REPEAT was never set by rc_keydown(). > > > Previously it was only set by rc_repeat(), but not all protocol > > > decoders invoke that function. > > > > This should say _why_ you are making this change, not _what_ the change > > is. > > How would you find the following? > > --- > media: lirc: ensure lirc device receives repeats > > Commit de142c32410649e64d44928505ffad2176a96a9e ("media: lirc: implement > reading scancode") would never set the LIRC_SCANCODE_FLAG_REPEAT flag in the > LIRC messages. > > Commit b66218fddfd29f315a103db811152ab0c95fb054 > ("media: lirc: ensure lirc device receives nec repeats") fixed it up for > those protocol drivers that may call rc_repeat(). > --- That's no good. See: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes The heading is called "Describe your changes". Sean
Hi Sean, Thu, Jul 07, 2022 at 09:57:10AM +0100, Sean Young wrote: >Hi Marko, > >On Wed, Jul 06, 2022 at 07:39:17PM +0300, Marko Mäkelä wrote: >> Tue, Jul 05, 2022 at 06:43:55PM +0100, Sean Young wrote: >> > On Tue, Jul 05, 2022 at 11:53:58AM +0300, Marko Mäkelä wrote: >> > > The flag LIRC_SCANCODE_FLAG_REPEAT was never set by rc_keydown(). >> > > Previously it was only set by rc_repeat(), but not all protocol >> > > decoders invoke that function. >> > >> > This should say _why_ you are making this change, not _what_ the change >> > is. >> >> How would you find the following? >> >> --- >> media: lirc: ensure lirc device receives repeats >> >> Commit de142c32410649e64d44928505ffad2176a96a9e ("media: lirc: implement >> reading scancode") would never set the LIRC_SCANCODE_FLAG_REPEAT flag in the >> LIRC messages. >> >> Commit b66218fddfd29f315a103db811152ab0c95fb054 >> ("media: lirc: ensure lirc device receives nec repeats") fixed it up for >> those protocol drivers that may call rc_repeat(). >> --- > >That's no good. See: > >https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes > >The heading is called "Describe your changes". I see. A quick read of "git log --oneline drivers/media/rc" suggests that the first line of the commit message is expected to be a summary _what_ the change is, not _why_ it was made. Would the commit message be acceptable after adding a "why" part right after the heading line, like this? If not, I would appreciate specific suggestions. --- media: lirc: ensure lirc device receives repeats For remote controls using RC5 and similar protocols that include a "toggle" flag, the LIRC device never set the "repeat" flag to distinguish repeated messages that were sent several times per second due to a long keypress, and messages sent due to repeated short keypresses. While a user-space program may implement logic around the "toggle" flag to distinguish long keypresses, it would be simpler to be able to rely on the "repeat" flag for any type of protocol. Commit de142c32410649e64d44928505ffad2176a96a9e ("media: lirc: implement reading scancode") would never set the LIRC_SCANCODE_FLAG_REPEAT flag in the LIRC messages. Commit b66218fddfd29f315a103db811152ab0c95fb054 ("media: lirc: ensure lirc device receives nec repeats") fixed it up for those protocol drivers that may call rc_repeat(). --- Best regards, Marko
Hi Marko, On Thu, Jul 07, 2022 at 02:09:49PM +0300, Marko Mäkelä wrote: > Thu, Jul 07, 2022 at 09:57:10AM +0100, Sean Young wrote: > > On Wed, Jul 06, 2022 at 07:39:17PM +0300, Marko Mäkelä wrote: > > > Tue, Jul 05, 2022 at 06:43:55PM +0100, Sean Young wrote: > > > > On Tue, Jul 05, 2022 at 11:53:58AM +0300, Marko Mäkelä wrote: > > > > > The flag LIRC_SCANCODE_FLAG_REPEAT was never set by rc_keydown(). > > > > > Previously it was only set by rc_repeat(), but not all protocol > > > > > decoders invoke that function. > > > > > > > > This should say _why_ you are making this change, not _what_ the change > > > > is. > > > > > > How would you find the following? > > > > > > --- > > > media: lirc: ensure lirc device receives repeats > > > > > > Commit de142c32410649e64d44928505ffad2176a96a9e ("media: lirc: implement > > > reading scancode") would never set the LIRC_SCANCODE_FLAG_REPEAT flag in the > > > LIRC messages. > > > > > > Commit b66218fddfd29f315a103db811152ab0c95fb054 > > > ("media: lirc: ensure lirc device receives nec repeats") fixed it up for > > > those protocol drivers that may call rc_repeat(). > > > --- > > > > That's no good. See: > > > > https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes > > > > The heading is called "Describe your changes". > > I see. A quick read of "git log --oneline drivers/media/rc" suggests that > the first line of the commit message is expected to be a summary _what_ the > change is, not _why_ it was made. Would the commit message be acceptable > after adding a "why" part right after the heading line, like this? If not, I > would appreciate specific suggestions. This is much better, thank you. > --- > media: lirc: ensure lirc device receives repeats > > For remote controls using RC5 and similar protocols that include a > "toggle" flag, the LIRC device never set the "repeat" flag to distinguish > repeated messages that were sent several times per second due to a > long keypress, and messages sent due to repeated short keypresses. > > While a user-space program may implement logic around the "toggle" flag > to distinguish long keypresses, it would be simpler to be able to rely on > the "repeat" flag for any type of protocol. I'm not sure how relevant the toggle is. This change is relevant for all protocols that do not use rc_repeat() and simply repeat the original message when a key is being held down. This includes the sony protocol, imon, and the nec protocol (in case the remote does *not* use the repeat message). > Commit de142c32410649e64d44928505ffad2176a96a9e ("media: lirc: implement > reading scancode") would never set the LIRC_SCANCODE_FLAG_REPEAT flag in > the LIRC messages. > > Commit b66218fddfd29f315a103db811152ab0c95fb054 > ("media: lirc: ensure lirc device receives nec repeats") fixed it up for > those protocol drivers that may call rc_repeat(). > --- Thanks Sean
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index b90438a71c80..d914197245eb 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -786,7 +786,8 @@ static void ir_do_keydown(struct rc_dev *dev, enum rc_proto protocol, dev->last_toggle != toggle); struct lirc_scancode sc = { .scancode = scancode, .rc_proto = protocol, - .flags = toggle ? LIRC_SCANCODE_FLAG_TOGGLE : 0, + .flags = (toggle ? LIRC_SCANCODE_FLAG_TOGGLE : 0) | + (!new_event ? LIRC_SCANCODE_FLAG_REPEAT : 0), .keycode = keycode };