linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools: gpio: fix debounce_period_us output of lsgpio
@ 2023-05-04  9:22 Milo Spadacini
  2023-05-04 13:48 ` Kent Gibson
  2023-05-04 16:20 ` andy.shevchenko
  0 siblings, 2 replies; 5+ messages in thread
From: Milo Spadacini @ 2023-05-04  9:22 UTC (permalink / raw)
  To: linus.walleij, brgl, linux-gpio; +Cc: Milo Spadacini

Fix wrong output that could occurs when more attributes are used and
 GPIO_V2_LINE_ATTR_ID_DEBOUNCE is not the first one.
---
 tools/gpio/lsgpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/gpio/lsgpio.c b/tools/gpio/lsgpio.c
index c61d061247e1..52a0be45410c 100644
--- a/tools/gpio/lsgpio.c
+++ b/tools/gpio/lsgpio.c
@@ -94,7 +94,7 @@ static void print_attributes(struct gpio_v2_line_info *info)
        for (i = 0; i < info->num_attrs; i++) {
                if (info->attrs[i].id == GPIO_V2_LINE_ATTR_ID_DEBOUNCE)
                        fprintf(stdout, ", debounce_period=%dusec",
-                               info->attrs[0].debounce_period_us);
+                               info->attrs[i].debounce_period_us);
        }
 }

--
2.34.1

[https://www.comelitgroup.com/firma/banner.jpg]<https://www.comelitgroup.com/it-it/cctv-advance-la-nuova-gamma-di-videosorveglianza-professionale-di-comelit>

NORME DI ACCESSO E DI COMPORTAMENTO PER ESTERNI<https://www.comelitgroup.com/it-it/norme-accesso-comportamento-esterni>

AVVISO DI CONFIDENZIALITÀ E PRIVACY
Questo messaggio ed i suoi eventuali allegati possono contenere informazioni confidenziali, di proprietà, legalmente protette. È destinato all'utilizzo esclusivo del destinatario sopra indicato; la natura privata e la confidenzialità non sono modificati da eventuali errori di trasmissione, pur avendo il mittente assunto tutte le misure di sicurezza idonee e preventive per evitarli. Il trattamento dei dati ivi contenuti, e quelli che verranno forniti in risposta, è realizzato in conformità alla normativa sulla privacy Reg 679/2016, potrete prendere visione della informativa anche visitando il sito www.comelitgroup.com ovvero sulle app Comelit. Rispondendo alla presente mail dichiarate di aver preso visione della richiamata informativa e di aver prestato il consenso al trattamento dei dati personali. Se il messaggio non è a lei destinato, non deve utilizzarlo, diffonderlo, copiarlo con qualunque mezzo, o intraprendere azioni basandosi su di esso. Se ha ricevuto questo messaggio per errore, la preghiamo di volerlo distruggere (unitamente ad eventuali copie dello stesso e suoi allegati) e di volerci cortesemente informare del fatto scrivendo al mittente.
CONFIDENTIALITY NOTICE AND PRIVACY
This message and its attachments (if any) may contain confidential, proprietary or legally privileged information and it is intended only for the use of the addressee named above. No confidentiality or privilege is waived or lost by any erroneous transmission, despite having taken all the security and preventative measures to avoid it. The processing of personal data contained therein, and those that will be provided in response, is made in compliance with the privacy regulation Reg 679/2016, you can also read the information by visiting www.comelitgroup.com or on Comelit apps. Responding to this email, you declare that you have read the aforementioned information and have given consent to the processing of personal data If you are not the intended recipient of this message, you are hereby notified that you must not use, disseminate, copy it in any form or take any action in reliance on it. If you have received this message in error, please, delete it (and any copies of it and attachment) and kindly inform the sender.

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

* Re: [PATCH] tools: gpio: fix debounce_period_us output of lsgpio
  2023-05-04  9:22 [PATCH] tools: gpio: fix debounce_period_us output of lsgpio Milo Spadacini
@ 2023-05-04 13:48 ` Kent Gibson
  2023-05-04 16:20 ` andy.shevchenko
  1 sibling, 0 replies; 5+ messages in thread
From: Kent Gibson @ 2023-05-04 13:48 UTC (permalink / raw)
  To: Milo Spadacini; +Cc: linus.walleij, brgl, linux-gpio

On Thu, May 04, 2023 at 11:22:17AM +0200, Milo Spadacini wrote:
> Fix wrong output that could occurs when more attributes are used and

      incorrect output        occur


>  GPIO_V2_LINE_ATTR_ID_DEBOUNCE is not the first one.

Have you actually seen this fault occur anywhere?  I would expect not,
as the debounce_period is the ONLY attr that is returned in practice by
existing kernels. The flags and values attributes are never returned in
the attrs of the gpio_v2_line_info - the flags are returned in their own
field, as they are always present, and the values are not returned in
the info at all.  Those types may be used in the request for multple
lines, but are not returned in the attrs for a single line.

> ---
>  tools/gpio/lsgpio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/gpio/lsgpio.c b/tools/gpio/lsgpio.c
> index c61d061247e1..52a0be45410c 100644
> --- a/tools/gpio/lsgpio.c
> +++ b/tools/gpio/lsgpio.c
> @@ -94,7 +94,7 @@ static void print_attributes(struct gpio_v2_line_info *info)
>         for (i = 0; i < info->num_attrs; i++) {
>                 if (info->attrs[i].id == GPIO_V2_LINE_ATTR_ID_DEBOUNCE)
>                         fprintf(stdout, ", debounce_period=%dusec",
> -                               info->attrs[0].debounce_period_us);
> +                               info->attrs[i].debounce_period_us);
>         }
>  }
> 

The fix itself is ok for debounce, so no issue with that.

But if there are multiple attributes, as you suggest in your comment,
then how about printing the rest of them rather than omitting them?
So perhaps replace this with an exhaustive decoder for all possible
attributes - probably implemented as a switch on the id and include a
"what the??" for the default case?
The flags and values types could be covered by the default, given we
don't expect them, but if so then add a comment to that effect.

Cheers,
Kent.

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

* Re: [PATCH] tools: gpio: fix debounce_period_us output of lsgpio
  2023-05-04  9:22 [PATCH] tools: gpio: fix debounce_period_us output of lsgpio Milo Spadacini
  2023-05-04 13:48 ` Kent Gibson
@ 2023-05-04 16:20 ` andy.shevchenko
  1 sibling, 0 replies; 5+ messages in thread
From: andy.shevchenko @ 2023-05-04 16:20 UTC (permalink / raw)
  To: Milo Spadacini; +Cc: linus.walleij, brgl, linux-gpio

Thu, May 04, 2023 at 11:22:17AM +0200, Milo Spadacini kirjoitti:

...

> NORME DI ACCESSO E DI COMPORTAMENTO PER ESTERNI<https://www.comelitgroup.com/it-it/norme-accesso-comportamento-esterni>
> 
> AVVISO DI CONFIDENZIALIT? E PRIVACY
> Questo messaggio ed i suoi eventuali allegati possono contenere informazioni confidenziali, di propriet?, legalmente protette. ? destinato all'utilizzo esclusivo del destinatario sopra indicato; la natura privata e la confidenzialit? non sono modificati da eventuali errori di trasmissione, pur avendo il mittente assunto tutte le misure di sicurezza idonee e preventive per evitarli. Il trattamento dei dati ivi contenuti, e quelli che verranno forniti in risposta, ? realizzato in conformit? alla normativa sulla privacy Reg 679/2016, potrete prendere visione della informativa anche visitando il sito www.comelitgroup.com ovvero sulle app Comelit. Rispondendo alla presente mail dichiarate di aver preso visione della richiamata informativa e di aver prestato il consenso al trattamento dei dati personali. Se il messaggio non ? a lei destinato, non deve utilizzarlo, diffonderlo, copiarlo con qualunque mezzo, o intraprendere azioni basandosi su di esso. Se ha ricevuto questo messaggio per errore, la preghiamo di volerlo distruggere (unitamente ad eventuali copie dello stesso e suoi allegati) e di volerci cortesemente informare del fatto scrivendo al mittente.
> CONFIDENTIALITY NOTICE AND PRIVACY
> This message and its attachments (if any) may contain confidential, proprietary or legally privileged information and it is intended only for the use of the addressee named above. No confidentiality or privilege is waived or lost by any erroneous transmission, despite having taken all the security and preventative measures to avoid it. The processing of personal data contained therein, and those that will be provided in response, is made in compliance with the privacy regulation Reg 679/2016, you can also read the information by visiting www.comelitgroup.com or on Comelit apps. Responding to this email, you declare that you have read the aforementioned information and have given consent to the processing of personal data If you are not the intended recipient of this message, you are hereby notified that you must not use, disseminate, copy it in any form or take any action in reliance on it. If you have received this message in error, please, delete it (and any copies of it and attachment) and kindly inform the sender.

With this footer we may not accept the change, sorry.
You have to remove it.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH] tools: gpio: fix debounce_period_us output of lsgpio
       [not found] <CA+1hoUVnw7kXB15rzK=tQdX2cyGMoXEgThOiqA=pYDwqF6TAwQ@mail.gmail.com>
@ 2023-05-05 11:32 ` Linus Walleij
  2023-05-05 14:18   ` Kent Gibson
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2023-05-05 11:32 UTC (permalink / raw)
  To: Milo Spadacini; +Cc: andy.shevchenko, brgl, linux-gpio

On Fri, May 5, 2023 at 7:57 AM Milo Spadacini <milo.spadacini@gmail.com> wrote:

> Fix incorrect output that could occur when more attributes are used and
>  GPIO_V2_LINE_ATTR_ID_DEBOUNCE is not the first one.

Nice patch! And correct. But hard to apply!
Can you resend:
- Including a Signed-off-by: Milo Spadacini <milo.spadacini@gmail.com> line
- Not using HTML encoding
?

Here is some generic help on sending email to the lists:
https://docs.kernel.org/process/email-clients.html

Yours,
Linus Walleij

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

* Re: [PATCH] tools: gpio: fix debounce_period_us output of lsgpio
  2023-05-05 11:32 ` Linus Walleij
@ 2023-05-05 14:18   ` Kent Gibson
  0 siblings, 0 replies; 5+ messages in thread
From: Kent Gibson @ 2023-05-05 14:18 UTC (permalink / raw)
  To: Milo Spadacini; +Cc: Linus Walleij, andy.shevchenko, brgl, linux-gpio

On Fri, May 05, 2023 at 01:32:59PM +0200, Linus Walleij wrote:
> On Fri, May 5, 2023 at 7:57 AM Milo Spadacini <milo.spadacini@gmail.com> wrote:
> 
> > Fix incorrect output that could occur when more attributes are used and
> >  GPIO_V2_LINE_ATTR_ID_DEBOUNCE is not the first one.
> 
> Nice patch! And correct. But hard to apply!
> Can you resend:
> - Including a Signed-off-by: Milo Spadacini <milo.spadacini@gmail.com> line
> - Not using HTML encoding
> ?
> 
> Here is some generic help on sending email to the lists:
> https://docs.kernel.org/process/email-clients.html
> 

And, assuming this is the updated patch, the subject should begin "[PATCH
v2]"

Cheers,
Kent.

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

end of thread, other threads:[~2023-05-05 14:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-04  9:22 [PATCH] tools: gpio: fix debounce_period_us output of lsgpio Milo Spadacini
2023-05-04 13:48 ` Kent Gibson
2023-05-04 16:20 ` andy.shevchenko
     [not found] <CA+1hoUVnw7kXB15rzK=tQdX2cyGMoXEgThOiqA=pYDwqF6TAwQ@mail.gmail.com>
2023-05-05 11:32 ` Linus Walleij
2023-05-05 14:18   ` Kent Gibson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).