* [PATCH] HID: logitech-hidpp: Do not flood kernel log
@ 2024-01-29 16:49 Oleksandr Natalenko
2024-01-29 16:54 ` Hans de Goede
0 siblings, 1 reply; 3+ messages in thread
From: Oleksandr Natalenko @ 2024-01-29 16:49 UTC (permalink / raw)
To: linux-kernel
Cc: linux-input, Filipe Laíns, Bastien Nocera, Jiri Kosina,
Benjamin Tissoires, Hans de Goede
Since commit 680ee411a98e ("HID: logitech-hidpp: Fix connect event race")
the following messages appear in the kernel log from time to time:
logitech-hidpp-device 0003:046D:408A.0005: HID++ 4.5 device connected.
logitech-hidpp-device 0003:046D:408A.0005: HID++ 4.5 device connected.
logitech-hidpp-device 0003:046D:4051.0006: Disconnected
logitech-hidpp-device 0003:046D:408A.0005: Disconnected
As discussed, print the first per-device "device connected" message
at info level, demoting subsequent messages to debug level. Also,
demote the "Disconnected message" to debug level unconditionally.
Link: https://lore.kernel.org/lkml/3277085.44csPzL39Z@natalenko.name/
Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
---
drivers/hid/hid-logitech-hidpp.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index 6ef0c88e3e60a..d2f3f234f29de 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -203,6 +203,8 @@ struct hidpp_device {
struct hidpp_scroll_counter vertical_wheel_counter;
u8 wireless_feature_index;
+
+ bool connected_once;
};
/* HID++ 1.0 error codes */
@@ -988,8 +990,13 @@ static int hidpp_root_get_protocol_version(struct hidpp_device *hidpp)
hidpp->protocol_minor = response.rap.params[1];
print_version:
- hid_info(hidpp->hid_dev, "HID++ %u.%u device connected.\n",
- hidpp->protocol_major, hidpp->protocol_minor);
+ if (!hidpp->connected_once) {
+ hid_info(hidpp->hid_dev, "HID++ %u.%u device connected.\n",
+ hidpp->protocol_major, hidpp->protocol_minor);
+ hidpp->connected_once = true;
+ } else
+ hid_dbg(hidpp->hid_dev, "HID++ %u.%u device connected.\n",
+ hidpp->protocol_major, hidpp->protocol_minor);
return 0;
}
@@ -4184,7 +4191,7 @@ static void hidpp_connect_event(struct work_struct *work)
/* Get device version to check if it is connected */
ret = hidpp_root_get_protocol_version(hidpp);
if (ret) {
- hid_info(hidpp->hid_dev, "Disconnected\n");
+ hid_dbg(hidpp->hid_dev, "Disconnected\n");
if (hidpp->battery.ps) {
hidpp->battery.online = false;
hidpp->battery.status = POWER_SUPPLY_STATUS_UNKNOWN;
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] HID: logitech-hidpp: Do not flood kernel log
2024-01-29 16:49 [PATCH] HID: logitech-hidpp: Do not flood kernel log Oleksandr Natalenko
@ 2024-01-29 16:54 ` Hans de Goede
2024-02-06 15:11 ` Jiri Kosina
0 siblings, 1 reply; 3+ messages in thread
From: Hans de Goede @ 2024-01-29 16:54 UTC (permalink / raw)
To: Oleksandr Natalenko, linux-kernel
Cc: linux-input, Filipe Laíns, Bastien Nocera, Jiri Kosina,
Benjamin Tissoires
Hi,
On 1/29/24 17:49, Oleksandr Natalenko wrote:
> Since commit 680ee411a98e ("HID: logitech-hidpp: Fix connect event race")
> the following messages appear in the kernel log from time to time:
>
> logitech-hidpp-device 0003:046D:408A.0005: HID++ 4.5 device connected.
> logitech-hidpp-device 0003:046D:408A.0005: HID++ 4.5 device connected.
> logitech-hidpp-device 0003:046D:4051.0006: Disconnected
> logitech-hidpp-device 0003:046D:408A.0005: Disconnected
>
> As discussed, print the first per-device "device connected" message
> at info level, demoting subsequent messages to debug level. Also,
> demote the "Disconnected message" to debug level unconditionally.
>
> Link: https://lore.kernel.org/lkml/3277085.44csPzL39Z@natalenko.name/
> Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Thanks, patch looks good to me:
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Regards,
Hans
> ---
> drivers/hid/hid-logitech-hidpp.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
> index 6ef0c88e3e60a..d2f3f234f29de 100644
> --- a/drivers/hid/hid-logitech-hidpp.c
> +++ b/drivers/hid/hid-logitech-hidpp.c
> @@ -203,6 +203,8 @@ struct hidpp_device {
> struct hidpp_scroll_counter vertical_wheel_counter;
>
> u8 wireless_feature_index;
> +
> + bool connected_once;
> };
>
> /* HID++ 1.0 error codes */
> @@ -988,8 +990,13 @@ static int hidpp_root_get_protocol_version(struct hidpp_device *hidpp)
> hidpp->protocol_minor = response.rap.params[1];
>
> print_version:
> - hid_info(hidpp->hid_dev, "HID++ %u.%u device connected.\n",
> - hidpp->protocol_major, hidpp->protocol_minor);
> + if (!hidpp->connected_once) {
> + hid_info(hidpp->hid_dev, "HID++ %u.%u device connected.\n",
> + hidpp->protocol_major, hidpp->protocol_minor);
> + hidpp->connected_once = true;
> + } else
> + hid_dbg(hidpp->hid_dev, "HID++ %u.%u device connected.\n",
> + hidpp->protocol_major, hidpp->protocol_minor);
> return 0;
> }
>
> @@ -4184,7 +4191,7 @@ static void hidpp_connect_event(struct work_struct *work)
> /* Get device version to check if it is connected */
> ret = hidpp_root_get_protocol_version(hidpp);
> if (ret) {
> - hid_info(hidpp->hid_dev, "Disconnected\n");
> + hid_dbg(hidpp->hid_dev, "Disconnected\n");
> if (hidpp->battery.ps) {
> hidpp->battery.online = false;
> hidpp->battery.status = POWER_SUPPLY_STATUS_UNKNOWN;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] HID: logitech-hidpp: Do not flood kernel log
2024-01-29 16:54 ` Hans de Goede
@ 2024-02-06 15:11 ` Jiri Kosina
0 siblings, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2024-02-06 15:11 UTC (permalink / raw)
To: Hans de Goede
Cc: Oleksandr Natalenko, linux-kernel, linux-input, Filipe Laíns,
Bastien Nocera, Benjamin Tissoires
On Mon, 29 Jan 2024, Hans de Goede wrote:
> > Since commit 680ee411a98e ("HID: logitech-hidpp: Fix connect event race")
> > the following messages appear in the kernel log from time to time:
> >
> > logitech-hidpp-device 0003:046D:408A.0005: HID++ 4.5 device connected.
> > logitech-hidpp-device 0003:046D:408A.0005: HID++ 4.5 device connected.
> > logitech-hidpp-device 0003:046D:4051.0006: Disconnected
> > logitech-hidpp-device 0003:046D:408A.0005: Disconnected
> >
> > As discussed, print the first per-device "device connected" message
> > at info level, demoting subsequent messages to debug level. Also,
> > demote the "Disconnected message" to debug level unconditionally.
> >
> > Link: https://lore.kernel.org/lkml/3277085.44csPzL39Z@natalenko.name/
> > Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
>
> Thanks, patch looks good to me:
>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Applied to hid.git#for-6.8/upstream-fixes. Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-06 15:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-29 16:49 [PATCH] HID: logitech-hidpp: Do not flood kernel log Oleksandr Natalenko
2024-01-29 16:54 ` Hans de Goede
2024-02-06 15:11 ` Jiri Kosina
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).