|
|
|
@@ -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;
|
|
|
|
|