]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
HID: pidff: PERMISSIVE_CONTROL quirk autodetection
authorTomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Wed, 13 Aug 2025 20:10:00 +0000 (22:10 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Nov 2025 20:37:02 +0000 (15:37 -0500)
[ Upstream commit c2dc9f0b368c08c34674311cf78407718d5715a7 ]

Fixes force feedback for devices built with MMOS firmware and many more
not yet detected devices.

Update quirks mask debug message to always contain all 32 bits of data.

Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hid/usbhid/hid-pidff.c

index c6b4f61e535d59cb44d29be2ca38fb4e0b2c9221..711eefff853bb137900018d54601e9a8e42b56e2 100644 (file)
@@ -1151,8 +1151,16 @@ static int pidff_find_special_fields(struct pidff_device *pidff)
                                         PID_DIRECTION, 0);
        pidff->device_control =
                pidff_find_special_field(pidff->reports[PID_DEVICE_CONTROL],
-                       PID_DEVICE_CONTROL_ARRAY,
-                       !(pidff->quirks & HID_PIDFF_QUIRK_PERMISSIVE_CONTROL));
+                       PID_DEVICE_CONTROL_ARRAY, 1);
+
+       /* Detect and set permissive control quirk */
+       if (!pidff->device_control) {
+               pr_debug("Setting PERMISSIVE_CONTROL quirk\n");
+               pidff->quirks |= HID_PIDFF_QUIRK_PERMISSIVE_CONTROL;
+               pidff->device_control = pidff_find_special_field(
+                       pidff->reports[PID_DEVICE_CONTROL],
+                       PID_DEVICE_CONTROL_ARRAY, 0);
+       }
 
        pidff->block_load_status =
                pidff_find_special_field(pidff->reports[PID_BLOCK_LOAD],
@@ -1492,7 +1500,7 @@ int hid_pidff_init_with_quirks(struct hid_device *hid, u32 initial_quirks)
        ff->playback = pidff_playback;
 
        hid_info(dev, "Force feedback for USB HID PID devices by Anssi Hannula <anssi.hannula@gmail.com>\n");
-       hid_dbg(dev, "Active quirks mask: 0x%x\n", pidff->quirks);
+       hid_dbg(dev, "Active quirks mask: 0x%08x\n", pidff->quirks);
 
        hid_device_io_stop(hid);