]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
HID: pidff: Fix needs_playback check
authorTomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Mon, 3 Nov 2025 20:02:43 +0000 (21:02 +0100)
committerJiri Kosina <jkosina@suse.com>
Tue, 18 Nov 2025 17:04:28 +0000 (18:04 +0100)
A small bug made it's way here when rewriting code to Linux quality.
Currently, if an effect is not infinite and a program requests it's
playback with the same number of loops, the play command won't be fired
and if an effect is infinite, the spam will continue.

We want every playback update for non-infinite effects and only some
for infinite (detecting when a program requests stop with 0 which will
be different than previous value which is usually 1 or 255).

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

index edd61ef50e16a2c2ea287580b1b62071555c4ba9..95377c5f63356b067379b754a02f7524df770d8d 100644 (file)
@@ -806,8 +806,8 @@ static int pidff_request_effect_upload(struct pidff_device *pidff, int efnum)
 
 static int pidff_needs_playback(struct pidff_device *pidff, int effect_id, int n)
 {
-       return pidff->effect[effect_id].is_infinite ||
-              pidff->effect[effect_id].loop_count != n;
+       return !pidff->effect[effect_id].is_infinite ||
+               pidff->effect[effect_id].loop_count != n;
 }
 
 /*