* [PATCH 1/1] hid-playstation: Fix button maps for the DualSense Edge controller
@ 2023-11-26 0:15 Alexander Koskovich
2023-11-28 2:16 ` Rahul Rameshbabu
0 siblings, 1 reply; 5+ messages in thread
From: Alexander Koskovich @ 2023-11-26 0:15 UTC (permalink / raw
To: roderick.colenbrander, jikos, benjamin.tissoires, linux-input,
linux-kernel
Cc: Alexander Koskovich
This brings functionality of the DualSense Edge controller inline
with the stock PS5 controller.
Signed-off-by: Alexander Koskovich <akoskovich@pm.me>
---
drivers/hid/hid-playstation.c | 60 ++++++++++++++++++++++++++++-------
1 file changed, 49 insertions(+), 11 deletions(-)
diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
index 8ac8f7b8e317..fc42003cc0eb 100644
--- a/drivers/hid/hid-playstation.c
+++ b/drivers/hid/hid-playstation.c
@@ -1344,10 +1344,18 @@ static int dualsense_parse_report(struct ps_device *ps_dev, struct hid_report *r
input_report_abs(ds->gamepad, ABS_X, ds_report->x);
input_report_abs(ds->gamepad, ABS_Y, ds_report->y);
- input_report_abs(ds->gamepad, ABS_RX, ds_report->rx);
- input_report_abs(ds->gamepad, ABS_RY, ds_report->ry);
- input_report_abs(ds->gamepad, ABS_Z, ds_report->z);
- input_report_abs(ds->gamepad, ABS_RZ, ds_report->rz);
+
+ if (hdev->product == USB_DEVICE_ID_SONY_PS5_CONTROLLER_2) {
+ input_report_abs(ds->gamepad, ABS_RX, ds_report->z);
+ input_report_abs(ds->gamepad, ABS_RY, ds_report->rz);
+ input_report_abs(ds->gamepad, ABS_Z, ds_report->rx);
+ input_report_abs(ds->gamepad, ABS_RZ, ds_report->ry);
+ } else {
+ input_report_abs(ds->gamepad, ABS_RX, ds_report->rx);
+ input_report_abs(ds->gamepad, ABS_RY, ds_report->ry);
+ input_report_abs(ds->gamepad, ABS_Z, ds_report->z);
+ input_report_abs(ds->gamepad, ABS_RZ, ds_report->rz);
+ }
value = ds_report->buttons[0] & DS_BUTTONS0_HAT_SWITCH;
if (value >= ARRAY_SIZE(ps_gamepad_hat_mapping))
@@ -1355,19 +1363,49 @@ static int dualsense_parse_report(struct ps_device *ps_dev, struct hid_report *r
input_report_abs(ds->gamepad, ABS_HAT0X, ps_gamepad_hat_mapping[value].x);
input_report_abs(ds->gamepad, ABS_HAT0Y, ps_gamepad_hat_mapping[value].y);
- input_report_key(ds->gamepad, BTN_WEST, ds_report->buttons[0] & DS_BUTTONS0_SQUARE);
- input_report_key(ds->gamepad, BTN_SOUTH, ds_report->buttons[0] & DS_BUTTONS0_CROSS);
- input_report_key(ds->gamepad, BTN_EAST, ds_report->buttons[0] & DS_BUTTONS0_CIRCLE);
- input_report_key(ds->gamepad, BTN_NORTH, ds_report->buttons[0] & DS_BUTTONS0_TRIANGLE);
+ if (hdev->product == USB_DEVICE_ID_SONY_PS5_CONTROLLER_2) {
+ input_report_key(ds->gamepad, BTN_WEST,
+ ds_report->buttons[0] & DS_BUTTONS0_TRIANGLE);
+ input_report_key(ds->gamepad, BTN_SOUTH,
+ ds_report->buttons[0] & DS_BUTTONS0_SQUARE);
+ input_report_key(ds->gamepad, BTN_EAST,
+ ds_report->buttons[0] & DS_BUTTONS0_CROSS);
+ input_report_key(ds->gamepad, BTN_NORTH,
+ ds_report->buttons[0] & DS_BUTTONS0_CIRCLE);
+ } else {
+ input_report_key(ds->gamepad, BTN_WEST,
+ ds_report->buttons[0] & DS_BUTTONS0_SQUARE);
+ input_report_key(ds->gamepad, BTN_SOUTH,
+ ds_report->buttons[0] & DS_BUTTONS0_CROSS);
+ input_report_key(ds->gamepad, BTN_EAST,
+ ds_report->buttons[0] & DS_BUTTONS0_CIRCLE);
+ input_report_key(ds->gamepad, BTN_NORTH,
+ ds_report->buttons[0] & DS_BUTTONS0_TRIANGLE);
+ }
+
input_report_key(ds->gamepad, BTN_TL, ds_report->buttons[1] & DS_BUTTONS1_L1);
input_report_key(ds->gamepad, BTN_TR, ds_report->buttons[1] & DS_BUTTONS1_R1);
input_report_key(ds->gamepad, BTN_TL2, ds_report->buttons[1] & DS_BUTTONS1_L2);
input_report_key(ds->gamepad, BTN_TR2, ds_report->buttons[1] & DS_BUTTONS1_R2);
input_report_key(ds->gamepad, BTN_SELECT, ds_report->buttons[1] & DS_BUTTONS1_CREATE);
input_report_key(ds->gamepad, BTN_START, ds_report->buttons[1] & DS_BUTTONS1_OPTIONS);
- input_report_key(ds->gamepad, BTN_THUMBL, ds_report->buttons[1] & DS_BUTTONS1_L3);
- input_report_key(ds->gamepad, BTN_THUMBR, ds_report->buttons[1] & DS_BUTTONS1_R3);
- input_report_key(ds->gamepad, BTN_MODE, ds_report->buttons[2] & DS_BUTTONS2_PS_HOME);
+
+ if (hdev->product == USB_DEVICE_ID_SONY_PS5_CONTROLLER_2) {
+ input_report_key(ds->gamepad, BTN_THUMBL,
+ ds_report->buttons[1] & DS_BUTTONS1_R3);
+ input_report_key(ds->gamepad, BTN_THUMBR,
+ ds_report->buttons[2] & DS_BUTTONS2_PS_HOME);
+ input_report_key(ds->gamepad, BTN_MODE,
+ ds_report->buttons[1] & DS_BUTTONS1_L3);
+ } else {
+ input_report_key(ds->gamepad, BTN_THUMBL,
+ ds_report->buttons[1] & DS_BUTTONS1_L3);
+ input_report_key(ds->gamepad, BTN_THUMBR,
+ ds_report->buttons[1] & DS_BUTTONS1_R3);
+ input_report_key(ds->gamepad, BTN_MODE,
+ ds_report->buttons[2] & DS_BUTTONS2_PS_HOME);
+ }
+
input_sync(ds->gamepad);
/*
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] hid-playstation: Fix button maps for the DualSense Edge controller
2023-11-26 0:15 Alexander Koskovich
@ 2023-11-28 2:16 ` Rahul Rameshbabu
2023-11-28 2:19 ` Alexander Koskovich
0 siblings, 1 reply; 5+ messages in thread
From: Rahul Rameshbabu @ 2023-11-28 2:16 UTC (permalink / raw
To: Alexander Koskovich
Cc: roderick.colenbrander, jikos, benjamin.tissoires, linux-input,
linux-kernel
On Sun, 26 Nov, 2023 00:15:49 +0000 "Alexander Koskovich" <AKoskovich@pm.me> wrote:
> This brings functionality of the DualSense Edge controller inline
> with the stock PS5 controller.
>
> Signed-off-by: Alexander Koskovich <akoskovich@pm.me>
> ---
Will provide a follow-up to the relevant discussion.
https://lore.kernel.org/linux-input/P8jVfYBAwiM_8MIgshN0osVVfshfBH2-oZCQuqoqh0Hy76_031zuZvYXWl0edtfTUwDOSNlc5priSRXI3G5dboVh5VPbcdxzAcEF7EvUVgo=@protonmail.com/T/#t
Since I assume this patch was not actually tested to resolve the issue
based on the evtest results, I think we should drop this patch. Will
mention some details I might have with regards to the behavior you are
seeing with Steam/Proton specifically.
--
Thanks,
Rahul Rameshbabu
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] hid-playstation: Fix button maps for the DualSense Edge controller
2023-11-28 2:16 ` Rahul Rameshbabu
@ 2023-11-28 2:19 ` Alexander Koskovich
2023-11-28 2:36 ` Roderick Colenbrander
0 siblings, 1 reply; 5+ messages in thread
From: Alexander Koskovich @ 2023-11-28 2:19 UTC (permalink / raw
To: Rahul Rameshbabu
Cc: roderick.colenbrander, jikos, benjamin.tissoires, linux-input,
linux-kernel
To clarify, I did test this patch locally on Fedora Rawhide and confirm it works with games. It does resolve the issue, and is a workaround.
It's not just Steam/Proton I'm seeing this issue in, I'm seeing it in native Linux games like SuperTuxKart.
On Monday, November 27th, 2023 at 9:16 PM, Rahul Rameshbabu <sergeantsagara@protonmail.com> wrote:
>
>
> On Sun, 26 Nov, 2023 00:15:49 +0000 "Alexander Koskovich" AKoskovich@pm.me wrote:
>
> > This brings functionality of the DualSense Edge controller inline
> > with the stock PS5 controller.
> >
> > Signed-off-by: Alexander Koskovich akoskovich@pm.me
> > ---
>
>
> Will provide a follow-up to the relevant discussion.
>
> https://lore.kernel.org/linux-input/P8jVfYBAwiM_8MIgshN0osVVfshfBH2-oZCQuqoqh0Hy76_031zuZvYXWl0edtfTUwDOSNlc5priSRXI3G5dboVh5VPbcdxzAcEF7EvUVgo=@protonmail.com/T/#t
>
> Since I assume this patch was not actually tested to resolve the issue
> based on the evtest results, I think we should drop this patch. Will
> mention some details I might have with regards to the behavior you are
> seeing with Steam/Proton specifically.
>
> --
> Thanks,
>
> Rahul Rameshbabu
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] hid-playstation: Fix button maps for the DualSense Edge controller
@ 2023-11-28 2:34 Rahul Rameshbabu
0 siblings, 0 replies; 5+ messages in thread
From: Rahul Rameshbabu @ 2023-11-28 2:34 UTC (permalink / raw
To: Alexander Koskovich
Cc: roderick.colenbrander, jikos, benjamin.tissoires, linux-input,
linux-kernel
On Tue, 28 Nov, 2023 02:19:42 +0000 "Alexander Koskovich" <AKoskovich@pm.me> wrote:
> To clarify, I did test this patch locally on Fedora Rawhide and confirm it works with games. It does resolve the issue, and is a workaround.
> It's not just Steam/Proton I'm seeing this issue in, I'm seeing it in native Linux games like SuperTuxKart.
>
Thanks for confirming. I am not that familiar with stk but I believe it
uses SDL2, which might be your common culprit.
https://github.com/supertuxkart/stk-code/blob/a57ac415bbaf8e22a1c35f3ac0949c4dca322637/src/input/sdl_controller.cpp#L288
>
>
> On Monday, November 27th, 2023 at 9:16 PM, Rahul Rameshbabu <sergeantsagara@protonmail.com> wrote:
>
>
>>
>>
>> On Sun, 26 Nov, 2023 00:15:49 +0000 "Alexander Koskovich" AKoskovich@pm.me wrote:
>>
>> > This brings functionality of the DualSense Edge controller inline
>> > with the stock PS5 controller.
>> >
>> > Signed-off-by: Alexander Koskovich akoskovich@pm.me
>> > ---
>>
>>
>> Will provide a follow-up to the relevant discussion.
>>
>> https://lore.kernel.org/linux-input/P8jVfYBAwiM_8MIgshN0osVVfshfBH2-oZCQuqoqh0Hy76_031zuZvYXWl0edtfTUwDOSNlc5priSRXI3G5dboVh5VPbcdxzAcEF7EvUVgo=@protonmail.com/T/#t
>>
>> Since I assume this patch was not actually tested to resolve the issue
>> based on the evtest results, I think we should drop this patch. Will
>> mention some details I might have with regards to the behavior you are
>> seeing with Steam/Proton specifically.
>>
>> --
>> Thanks,
>>
>> Rahul Rameshbabu
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] hid-playstation: Fix button maps for the DualSense Edge controller
2023-11-28 2:19 ` Alexander Koskovich
@ 2023-11-28 2:36 ` Roderick Colenbrander
0 siblings, 0 replies; 5+ messages in thread
From: Roderick Colenbrander @ 2023-11-28 2:36 UTC (permalink / raw
To: Alexander Koskovich
Cc: Rahul Rameshbabu, roderick.colenbrander, jikos,
benjamin.tissoires, linux-input, linux-kernel
Supertuxkart uses SDL2, which doesn't have the proper evdev (or for
Windows dinput) mappings when not using the native hidapi/hidraw
backends.
Thanks,
Roderick
On Mon, Nov 27, 2023 at 6:19 PM Alexander Koskovich <AKoskovich@pm.me> wrote:
>
> To clarify, I did test this patch locally on Fedora Rawhide and confirm it works with games. It does resolve the issue, and is a workaround.
> It's not just Steam/Proton I'm seeing this issue in, I'm seeing it in native Linux games like SuperTuxKart.
>
>
>
> On Monday, November 27th, 2023 at 9:16 PM, Rahul Rameshbabu <sergeantsagara@protonmail.com> wrote:
>
>
> >
> >
> > On Sun, 26 Nov, 2023 00:15:49 +0000 "Alexander Koskovich" AKoskovich@pm.me wrote:
> >
> > > This brings functionality of the DualSense Edge controller inline
> > > with the stock PS5 controller.
> > >
> > > Signed-off-by: Alexander Koskovich akoskovich@pm.me
> > > ---
> >
> >
> > Will provide a follow-up to the relevant discussion.
> >
> > https://lore.kernel.org/linux-input/P8jVfYBAwiM_8MIgshN0osVVfshfBH2-oZCQuqoqh0Hy76_031zuZvYXWl0edtfTUwDOSNlc5priSRXI3G5dboVh5VPbcdxzAcEF7EvUVgo=@protonmail.com/T/#t
> >
> > Since I assume this patch was not actually tested to resolve the issue
> > based on the evtest results, I think we should drop this patch. Will
> > mention some details I might have with regards to the behavior you are
> > seeing with Steam/Proton specifically.
> >
> > --
> > Thanks,
> >
> > Rahul Rameshbabu
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-11-28 2:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-28 2:34 [PATCH 1/1] hid-playstation: Fix button maps for the DualSense Edge controller Rahul Rameshbabu
-- strict thread matches above, loose matches on Subject: below --
2023-11-26 0:15 Alexander Koskovich
2023-11-28 2:16 ` Rahul Rameshbabu
2023-11-28 2:19 ` Alexander Koskovich
2023-11-28 2:36 ` Roderick Colenbrander
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.