Skip to content

Commit 411a20d

Browse files
pfactumJiri Kosina
authored andcommitted
HID: logitech-hidpp: Do not flood kernel log
Since commit 680ee41 ("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/[email protected]/ Signed-off-by: Oleksandr Natalenko <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 764ad6b commit 411a20d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

drivers/hid/hid-logitech-hidpp.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ struct hidpp_device {
203203
struct hidpp_scroll_counter vertical_wheel_counter;
204204

205205
u8 wireless_feature_index;
206+
207+
bool connected_once;
206208
};
207209

208210
/* HID++ 1.0 error codes */
@@ -988,8 +990,13 @@ static int hidpp_root_get_protocol_version(struct hidpp_device *hidpp)
988990
hidpp->protocol_minor = response.rap.params[1];
989991

990992
print_version:
991-
hid_info(hidpp->hid_dev, "HID++ %u.%u device connected.\n",
992-
hidpp->protocol_major, hidpp->protocol_minor);
993+
if (!hidpp->connected_once) {
994+
hid_info(hidpp->hid_dev, "HID++ %u.%u device connected.\n",
995+
hidpp->protocol_major, hidpp->protocol_minor);
996+
hidpp->connected_once = true;
997+
} else
998+
hid_dbg(hidpp->hid_dev, "HID++ %u.%u device connected.\n",
999+
hidpp->protocol_major, hidpp->protocol_minor);
9931000
return 0;
9941001
}
9951002

@@ -4184,7 +4191,7 @@ static void hidpp_connect_event(struct work_struct *work)
41844191
/* Get device version to check if it is connected */
41854192
ret = hidpp_root_get_protocol_version(hidpp);
41864193
if (ret) {
4187-
hid_info(hidpp->hid_dev, "Disconnected\n");
4194+
hid_dbg(hidpp->hid_dev, "Disconnected\n");
41884195
if (hidpp->battery.ps) {
41894196
hidpp->battery.online = false;
41904197
hidpp->battery.status = POWER_SUPPLY_STATUS_UNKNOWN;

0 commit comments

Comments
 (0)