From: Max Staudt <max@enpas.org>
To: Roderick Colenbrander <thunderbird2k@gmail.com>
Cc: Roderick Colenbrander <roderick.colenbrander@sony.com>,
Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
nathaniel.lewis@sony.com
Subject: Re: [PATCH v2] hid-playstation: DS4: Update rumble and lightbar together
Date: Thu, 15 Aug 2024 01:40:31 +0900 [thread overview]
Message-ID: <1ff1239d-2f90-4c8d-8b68-b0e0fa2340da@enpas.org> (raw)
In-Reply-To: <CAEc3jaBELzAnffyE4mzQeNAiH-F5AhQqMGvMKoL6yu4naHBo+w@mail.gmail.com>
Great, thank you!
Then I guess the previous patch was just too hard to understand. Lesson
learned, I'll try to be clearer next time :)
On another note, I've dumped hid->rdesc for my controller which shows
this problem. It is different from my Sony DS4 2.0 controllers, which
all have the same descriptor. Do you prefer to guard this hack by a
quirk, which activates on, say, a CRC32 match of the HID descriptor?
Thank you, and sorry for the extended back and forth!
Max
On 8/15/24 01:17, Roderick Colenbrander wrote:
> Hi Max,
>
> That looks like a reasonable workaround. I think it would be fine to
> add. We will try to support that with Android as well.
>
> Thanks,
> Roderick
>
> On Sun, Aug 11, 2024 at 6:15 AM Max Staudt <max@enpas.org> wrote:
>>
>> Some 3rd party gamepads expect updates to rumble and lightbar together,
>> and setting one may cancel the other.
>>
>> Let's maximise compatibility by always sending rumble and lightbar
>> updates together, even when only one has been scheduled.
>>
>> Further background reading:
>>
>> - Apparently the PS4 always sends rumble and lightbar updates together:
>>
>> https://eleccelerator.com/wiki/index.php?title=DualShock_4#0x11_2
>>
>> - 3rd party gamepads may not implement lightbar_blink, and may simply
>> ignore updates with 0x07 set, according to:
>>
>> https://github.com/Ryochan7/DS4Windows/pull/1839
>> ---
>> Changes in v1 -> v2:
>> - Simplified the code, comment, and commit message.
>> ---
>> drivers/hid/hid-playstation.c | 20 ++++++++++++++++++++
>> 1 file changed, 20 insertions(+)
>>
>> diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
>> index e7c309cfe3a0..0d90d7ee693c 100644
>> --- a/drivers/hid/hid-playstation.c
>> +++ b/drivers/hid/hid-playstation.c
>> @@ -2143,6 +2143,26 @@ static void dualshock4_output_worker(struct work_struct *work)
>>
>> spin_lock_irqsave(&ds4->base.lock, flags);
>>
>> + /*
>> + * Some 3rd party gamepads expect updates to rumble and lightbar
>> + * together, and setting one may cancel the other.
>> + *
>> + * Let's maximise compatibility by always sending rumble and lightbar
>> + * updates together, even when only one has been scheduled, resulting
>> + * in:
>> + *
>> + * ds4->valid_flag0 >= 0x03
>> + *
>> + * Hopefully this will maximise compatibility with third-party pads.
>> + *
>> + * Any further update bits, such as 0x04 for lightbar blinking, will
>> + * be or'd on top of this like before.
>> + */
>> + if (ds4->update_rumble || ds4->update_lightbar) {
>> + ds4->update_rumble = true; /* 0x01 */
>> + ds4->update_lightbar = true; /* 0x02 */
>> + }
>> +
>> if (ds4->update_rumble) {
>> /* Select classic rumble style haptics and enable it. */
>> common->valid_flag0 |= DS4_OUTPUT_VALID_FLAG0_MOTOR;
>> --
>> 2.39.2
>>
>>
next prev parent reply other threads:[~2024-08-14 16:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-11 13:09 Max Staudt
2024-08-14 16:17 ` Roderick Colenbrander
2024-08-14 16:40 ` Max Staudt [this message]
2024-08-14 16:53 ` Max Staudt
2024-08-19 18:33 ` Jiri Kosina
2024-08-19 20:37 ` Roderick Colenbrander
2024-08-19 20:46 ` Jiri Kosina
2024-08-19 21:02 ` Max Staudt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1ff1239d-2f90-4c8d-8b68-b0e0fa2340da@enpas.org \
--to=max@enpas.org \
--cc=benjamin.tissoires@redhat.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nathaniel.lewis@sony.com \
--cc=roderick.colenbrander@sony.com \
--cc=thunderbird2k@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®