2023-02-06 22:13:09

by Bastien Nocera

[permalink] [raw]
Subject: [PATCH v2 1/3] HID: logitech-hidpp: Add more debug statements

This should help us figure out some hairy problems with some devices.

Signed-off-by: Bastien Nocera <[email protected]>
---

Fixed kernel test bot warning:
drivers/hid/hid-logitech-hidpp.c: In function 'hidpp_send_fap_command_sync':
>> drivers/hid/hid-logitech-hidpp.c:343:25: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'unsigned int' [-Wformat=]
343 | "Invalid number of parameters passed to command (%d != %ld)\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

drivers/hid/hid-logitech-hidpp.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index f44ba7be3cc5..1952d8d3b6b2 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -338,8 +338,13 @@ static int hidpp_send_fap_command_sync(struct hidpp_device *hidpp,
struct hidpp_report *message;
int ret;

- if (param_count > sizeof(message->fap.params))
+ if (param_count > sizeof(message->fap.params)) {
+ hid_dbg(hidpp->hid_dev,
+ "Invalid number of parameters passed to command (%d != %llu)\n",
+ param_count,
+ (unsigned long long) sizeof(message->fap.params));
return -EINVAL;
+ }

message = kzalloc(sizeof(struct hidpp_report), GFP_KERNEL);
if (!message)
@@ -3440,11 +3445,17 @@ static int hi_res_scroll_enable(struct hidpp_device *hidpp)
ret = hidpp10_enable_scrolling_acceleration(hidpp);
multiplier = 8;
}
- if (ret)
+ if (ret) {
+ hid_dbg(hidpp->hid_dev,
+ "Could not enable hi-res scrolling: %d\n", ret);
return ret;
+ }

- if (multiplier == 0)
+ if (multiplier == 0) {
+ hid_dbg(hidpp->hid_dev,
+ "Invalid multiplier 0 from device, setting it to 1\n");
multiplier = 1;
+ }

hidpp->vertical_wheel_counter.wheel_multiplier = multiplier;
hid_dbg(hidpp->hid_dev, "wheel multiplier = %d\n", multiplier);
--
2.39.1



2023-02-06 22:13:12

by Bastien Nocera

[permalink] [raw]
Subject: [PATCH v2 3/3] HID: logitech-hidpp: Add myself to authors

Signed-off-by: Bastien Nocera <[email protected]>
---

Same as v1

drivers/hid/hid-logitech-hidpp.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index 9e94026de437..03b77ca03081 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -30,6 +30,7 @@
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Benjamin Tissoires <[email protected]>");
MODULE_AUTHOR("Nestor Lopez Casado <[email protected]>");
+MODULE_AUTHOR("Bastien Nocera <[email protected]>");

static bool disable_tap_to_click;
module_param(disable_tap_to_click, bool, 0644);
--
2.39.1


2023-02-09 14:54:33

by Benjamin Tissoires

[permalink] [raw]
Subject: Re: [PATCH v2 3/3] HID: logitech-hidpp: Add myself to authors

On Feb 06 2023, Bastien Nocera wrote:
> Signed-off-by: Bastien Nocera <[email protected]>
> ---
>
> Same as v1
>
> drivers/hid/hid-logitech-hidpp.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
> index 9e94026de437..03b77ca03081 100644
> --- a/drivers/hid/hid-logitech-hidpp.c
> +++ b/drivers/hid/hid-logitech-hidpp.c
> @@ -30,6 +30,7 @@
> MODULE_LICENSE("GPL");
> MODULE_AUTHOR("Benjamin Tissoires <[email protected]>");
> MODULE_AUTHOR("Nestor Lopez Casado <[email protected]>");
> +MODULE_AUTHOR("Bastien Nocera <[email protected]>");

Just FTR, I have asked Bastien to set himself as an author given all of
the work he has been doing on this and to have one more person to be the
go-to person from folks having an issue.

And Bastien, would you mind adding yourself to the MAINTAINERS file too?
This way you'll get Cc-ed when people submit patches.

Cheers,
Benjamin

>
> static bool disable_tap_to_click;
> module_param(disable_tap_to_click, bool, 0644);
> --
> 2.39.1
>


2023-02-09 14:55:36

by Benjamin Tissoires

[permalink] [raw]
Subject: Re: [PATCH v2 1/3] HID: logitech-hidpp: Add more debug statements

On Feb 06 2023, Bastien Nocera wrote:
> This should help us figure out some hairy problems with some devices.
>
> Signed-off-by: Bastien Nocera <[email protected]>

FWIW, I am currently testing this patch and will probably push it today.

Cheers,
Benjamin

> ---
>
> Fixed kernel test bot warning:
> drivers/hid/hid-logitech-hidpp.c: In function 'hidpp_send_fap_command_sync':
> >> drivers/hid/hid-logitech-hidpp.c:343:25: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'unsigned int' [-Wformat=]
> 343 | "Invalid number of parameters passed to command (%d != %ld)\n",
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> drivers/hid/hid-logitech-hidpp.c | 17 ++++++++++++++---
> 1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
> index f44ba7be3cc5..1952d8d3b6b2 100644
> --- a/drivers/hid/hid-logitech-hidpp.c
> +++ b/drivers/hid/hid-logitech-hidpp.c
> @@ -338,8 +338,13 @@ static int hidpp_send_fap_command_sync(struct hidpp_device *hidpp,
> struct hidpp_report *message;
> int ret;
>
> - if (param_count > sizeof(message->fap.params))
> + if (param_count > sizeof(message->fap.params)) {
> + hid_dbg(hidpp->hid_dev,
> + "Invalid number of parameters passed to command (%d != %llu)\n",
> + param_count,
> + (unsigned long long) sizeof(message->fap.params));
> return -EINVAL;
> + }
>
> message = kzalloc(sizeof(struct hidpp_report), GFP_KERNEL);
> if (!message)
> @@ -3440,11 +3445,17 @@ static int hi_res_scroll_enable(struct hidpp_device *hidpp)
> ret = hidpp10_enable_scrolling_acceleration(hidpp);
> multiplier = 8;
> }
> - if (ret)
> + if (ret) {
> + hid_dbg(hidpp->hid_dev,
> + "Could not enable hi-res scrolling: %d\n", ret);
> return ret;
> + }
>
> - if (multiplier == 0)
> + if (multiplier == 0) {
> + hid_dbg(hidpp->hid_dev,
> + "Invalid multiplier 0 from device, setting it to 1\n");
> multiplier = 1;
> + }
>
> hidpp->vertical_wheel_counter.wheel_multiplier = multiplier;
> hid_dbg(hidpp->hid_dev, "wheel multiplier = %d\n", multiplier);
> --
> 2.39.1
>


2023-02-09 15:40:45

by Benjamin Tissoires

[permalink] [raw]
Subject: Re: (subset) [PATCH v2 1/3] HID: logitech-hidpp: Add more debug statements

On Mon, 06 Feb 2023 23:12:54 +0100, Bastien Nocera wrote:
> This should help us figure out some hairy problems with some devices.
>
>

Applied to hid/hid.git (for-6.3/logitech), thanks!

[1/3] HID: logitech-hidpp: Add more debug statements
https://git.kernel.org/hid/hid/c/db5167cfaa0a

Cheers,
--
Benjamin Tissoires <[email protected]>


2023-02-09 15:50:38

by Bastien Nocera

[permalink] [raw]
Subject: Re: [PATCH v2 3/3] HID: logitech-hidpp: Add myself to authors

On Thu, 2023-02-09 at 15:53 +0100, Benjamin Tissoires wrote:
> On Feb 06 2023, Bastien Nocera wrote:
> > Signed-off-by: Bastien Nocera <[email protected]>
> > ---
> >
> > Same as v1
> >
> >  drivers/hid/hid-logitech-hidpp.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-
> > logitech-hidpp.c
> > index 9e94026de437..03b77ca03081 100644
> > --- a/drivers/hid/hid-logitech-hidpp.c
> > +++ b/drivers/hid/hid-logitech-hidpp.c
> > @@ -30,6 +30,7 @@
> >  MODULE_LICENSE("GPL");
> >  MODULE_AUTHOR("Benjamin Tissoires
> > <[email protected]>");
> >  MODULE_AUTHOR("Nestor Lopez Casado <[email protected]>");
> > +MODULE_AUTHOR("Bastien Nocera <[email protected]>");
>
> Just FTR, I have asked Bastien to set himself as an author given all
> of
> the work he has been doing on this and to have one more person to be
> the
> go-to person from folks having an issue.
>
> And Bastien, would you mind adding yourself to the MAINTAINERS file
> too?
> This way you'll get Cc-ed when people submit patches.

Done in v3 specifically for the hidpp file.