aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
Commit message (Collapse)AuthorAgeFilesLines
* treewide: Switch/rename to timer_delete[_sync]()Thomas Gleixner2025-04-0512-16/+16
| | | | | | | | | | timer_delete[_sync]() replaces del_timer[_sync](). Convert the whole tree over and remove the historical wrapper inlines. Conversion was done with coccinelle plus manual fixups where necessary. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
* Merge branch 'for-6.15/wacom' into for-linusJiri Kosina2025-03-263-23/+27
|\ | | | | | | - removal of WACOM_PKGLEN_MAX limit in Wacom driver (Jason Gerecke)
| * HID: wacom: Remove static WACOM_PKGLEN_MAX limitJason Gerecke2025-03-043-23/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than memcpy every packet that we receive from HID into our own local fixed-size array, we can just access the data directly through the original pointer. While we're at it, remove the few other places that assume a fixed maximum packet size and make them dynamic (in particular: temporary buffers created by the wacom_wac_queue_flush and wacom_intuos_bt_process_data functions; and the pen_fifo FIFO). To ensure pen_fifo allocation has access to the maximum used packet length, this commit also moves the function call to occur a little later in the probe process. Signed-off-by: Jason Gerecke <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
* | Merge branch 'for-6.15/usb-hidbp' into for-linusJiri Kosina2025-03-261-1/+1
|\ \ | | | | | | | | | - fix for LED_KANA handling in hidbp (junan)
| * | HID: usbkbd: Fix the bit shift number for LED_KANAjunan2025-02-031-1/+1
| | | | | | | | | | | | | | | | | | | | | Since "LED_KANA" was defined as "0x04", the shift number should be "4". Signed-off-by: junan <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
* | | Merge branch 'for-6.15/steam' into for-linusJiri Kosina2025-03-261-5/+2
|\ \ \ | | | | | | | | | | | | - code cleanup (Vicki Pfau)
| * | | HID: hid-steam: Mutex cleanup in steam_set_lizard_mode()Vicki Pfau2025-02-071-5/+2
| |/ / | | | | | | | | | | | | | | | | | | | | | Both branches of this if/else start with mutex_lock and end with mutex_unlock. This hoists the mutex lock/unlock outside of the if statement for simplicity. Signed-off-by: Vicki Pfau <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
* | | Merge branch 'for-6.15/sony' into for-linusJiri Kosina2025-03-261-5/+11
|\ \ \ | | | | | | | | | | | | - PlayStation 5 controllers support (Alex Henrie)
| * | | HID: Enable playstation driver for PlayStation 5 controllersAlex Henrie2025-02-081-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without entries in the hid_have_special_driver table, PS5 controllers default to the hidraw driver instead of the hid-playstation driver. Signed-off-by: Alex Henrie <[email protected]> Acked-by: Roderick Colenbrander <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: Enable playstation driver independently of sony driverAlex Henrie2025-02-081-5/+7
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PlayStation 4 controllers use the hid-playstation driver now, but they are still not included in the hid_have_special_driver table unless the hid-sony driver is enabled. Split up that section of the table so that hid-playstation works even in the absence of hid-sony. Fixes: 4f1f391869ee ("HID: sony: remove DualShock4 support.") Signed-off-by: Alex Henrie <[email protected]> Acked-by: Roderick Colenbrander <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
* | | Merge branch 'for-6.15/plantronics' into for-linusJiri Kosina2025-03-261-77/+67
|\ \ \ | | | | | | | | | | | | - improved mute handling (Terry Junge)
| * | | HID: hid-plantronics: Add mic mute mapping and generalize quirksTerry Junge2025-02-031-77/+67
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add mapping for headset mute key events. Remove PLT_QUIRK_DOUBLE_VOLUME_KEYS quirk and made it generic. The quirk logic did not keep track of the actual previous key so any key event occurring in less than or equal to 5ms was ignored. Remove PLT_QUIRK_FOLLOWED_OPPOSITE_VOLUME_KEYS quirk. It had the same logic issue as the double key quirk and was actually masking the as designed behavior of most of the headsets. It's occurrence should be minimized with the ALSA control naming quirk that is part of the patch set. Signed-off-by: Terry Junge <[email protected]> Cc: [email protected] Signed-off-by: Jiri Kosina <[email protected]>
* | | Merge branch 'for-6.15/pidff' into for-linusJiri Kosina2025-03-267-197/+660
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From: Tomasz Pakuła <[email protected]> This patch series is focused on improving the compatibility and usability of the hid-pidff force feedback driver. Last patch introduces a new, universal driver for PID devices that need some special handling like report fixups, remapping the button range, managing new pidff quirks and setting desirable fuzz/flat values. This work has been done in the span of the past months with the help of the great Linux simracing community, with a little input from sim flight fans from FFBeast. No changes interfere with compliant and currently working PID devices. "Generic" codepath was tested as well with Moza and Simxperience AccuForce v2. I'm not married to the name. It's what we used previously, but if "universal" is confusing (pidff is already the generic driver), we can come up with something better like "hid-quirky-pidff" :) With v8 and tiny finx in v9, all the outstanding issues were resolved, additional pidff issues were fixed and hid-pidff defines moved to a dedicated header file. This patch series could be considered done bar any comments and requests from input maintainers. I could save more then a dozen lines of code by changing simple if statements to only occupy on line instead of two in there's a need for that.
| * | | HID: pidff: Fix set_device_control()Tomasz Pakuła2025-03-041-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As the search for Device Control report is permissive, make sure the desired field was actually found, before trying to set it. Fix bitmask clearing as it was erronously using index instead of index - 1 (HID arrays index is 1-based). Add last two missing Device Control usages to the defined array. PID_PAUSE and PID_CONTINUE. Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Fix 90 degrees direction name North -> EastTomasz Pakuła2025-03-041-1/+1
| | | | | | | | | | | | | | | | Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Compute INFINITE value instead of using hardcoded 0xffffTomasz Pakuła2025-03-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Clamp effect playback LOOP_COUNT valueTomasz Pakuła2025-03-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ensures the loop count will never exceed the logical_maximum. Fixes implementation errors happening when applications use the max value of int32/DWORD as the effect iterations. This could be observed when running software both native and in wine. Signed-off-by: Tomasz Pakuła <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Rename two functions to align them with naming conventionTomasz Pakuła2025-03-041-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Driver uses "set" everywhere to indicate setting report values and requesting HID_REQ_SET_REPORT Signed-off-by: Tomasz Pakuła <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: hid-universal-pidff: Fix spelling mistake "sucessfully" -> "successfully"Colin Ian King2025-02-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a spelling mistake in a hid_info message. Fix it. Signed-off-by: Colin Ian King <[email protected]> Acked-by: Tomasz Pakuła <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Remove redundant call to pidff_find_special_keysTomasz Pakuła2025-02-111-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Probably left out as a mistake after Anssi created the helper macro Signed-off-by: Tomasz Pakuła <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Support device error response from PID_BLOCK_LOADTomasz Pakuła2025-02-111-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If an error happens on the device, the driver will no longer fall into the trap of reading this status 60 times before it decides that this reply won't change to success/memory full. Greatly reduces communication overhead during device error situation. Signed-off-by: Tomasz Pakuła <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Comment and code style updateTomasz Pakuła2025-02-111-32/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Update comments to fully conform to the Linux comment styling. Define Linux infinite effect duration (0) as FF_INFINITE Chanage Oleg's name order Signed-off-by: Tomasz Pakuła <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: hid-universal-pidff: Add Asetek wheelbases supportTomasz Pakuła2025-02-112-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds Asetek vendor id and product ids for: - Invicta - Forte - La Prima - Tony Kanaan v2: - Misc spelling fix in driver loaded info v3: - Chanage Oleg's name order Signed-off-by: Tomasz Pakuła <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Make sure to fetch pool before checking SIMULTANEOUS_MAXTomasz Pakuła2025-02-111-16/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As noted by Anssi some 20 years ago, pool report is sometimes messed up. This worked fine on many devices but casued oops on VRS DirectForce PRO. Here, we're making sure pool report is refetched before trying to access any of it's fields. While loop was replaced with a for loop + exit conditions were moved aroud to decrease the possibility of creating an infinite loop scenario. Signed-off-by: Tomasz Pakuła <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Factor out pool report fetch and remove excess declarationTomasz Pakuła2025-02-031-21/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We only want to refetch the pool report during device init. Reset function is now called when uploading effects to an empty device so extract pool fetch to separate function and call it from init before autocenter check (autocenter check triggered reset during init). Remove a superfluous pointer declaration and assigment as well. Signed-off-by: Tomasz Pakuła <[email protected]> Reviewed-by: Michał Kopeć <[email protected]> Reviewed-by: Paul Dino Jones <[email protected]> Tested-by: Paul Dino Jones <[email protected]> Tested-by: Cristóferson Bueno <[email protected]> Tested-by: Pablo Cisneros <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Use macros instead of hardcoded min/max values for shortsTomasz Pakuła2025-02-031-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Makes it obvious these magic values ARE in fact derived from min and max values for s16 and u16 Signed-off-by: Tomasz Pakuła <[email protected]> Reviewed-by: Michał Kopeć <[email protected]> Reviewed-by: Paul Dino Jones <[email protected]> Tested-by: Paul Dino Jones <[email protected]> Tested-by: Cristóferson Bueno <[email protected]> Tested-by: Pablo Cisneros <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Simplify pidff_rescale_signedTomasz Pakuła2025-02-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function overrelies on ternary operators and makes it hard to parse it mentally. New version makes it very easy to understand. Signed-off-by: Tomasz Pakuła <[email protected]> Reviewed-by: Michał Kopeć <[email protected]> Reviewed-by: Paul Dino Jones <[email protected]> Tested-by: Paul Dino Jones <[email protected]> Tested-by: Cristóferson Bueno <[email protected]> Tested-by: Pablo Cisneros <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Move all hid-pidff definitions to a dedicated headerTomasz Pakuła2025-02-034-2/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not clutter hid includes with stuff not needed outside of the kernel. Signed-off-by: Tomasz Pakuła <[email protected]> Reviewed-by: Michał Kopeć <[email protected]> Reviewed-by: Paul Dino Jones <[email protected]> Tested-by: Paul Dino Jones <[email protected]> Tested-by: Cristóferson Bueno <[email protected]> Tested-by: Pablo Cisneros <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Fix null pointer dereference in pidff_find_fieldsTomasz Pakuła2025-02-031-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function triggered a null pointer dereference if used to search for a report that isn't implemented on the device. This happened both for optional and required reports alike. The same logic was applied to pidff_find_special_field and although pidff_init_fields should return an error earlier if one of the required reports is missing, future modifications could change this logic and resurface this possible null pointer dereference again. LKML bug report: https://lore.kernel.org/all/CAL-gK7f5=R0nrrQdPtaZZr1fd-cdAMbDMuZ_NLA8vM0SX+nGSw@mail.gmail.com Reported-by: Nolan Nicholson <[email protected]> Signed-off-by: Tomasz Pakuła <[email protected]> Reviewed-by: Michał Kopeć <[email protected]> Reviewed-by: Paul Dino Jones <[email protected]> Tested-by: Paul Dino Jones <[email protected]> Tested-by: Cristóferson Bueno <[email protected]> Tested-by: Pablo Cisneros <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Factor out code for setting gainTomasz Pakuła2025-02-031-11/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Makes it possible to easily set gain from inside hid-pidff.c Changes in v7: - Check if device gain field exists before setting device gain Signed-off-by: Tomasz Pakuła <[email protected]> Reviewed-by: Michał Kopeć <[email protected]> Reviewed-by: Paul Dino Jones <[email protected]> Tested-by: Paul Dino Jones <[email protected]> Tested-by: Cristóferson Bueno <[email protected]> Tested-by: Pablo Cisneros <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Rescale time values to match field unitsTomasz Pakuła2025-02-031-15/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PID devices can use different exponents for time fields, while Linux Force Feedback API only supports miliseconds. Read the exponent of a given time field and scale its value accordingly. Changes in v7: - Rescale all time fields, not only period changes in v9: - Properly assign fade_lenght, not attack_length to PID_FADE_TIME Co-developed-by: Makarenko Oleg <[email protected]> Signed-off-by: Makarenko Oleg <[email protected]> Signed-off-by: Tomasz Pakuła <[email protected]> Reviewed-by: Michał Kopeć <[email protected]> Reviewed-by: Paul Dino Jones <[email protected]> Tested-by: Paul Dino Jones <[email protected]> Tested-by: Cristóferson Bueno <[email protected]> Tested-by: Pablo Cisneros <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Define values used in pidff_find_special_fieldsTomasz Pakuła2025-02-031-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Makes it clear where did these values came from Signed-off-by: Tomasz Pakuła <[email protected]> Reviewed-by: Michał Kopeć <[email protected]> Reviewed-by: Paul Dino Jones <[email protected]> Tested-by: Paul Dino Jones <[email protected]> Tested-by: Cristóferson Bueno <[email protected]> Tested-by: Pablo Cisneros <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Simplify pidff_upload_effect functionTomasz Pakuła2025-02-031-38/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge a bit of code that reqeusts conditional effects upload. Makes it clear, that effect handling should be identical for SPRING, DAMPER, INERTIA and FRICTION. Signed-off-by: Tomasz Pakuła <[email protected]> Reviewed-by: Michał Kopeć <[email protected]> Reviewed-by: Paul Dino Jones <[email protected]> Tested-by: Paul Dino Jones <[email protected]> Tested-by: Cristóferson Bueno <[email protected]> Tested-by: Pablo Cisneros <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Completely rework and fix pidff_reset functionTomasz Pakuła2025-02-031-49/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, it was assumed that DEVICE_CONTROL usage is always an array but a lot of devices implements it as a bitmask variable. This led to the pidff_reset function not working and causing errors in such cases. Selectors can come in three types. One selection of a set, N selections and Any selection in form of bitmask as from USB Hid Usage Tables v1.5, subsection 3.4.2.1 Added pidff_send_device_control which handles usage flag check which decides whether DEVICE_CONTROL should be handled as "One selection of a set" or "Any selection of a set". Reset was triggered once, on device initialization. Now, it's triggered every time when uploading an effect to an empty device (no currently stored effects), tracked by pidff->effect_count variable. Co-developed-by: Makarenko Oleg <[email protected]> Signed-off-by: Makarenko Oleg <[email protected]> Signed-off-by: Tomasz Pakuła <[email protected]> Reviewed-by: Michał Kopeć <[email protected]> Reviewed-by: Paul Dino Jones <[email protected]> Tested-by: Paul Dino Jones <[email protected]> Tested-by: Cristóferson Bueno <[email protected]> Tested-by: Pablo Cisneros <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Add PERIODIC_SINE_ONLY quirkTomasz Pakuła2025-02-032-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some devices only support SINE periodic effect although they advertise support for all PERIODIC effect in their HID descriptor. Some just do nothing when trying to play such an effect (upload goes fine), some express undefined behavior like turning to one side. This quirk forces all the periodic effects to be uploaded as SINE. This is acceptable as all these effects are similar in nature and are mostly used as rumble. SINE is the most popular with others seldom used (especially SAW_UP and SAW_DOWN). Fixes periodic effects for PXN and LITE STAR wheels Signed-off-by: Tomasz Pakuła <[email protected]> Reviewed-by: Michał Kopeć <[email protected]> Reviewed-by: Paul Dino Jones <[email protected]> Tested-by: Cristóferson Bueno <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: Add hid-universal-pidff driver and supported device idsTomasz Pakuła2025-02-034-0/+238
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extend pidff compatibility, usable button range, manage pidff quirks and set improved fuzz/flat default for high precision devices. Possibility of fixing device descriptors in the future if such needs arises. As many of PID devices are quite similar and not dependent on custom drivers, this one can handle all of PID devices which need special care. Numerous sim racing/sim flight bases report a lot of buttons in excess of 100. Moza Racing exposes 128 of them and thus the need to extend the available range. All the included devices were tested and confirmed working with the help of the sim racing community. Changes in v6: - Support "split" devices with a separate "input device" for buttons - Fixed comment styling Co-developed-by: Makarenko Oleg <[email protected]> Signed-off-by: Makarenko Oleg <[email protected]> Signed-off-by: Tomasz Pakuła <[email protected]> Reviewed-by: Michał Kopeć <[email protected]> Reviewed-by: Paul Dino Jones <[email protected]> Tested-by: Cristóferson Bueno <[email protected]> Tested-by: Pablo Cisneros <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Stop all effects before enabling actuatorsTomasz Pakuła2025-02-031-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some PID compliant devices automatically play effects after boot (i.e. autocenter spring) that prevent the rendering of other effects since it is done outside the kernel driver. This makes sure all the effects currently played are stopped after resetting the device. It brings compatibility to the Brunner CLS-P joystick and others Reported-by: Jules Noirant <[email protected]> Signed-off-by: Tomasz Pakuła <[email protected]> Reviewed-by: Michał Kopeć <[email protected]> Reviewed-by: Paul Dino Jones <[email protected]> Tested-by: Paul Dino Jones <[email protected]> Tested-by: Cristóferson Bueno <[email protected]> Tested-by: Pablo Cisneros <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Add FIX_WHEEL_DIRECTION quirkTomasz Pakuła2025-02-031-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most steering wheels simply ignore DIRECTION field, but some try to be compliant with the PID standard and use it in force calculations. Games often ignore setting this field properly and/or there can be issues with dinput8 -> wine -> SDL -> Linux API translation, and this value can be incorrect. This can lead to partial/complete loss of Force Feedback or even unexpected force reversal. Sadly, this quirk can't be detected automatically without sending out effects that would move an axis. This fixes FFB on Moza Racing devices and others where effect direction is not simply ignored. Signed-off-by: Tomasz Pakuła <[email protected]> Reviewed-by: Michał Kopeć <[email protected]> Reviewed-by: Paul Dino Jones <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Add hid_pidff_init_with_quirks and export as GPL symbolTomasz Pakuła2025-02-031-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This lays out a way to provide an initial set of quirks to enable before device initialization takes place. GPL symbol export needed for the possibility of building HID drivers which use this function as modules. Adding a wrapper function to ensure compatibility with the old behavior of hid_pidff_init. Signed-off-by: Tomasz Pakuła <[email protected]> Reviewed-by: Michał Kopeć <[email protected]> Reviewed-by: Paul Dino Jones <[email protected]> Tested-by: Paul Dino Jones <[email protected]> Tested-by: Cristóferson Bueno <[email protected]> Tested-by: Pablo Cisneros <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Add PERMISSIVE_CONTROL quirkTomasz Pakuła2025-02-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this quirk, a PID device isn't required to have a strict logical_minimum of 1 for the the PID_DEVICE_CONTROL usage page. Some devices come with weird values in their device descriptors and this quirk enables their initialization even if the logical minimum of the DEVICE_CONTROL page is not 1. Fixes initialization of VRS Direct Force Pro Changes in v6: - Change quirk name to better reflect it's intention Co-developed-by: Makarenko Oleg <[email protected]> Signed-off-by: Makarenko Oleg <[email protected]> Signed-off-by: Tomasz Pakuła <[email protected]> Reviewed-by: Michał Kopeć <[email protected]> Reviewed-by: Paul Dino Jones <[email protected]> Tested-by: Paul Dino Jones <[email protected]> Tested-by: Cristóferson Bueno <[email protected]> Tested-by: Pablo Cisneros <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Add MISSING_PBO quirk and its detectionTomasz Pakuła2025-02-031-18/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some devices with only one axis are missing PARAMETER_BLOCK_OFFSET field for conditional effects. They can only have one axis, so we're limiting the max_axis when setting the report for those effects. Automatic detection ensures compatibility even if such device won't be explicitly defined in the kernel. Fixes initialization of VRS DirectForce PRO and possibly other devices. Changes in v6: - Fixed NULL pointer dereference. When PBO is missing, make sure not to set it anyway Co-developed-by: Makarenko Oleg <[email protected]> Signed-off-by: Makarenko Oleg <[email protected]> Signed-off-by: Tomasz Pakuła <[email protected]> Reviewed-by: Michał Kopeć <[email protected]> Reviewed-by: Paul Dino Jones <[email protected]> Tested-by: Paul Dino Jones <[email protected]> Tested-by: Cristóferson Bueno <[email protected]> Tested-by: Pablo Cisneros <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Add MISSING_DELAY quirk and its detectionTomasz Pakuła2025-02-031-5/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A lot of devices do not include this field, and it's seldom used in force feedback implementations. I tested about three dozen applications and none of them make use of the delay. This fixes initialization of a lot of PID wheels like Cammus, VRS, FFBeast This change has no effect on fully compliant devices Co-developed-by: Makarenko Oleg <[email protected]> Signed-off-by: Makarenko Oleg <[email protected]> Signed-off-by: Tomasz Pakuła <[email protected]> Reviewed-by: Michał Kopeć <[email protected]> Reviewed-by: Paul Dino Jones <[email protected]> Tested-by: Paul Dino Jones <[email protected]> Tested-by: Cristóferson Bueno <[email protected]> Tested-by: Pablo Cisneros <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Clamp PERIODIC effect period to device's logical rangeTomasz Pakuła2025-02-031-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ensures the effect can actually be played on the connected force feedback device. Adds clamping functions used instead of rescaling, as we don't want to change the characteristics of the periodic effects. Fixes edge cases found on Moza Racing and some other hardware where the effects would not play if the period is outside the defined logical range. Changes in v6: - Use in-kernel clamp macro instead of a custom solution Signed-off-by: Tomasz Pakuła <[email protected]> Reviewed-by: Michał Kopeć <[email protected]> Reviewed-by: Paul Dino Jones <[email protected]> Tested-by: Paul Dino Jones <[email protected]> Tested-by: Cristóferson Bueno <[email protected]> Tested-by: Pablo Cisneros <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Do not send effect envelope if it's emptyTomasz Pakuła2025-02-031-18/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Envelope struct is always initialized, but the envelope itself is optional as described in USB PID Device class definition 1.0. 5.1.1.1 Type Specific Block Offsets ... 4) Effects that do not use Condition Blocks use 1 Parameter Block and an *optional* Envelope Block. Sending out "empty" envelope breaks force feedback on some devices with games that use SINE effect + offset to emulate constant force effect, as well as generally breaking Constant/Periodic effects. One of the affected brands is Moza Racing. This change prevents the envelope from being sent if it contains all 0 values while keeping the old behavior of only sending it, if it differs from the old one. Changes in v6: - Simplify the checks to make them clearer - Fix possible null pointer dereference while calling pidff_needs_set_envelope Signed-off-by: Tomasz Pakuła <[email protected]> Reviewed-by: Michał Kopeć <[email protected]> Reviewed-by: Paul Dino Jones <[email protected]> Tested-by: Paul Dino Jones <[email protected]> Tested-by: Cristóferson Bueno <[email protected]> Tested-by: Pablo Cisneros <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: pidff: Convert infinite length from Linux API to PID standardTomasz Pakuła2025-02-031-1/+7
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Software uses 0 as de-facto infinite lenght on Linux FF apis (SDL), Linux doesn't actually define anythi as of now, while USB PID defines NULL (0xffff). Most PID devices do not expect a 0-length effect and can't interpret it as infinite. This change fixes Force Feedback for most PID compliant devices. As most games depend on updating the values of already playing infinite effects, this is crucial to ensure they will actually work. Previously, users had to rely on third-party software to do this conversion and make their PID devices usable. Co-developed-by: Makarenko Oleg <[email protected]> Signed-off-by: Makarenko Oleg <[email protected]> Signed-off-by: Tomasz Pakuła <[email protected]> Reviewed-by: Michał Kopeć <[email protected]> Reviewed-by: Paul Dino Jones <[email protected]> Tested-by: Paul Dino Jones <[email protected]> Tested-by: Cristóferson Bueno <[email protected]> Tested-by: Pablo Cisneros <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
* | | Merge branch 'for-6.15/logitech' into for-linusJiri Kosina2025-03-262-81/+66
|\ \ \ | | | | | | | | | | | | - conversion of hid-lg-g15 to standard multicolor LED API (Kate Hsuan)
| * | | HID: Kconfig: Add LEDS_CLASS_MULTICOLOR dependency to HID_LOGITECHKate Hsuan2025-02-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test bot found an issue with building hid-lg-g15. All errors (new ones prefixed by >>): powerpc-linux-ld: drivers/hid/hid-lg-g15.o: in function `lg_g510_kbd_led_write': >> drivers/hid/hid-lg-g15.c:241:(.text+0x768): undefined reference to `led_mc_calc_color_components' powerpc-linux-ld: drivers/hid/hid-lg-g15.o: in function `lg_g15_register_led': >> drivers/hid/hid-lg-g15.c:686:(.text+0xa9c): undefined reference to `devm_led_classdev_multicolor_register_ext' Since multicolor LED APIs manage the keyboard backlight settings of hid-lg-g15, the LEDS_CLASS_MULTICOLOR dependency was added to HID_LOGITECH. Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Fixes: a3a064146c50 ("HID: hid-lg-g15: Use standard multicolor LED API") Signed-off-by: Kate Hsuan <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
| * | | HID: hid-lg-g15: Use standard multicolor LED APIKate Hsuan2025-02-071-81/+65
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace the custom "color" sysfs attribute with the standard multicolor LED API. This also removes the code for the custom "color" sysfs attribute, the "color" sysfs attribute was never documented so hopefully, it is not used by anyone. If we get complaints, we can re-add the "color" sysfs attribute as a compatibility wrapper setting the subleds intensity. Signed-off-by: Kate Hsuan <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
* | | Merge branch 'for-6.15/lenovo' into for-linusJiri Kosina2025-03-261-5/+3
|\ \ \ | | | | | | | | | | | | - code cleanups (Dan Carpenter, Vishnu Sankar)
| * | | HID: lenovo: silence unreachable code warningDan Carpenter2025-03-041-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In theory, this code used to return 0 if CONFIG_ACPI_PLATFORM_PROFILE was disabled. It's not clear if that was a config which would actually boot so we've removed the CONFIG_ACPI_PLATFORM_PROFILE ifdef. But now the "return 0;" statement is unreachable and static checker tools complain. Delete it and pull the else statement in a tab to silence the checker warning and make the code a bit more clear. Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>