Simplyfy input mapping and increase button number

Wine didn't like button ranges that weren't sequential.
This commit is contained in:
Tomasz Pakuła
2024-08-15 19:28:44 +02:00
committed by Makarenko Oleg
parent 164ad09ad8
commit 561a50299b
2 changed files with 4 additions and 8 deletions

View File

@@ -71,7 +71,7 @@ To unload module:
**[Android App](https://play.google.com/store/apps/details?id=com.cammus.simulator)** **[Android App](https://play.google.com/store/apps/details?id=com.cammus.simulator)**
## Known issues with the driver ## Known issues with the driver
- Current limit of usable buttons is 138 (up from the Linux default of 80). Create an issue if you want this increased further. - Current limit of usable buttons is 160 (up from the Linux default of 80). Create an issue if you want this increased further.
## Known issues with the firmware ## Known issues with the firmware
You tell me please You tell me please

View File

@@ -14,7 +14,6 @@
#include "hid-ids.h" #include "hid-ids.h"
#include "hid-pidff.h" #include "hid-pidff.h"
#define BTN_RANGE (BTN_9 - BTN_0 + 1)
#define JOY_RANGE (BTN_DEAD - BTN_JOYSTICK + 1) #define JOY_RANGE (BTN_DEAD - BTN_JOYSTICK + 1)
static const struct hid_device_id pidff_wheel_devices[] = { static const struct hid_device_id pidff_wheel_devices[] = {
@@ -69,15 +68,12 @@ static int universal_pidff_input_mapping(struct hid_device *hdev, struct hid_inp
return 0; return 0;
int button = ((usage->hid - 1) & HID_USAGE); int button = ((usage->hid - 1) & HID_USAGE);
int code = button + BTN_0; int code = button + BTN_JOYSTICK;
// Detect the end of BTN_* range
if (code > BTN_9)
code = button + BTN_JOYSTICK - BTN_RANGE;
// Detect the end of JOYSTICK buttons range // Detect the end of JOYSTICK buttons range
// KEY_AUDIO_DESC = 0x270
if (code > BTN_DEAD) if (code > BTN_DEAD)
code = button + KEY_MACRO1 - BTN_RANGE - JOY_RANGE; code = button + KEY_NEXT_FAVORITE - JOY_RANGE;
// Map overflowing buttons to KEY_RESERVED for the upcoming new input event // Map overflowing buttons to KEY_RESERVED for the upcoming new input event
// It will handle button presses differently and won't depend on defined // It will handle button presses differently and won't depend on defined