3 Commits
0.0.10 ... main

Author SHA1 Message Date
a8d8a3a555 Litestar support? 2025-01-20 00:29:42 +01:00
Lawstorant
23ec6488ed Fix build for kernels older than 6.12 2024-12-13 20:33:46 +02:00
Lawstorant
f683cac1c9 Fix building with kernel 6.12 2024-11-28 08:36:41 +02:00
3 changed files with 32 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
PACKAGE_NAME="universal-pidff" PACKAGE_NAME="universal-pidff"
PACKAGE_VERSION="0.0.10" PACKAGE_VERSION="0.0.12"
MAKE[0]="make KVERSION=$kernelver" MAKE[0]="make KVERSION=$kernelver"
CLEAN="make clean" CLEAN="make clean"
BUILT_MODULE_NAME[0]="hid-universal-pidff" BUILT_MODULE_NAME[0]="hid-universal-pidff"

View File

@@ -30,4 +30,9 @@
#define USB_VENDOR_ID_FFBEAST 0x045b #define USB_VENDOR_ID_FFBEAST 0x045b
#define USB_DEVICE_ID_FFBEAST_WHEEL 0x59d7 #define USB_DEVICE_ID_FFBEAST_WHEEL 0x59d7
// LITESTAR
#define USB_VENDOR_ID_LITESTAR 0x11ff
#define USB_DEVICE_ID_LITESTAR_WHEEL 0x2141
#endif #endif

View File

@@ -11,6 +11,7 @@
#include <linux/hid.h> #include <linux/hid.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/input-event-codes.h> #include <linux/input-event-codes.h>
#include <linux/version.h>
#include "hid-ids.h" #include "hid-ids.h"
#include "hid-pidff.h" #include "hid-pidff.h"
@@ -47,29 +48,39 @@ static const struct hid_device_id pidff_wheel_devices[] = {
| PIDFF_QUIRK_NO_PID_PARAM_BLOCK_OFFSET }, | PIDFF_QUIRK_NO_PID_PARAM_BLOCK_OFFSET },
{ HID_USB_DEVICE(USB_VENDOR_ID_FFBEAST, USB_DEVICE_ID_FFBEAST_WHEEL), { HID_USB_DEVICE(USB_VENDOR_ID_FFBEAST, USB_DEVICE_ID_FFBEAST_WHEEL),
.driver_data = PIDFF_QUIRK_NO_DELAY_EFFECT }, .driver_data = PIDFF_QUIRK_NO_DELAY_EFFECT },
{ HID_USB_DEVICE(USB_VENDOR_ID_LITESTAR, USB_DEVICE_ID_LITESTAR_WHEEL),
.driver_data = PIDFF_QUIRK_FIX_WHEEL_DIRECTION },
{ } { }
}; };
MODULE_DEVICE_TABLE(hid, pidff_wheel_devices); MODULE_DEVICE_TABLE(hid, pidff_wheel_devices);
static u8 *moza_report_fixup(struct hid_device *hdev, __u8 *rdesc, static
unsigned int *rsize) #if LINUX_VERSION_CODE >= KERNEL_VERSION(6,12,0)
const
#endif
u8 *moza_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize)
{ {
// Fix data type on PID Device Control // Fix data type on PID Device Control
if (rdesc[1002] == 0x91 && rdesc[1003] == 0x02) { if (rdesc[1002] == 0x91 && rdesc[1003] == 0x02) {
rdesc[1003] = 0x00; // Fix header, it needs to be Array. rdesc[1003] = 0x00; // Fix header, it needs to be Array.
} }
return rdesc; return rdesc;
} }
static u8 *universal_pidff_report_fixup(struct hid_device *hdev, __u8 *rdesc, static
unsigned int *rsize) #if LINUX_VERSION_CODE >= KERNEL_VERSION(6,12,0)
const
#endif
u8 *universal_pidff_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize)
{ {
if (hdev->vendor == USB_VENDOR_ID_MOZA) { if (hdev->vendor == USB_VENDOR_ID_MOZA) {
return moza_report_fixup(hdev, rdesc, rsize); return moza_report_fixup(hdev, rdesc, rsize);
} }
return rdesc; return rdesc;
} }
/* /*
@@ -108,7 +119,7 @@ static int universal_pidff_input_mapping(struct hid_device *hdev, struct hid_inp
* Add quirks after initialisation * Add quirks after initialisation
*/ */
static int universal_pidff_probe(struct hid_device *hdev, static int universal_pidff_probe(struct hid_device *hdev,
const struct hid_device_id *id) const struct hid_device_id *id)
{ {
int ret; int ret;
ret = hid_parse(hdev); ret = hid_parse(hdev);
@@ -135,7 +146,7 @@ err:
} }
static int universal_pidff_input_configured(struct hid_device *hdev, static int universal_pidff_input_configured(struct hid_device *hdev,
struct hid_input *hidinput) struct hid_input *hidinput)
{ {
// Remove fuzz and deadzone from the wheel axis // Remove fuzz and deadzone from the wheel axis
struct input_dev *input = hidinput->input; struct input_dev *input = hidinput->input;