Skip to content

Commit ba9de35

Browse files
jwrdegoedeBenjamin Tissoires
authored andcommitted
HID: logitech-hidpp: Move get_wireless_feature_index() check to hidpp_connect_event()
Calling get_wireless_feature_index() from probe() causes the wireless_feature_index to only get set for unifying devices which are already connected at probe() time. It does not get set for devices which connect later. Fix this by moving get_wireless_feature_index() to hidpp_connect_event(), this does not make a difference for devices connected at probe() since probe() will queue the hidpp_connect_event() for those at probe time. This series has been tested on the following devices: Logitech Bluetooth Laser Travel Mouse (bluetooth, HID++ 1.0) Logitech M720 Triathlon (bluetooth, HID++ 4.5) Logitech M720 Triathlon (unifying, HID++ 4.5) Logitech K400 Pro (unifying, HID++ 4.1) Logitech K270 (eQUAD nano Lite, HID++ 2.0) Logitech M185 (eQUAD nano Lite, HID++ 4.5) Logitech LX501 keyboard (27 Mhz, HID++ builtin scroll-wheel, HID++ 1.0) Logitech M-RAZ105 mouse (27 Mhz, HID++ extra mouse buttons, HID++ 1.0) And by bentiss: Logitech Touchpad T650 (unifying) Logitech Touchpad T651 (bluetooth) Logitech MX Master 3B (BLE) Logitech G403 (plain USB / Gaming receiver) Fixes: 0da0a63 ("HID: logitech-hidpp: Support WirelessDeviceStatus connect events") Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Benjamin Tissoires <[email protected]>
1 parent 55bf703 commit ba9de35

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

drivers/hid/hid-logitech-hidpp.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,15 +1835,14 @@ static int hidpp_battery_get_property(struct power_supply *psy,
18351835
/* -------------------------------------------------------------------------- */
18361836
#define HIDPP_PAGE_WIRELESS_DEVICE_STATUS 0x1d4b
18371837

1838-
static int hidpp_set_wireless_feature_index(struct hidpp_device *hidpp)
1838+
static int hidpp_get_wireless_feature_index(struct hidpp_device *hidpp, u8 *feature_index)
18391839
{
18401840
u8 feature_type;
18411841
int ret;
18421842

18431843
ret = hidpp_root_get_feature(hidpp,
18441844
HIDPP_PAGE_WIRELESS_DEVICE_STATUS,
1845-
&hidpp->wireless_feature_index,
1846-
&feature_type);
1845+
feature_index, &feature_type);
18471846

18481847
return ret;
18491848
}
@@ -4249,6 +4248,13 @@ static void hidpp_connect_event(struct hidpp_device *hidpp)
42494248
}
42504249
}
42514250

4251+
if (hidpp->protocol_major >= 2) {
4252+
u8 feature_index;
4253+
4254+
if (!hidpp_get_wireless_feature_index(hidpp, &feature_index))
4255+
hidpp->wireless_feature_index = feature_index;
4256+
}
4257+
42524258
if (hidpp->name == hdev->name && hidpp->protocol_major >= 2) {
42534259
name = hidpp_get_device_name(hidpp);
42544260
if (name) {
@@ -4493,14 +4499,6 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id)
44934499
hidpp_overwrite_name(hdev);
44944500
}
44954501

4496-
if (connected && hidpp->protocol_major >= 2) {
4497-
ret = hidpp_set_wireless_feature_index(hidpp);
4498-
if (ret == -ENOENT)
4499-
hidpp->wireless_feature_index = 0;
4500-
else if (ret)
4501-
goto hid_hw_init_fail;
4502-
}
4503-
45044502
if (connected && (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP)) {
45054503
ret = wtp_get_config(hidpp);
45064504
if (ret)

0 commit comments

Comments
 (0)