mbox series

[0/5] HID: playstation: various DS4 and DualSense fixes

Message ID 20230106015910.3031670-1-roderick.colenbrander@sony.com (mailing list archive)
Headers show
Series HID: playstation: various DS4 and DualSense fixes | expand

Message

Roderick Colenbrander Jan. 6, 2023, 1:59 a.m. UTC
Hi,

This patch set contains a number of small fixes and stability improvements.

The stability patches are most critical as they prevent kernel crashes.
Over the years there have been various buggy devices usually clone devices,
but now apparently some official devices with wiped calibration data.
It is hard to handle all permutations of devices as some have constants,
some have broken constants (e.g. wrong sign of a coefficient). We disable
calibration when we see an invalid 0 denominator. The patch adds the same
logic to both the DualShock4 and DualSense code.

As part of the calibration stability improvements, a thorough review was
performed of the calibration code as it was suspected it was potentially
incorrect. It was found to be only slightly wrong for the handling of the
bias of the gyroscopes. Two patches fix this for both DualShock4 and DualSense.
There is only a marginal impact on practical values as the bias values
tend to be quite small.

Thanks,
Roderick Colenbrander
Sony Interactive Entertainment, LLC

Roderick Colenbrander (5):
  HID: playstation: fix DualShock4 unreachable calibration code.
  HID: playstation: sanity check DualShock4 calibration data.
  HID: playstation: sanity check DualSense calibration data.
  HID: playstation: correct DualShock4 gyro bias handling.
  HID: playstation: correct DualSense gyro bias handling.

 drivers/hid/hid-playstation.c | 104 +++++++++++++++++++++++++++-------
 1 file changed, 85 insertions(+), 19 deletions(-)

Comments

Jiri Kosina Jan. 18, 2023, 9:13 a.m. UTC | #1
On Thu, 5 Jan 2023, Roderick Colenbrander wrote:

> Hi,
> 
> This patch set contains a number of small fixes and stability improvements.
> 
> The stability patches are most critical as they prevent kernel crashes.
> Over the years there have been various buggy devices usually clone devices,
> but now apparently some official devices with wiped calibration data.
> It is hard to handle all permutations of devices as some have constants,
> some have broken constants (e.g. wrong sign of a coefficient). We disable
> calibration when we see an invalid 0 denominator. The patch adds the same
> logic to both the DualShock4 and DualSense code.
> 
> As part of the calibration stability improvements, a thorough review was
> performed of the calibration code as it was suspected it was potentially
> incorrect. It was found to be only slightly wrong for the handling of the
> bias of the gyroscopes. Two patches fix this for both DualShock4 and DualSense.
> There is only a marginal impact on practical values as the bias values
> tend to be quite small.
> 
> Thanks,
> Roderick Colenbrander
> Sony Interactive Entertainment, LLC

I am splitting the stability ones (for 6.2) from the small improvements / 
cleanups (for 6.3).

Thanks,
Roderick Colenbrander Jan. 18, 2023, 6:42 p.m. UTC | #2
On Wed, Jan 18, 2023 at 2:12 AM Jiri Kosina <jikos@kernel.org> wrote:
>
> On Thu, 5 Jan 2023, Roderick Colenbrander wrote:
>
> > Hi,
> >
> > This patch set contains a number of small fixes and stability improvements.
> >
> > The stability patches are most critical as they prevent kernel crashes.
> > Over the years there have been various buggy devices usually clone devices,
> > but now apparently some official devices with wiped calibration data.
> > It is hard to handle all permutations of devices as some have constants,
> > some have broken constants (e.g. wrong sign of a coefficient). We disable
> > calibration when we see an invalid 0 denominator. The patch adds the same
> > logic to both the DualShock4 and DualSense code.
> >
> > As part of the calibration stability improvements, a thorough review was
> > performed of the calibration code as it was suspected it was potentially
> > incorrect. It was found to be only slightly wrong for the handling of the
> > bias of the gyroscopes. Two patches fix this for both DualShock4 and DualSense.
> > There is only a marginal impact on practical values as the bias values
> > tend to be quite small.
> >
> > Thanks,
> > Roderick Colenbrander
> > Sony Interactive Entertainment, LLC
>
> I am splitting the stability ones (for 6.2) from the small improvements /
> cleanups (for 6.3).
>
> Thanks,
>
> --
> Jiri Kosina
> SUSE Labs
>

Thanks, that's how the patches were kind of set up. I wasn't sure due
to timing where they would land, but thanks for pulling in the
stability fixes!

Thanks,
Roderick