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, 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. Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@xxxxxxxxx> --- Changes in v8: - Enabled rescaling for all the time fields instead of just periodic effect period. - Fixed null pointer dereference in pidff_find_special_field and pidff_init_fields when optional reports were missing. Reported previously by Nolan Nicholson on LKML. - All hid-pidff defines were moved into a dedicated header instead of residing in includes/linux/hid.h. They are not needed outside of the kernel. - Fixed bitmask clearing in pidff_send_device_control - Greatly simplified pidff_rescale_signed - Macros in place of hardcoded u16,s16 min/max values - Added review signatures - Added testing signatures - Link to v7: https://lore.kernel.org/all/20250125222530.45944-1-tomasz.pakula.oficjalny@xxxxxxxxx Changes in v7: - Check if device gain field exists before setting device gain. Fixes possible null pointer dereference. - Indentation fixes - Fixed typos and language style in commit messages - Link to v6: https://lore.kernel.org/all/20250125125439.1428460-1-tomasz.pakula.oficjalny@xxxxxxxxx Changes in v6: - Rebased on v6.13 - Added missing SOBs - Reworked and fixed pidff_reset function - Simplified pidff_upload_effect function - Moved magic values into defines - Added PERIODIC effect period rescaling - Support "split" devices with a separate "input device" for buttons. - Fixed comment styling - Improved set_gain handling - Fixed MISSING_PBO quirk - Fix possible null pointer dereference while calling pidff_needs_set_envelope - Link to v5: https://lore.kernel.org/all/20250119131356.1006582-1-tomasz.pakula.oficjalny@xxxxxxxxx Changes in v5: - Added PERIODIC_SINE_ONLY quirk - Link to v4: https://lore.kernel.org/all/20250113124923.234060-7-tomasz.pakula.oficjalny@xxxxxxxxx Changes in v4: - Added PXN devices and their hid ids - Added hid-universal-pidff entry in the MAINTAINERS file - Link to v3: https://lore.kernel.org/all/20250106213539.77709-2-tomasz.pakula.oficjalny@xxxxxxxxx Changes in v3: - Fixed a missed incompatible pointer type while assigning hid_pidff_init_with_quirks to init_function pointer (void -> int) - Improved Kconfig entry name to adhere to the alphabetical order of special HID drivers - Extended cover letter - Link to v2: https://lore.kernel.org/all/20250105193628.296350-1-tomasz.pakula.oficjalny@xxxxxxxxx Changes in v2: - Fix typo in a comment - Fix a possible null pointer dereference when calling hid_pidff_init_with_quirks especially when compiling with HID_PID=n - Fix axis identifier when updating fuzz/flat for FFBeast Joystick - Link to v1: https://lore.kernel.org/all/20241231154731.1719919-1-tomasz.pakula.oficjalny@xxxxxxxxx --- Tomasz Pakuła (21): HID: pidff: Convert infinite length from Linux API to PID standard HID: pidff: Do not send effect envelope if it's empty HID: pidff: Clamp PERIODIC effect period to device's logical range HID: pidff: Add MISSING_DELAY quirk and its detection HID: pidff: Add MISSING_PBO quirk and its detection HID: pidff: Add PERMISSIVE_CONTROL quirk HID: pidff: Add hid_pidff_init_with_quirks and export as GPL symbol HID: pidff: Add FIX_WHEEL_DIRECTION quirk HID: pidff: Stop all effects before enabling actuators HID: Add hid-universal-pidff driver and supported device ids MAINTAINERS: Add entry for hid-universal-pidff driver HID: pidff: Add PERIODIC_SINE_ONLY quirk HID: pidff: Completely rework and fix pidff_reset function HID: pidff: Simplify pidff_upload_effect function HID: pidff: Define values used in pidff_find_special_fields HID: pidff: Rescale time values to match field units HID: pidff: Factor out code for setting gain HID: pidff: Fix null pointer dereference in pidff_find_fields HID: pidff: Move all hid-pidff definitions to a dedicated header HID: pidff: Simplify pidff_rescale_signed HID: pidff: Use macros instead of hardcoded min/max values for shorts MAINTAINERS | 7 + drivers/hid/Kconfig | 14 + drivers/hid/Makefile | 1 + drivers/hid/hid-ids.h | 31 ++ drivers/hid/hid-universal-pidff.c | 198 ++++++++++++ drivers/hid/usbhid/hid-core.c | 1 + drivers/hid/usbhid/hid-pidff.c | 494 ++++++++++++++++++++---------- drivers/hid/usbhid/hid-pidff.h | 33 ++ include/linux/hid.h | 6 - 9 files changed, 616 insertions(+), 169 deletions(-) create mode 100644 drivers/hid/hid-universal-pidff.c create mode 100644 drivers/hid/usbhid/hid-pidff.h base-commit: ffd294d346d185b70e28b1a28abe367bbfe53c04 -- 2.48.1