Skip to content

Commit 1a57504

Browse files
LawstorantJiri Kosina
authored andcommitted
HID: pidff: Compute INFINITE value instead of using hardcoded 0xffff
As per USB PID standard: INFINITE - Referrers to the maximum value of a range. i.e. if in an 8 bit unsigned field the value of 255 would indicate INFINITE. Detecting 0xffff (U16_MAX) is still important as we MIGHT get this value as infinite from some native software as 0 was never actually defined in Linux' FF api as the infinite value. I'm working on it though. Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent 0c6673e commit 1a57504

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/hid/usbhid/hid-pidff.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,9 @@ static void pidff_set_duration(struct pidff_usage *usage, u16 duration)
283283
if (duration == FF_INFINITE)
284284
duration = PID_INFINITE;
285285

286+
/* PID defines INFINITE as the max possible value for duration field */
286287
if (duration == PID_INFINITE) {
287-
usage->value[0] = PID_INFINITE;
288+
usage->value[0] = (1U << usage->field->report_size) - 1;
288289
return;
289290
}
290291

0 commit comments

Comments
 (0)