mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
Input: maplecontrol - only enable present axes
The driver was unconditionally enabling all possible analog axes and hats on the input device, even if the controller reported it did not have them in its function data. Move the input_set_abs_params() calls inside the capability check loop so that only actually present axes are enabled on the input device. Also, correct the D-pad (hat) axis limits. They were initialized with inverted limits (min=1, max=-1). Correct them to min=-1, max=1, which matches the values (-1, 0, 1) reported by the driver. Assisted-by: Antigravity:gemini-3.5-flash Link: https://patch.msgid.link/20260703-b4-maple-cleanup-v1-3-41e424964da5@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
parent
cbb37908ef
commit
dbb660ccc9
|
|
@ -118,26 +118,19 @@ static int probe_maple_controller(struct device *dev)
|
|||
idev->close = dc_pad_close;
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
if (data & (1 << i)) {
|
||||
if (data & BIT(i)) {
|
||||
if (btn_bit[i] >= 0)
|
||||
__set_bit(btn_bit[i], idev->keybit);
|
||||
else if (abs_bit[i] >= 0)
|
||||
__set_bit(abs_bit[i], idev->absbit);
|
||||
else if (abs_bit[i] >= ABS_X && abs_bit[i] <= ABS_BRAKE)
|
||||
input_set_abs_params(idev, abs_bit[i], 0, 255, 0, 0);
|
||||
else if (abs_bit[i] >= ABS_HAT0X && abs_bit[i] <= ABS_HAT3Y)
|
||||
input_set_abs_params(idev, abs_bit[i], -1, 1, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (idev->keybit[BIT_WORD(BTN_JOYSTICK)])
|
||||
idev->evbit[0] |= BIT_MASK(EV_KEY);
|
||||
|
||||
if (idev->absbit[0])
|
||||
idev->evbit[0] |= BIT_MASK(EV_ABS);
|
||||
|
||||
for (i = ABS_X; i <= ABS_BRAKE; i++)
|
||||
input_set_abs_params(idev, i, 0, 255, 0, 0);
|
||||
|
||||
for (i = ABS_HAT0X; i <= ABS_HAT3Y; i++)
|
||||
input_set_abs_params(idev, i, 1, -1, 0, 0);
|
||||
|
||||
idev->dev.platform_data = pad;
|
||||
idev->dev.parent = &mdev->dev;
|
||||
idev->name = mdev->product_name;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user