Project

General

Profile

Actions

Emulator Issues #13531

closed

No DualShock 3 (DS3) gyroscope input (PS3 sixaxis motion)

Added by mstoper 3 months ago. Updated 3 months ago.

Status:
Won't fix
Priority:
Normal
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
No
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

Description

What's the problem? Describe what went wrong.

Dolphin doesn't recognize the PlayStation 3 DualShock 3 controller's gyroscope (it recognizes the accelerometer fine) (macOS and Batocera.linux)

What steps will reproduce the problem?

Connect a PS3 DS3 controller to Dolphin (I'm using Batocera.linux 39 and macOS 11), only accelerometer data is passed as a motion input

on macOS 11, I only see one controller input SDL/0/PS3 Controller which contains all the regular buttons and the axes for the analog sticks, pressure-sensitive buttons, and the accelerometer (no gyroscope)

on Batocera.linux, I see 2 controllers connected, one evdev/0/Sony PLAYSTATION(R)3 Controller Motion Sensors for the for the 6 accelerometer axes (+/- X,Y,Z) - no gyro axes - and one evdev/0/Sony PLAYSTATION(R)3 Controller for the regular buttons, analog sticks, and pressure sensitive triggers (another Linux issue - only the 2 pressure-sensitive triggers (L2 and R2) and no other pressure-sensitive buttons are recognized)

Is the issue present in the latest development version? For future reference, please also write down the version number of the latest development version.

I haven't tried the latest development version, but I have the latest version of Batocera
latest development version of Dolphin for reference (I haven't tried this one): 5.0-21453

Is the issue present in the latest stable version?

I would imagine so

What are your PC specifications? (CPU, GPU, Operating System, more)

Intel MacBook with macOS 11, and dual-booting into Batocera.linux v39

on macOS 11 I'm using Dolphin 5.0-21088 with a USB wired controller (Bluetooth connected DS3 in Dolphin gives me only regular button and analog stick inputs, but no vibration/rumble, no pressure-sensitive buttons, and no motion inputs whatsoever - and it won't even show up in RPCS3)

and on Batocera 39 (Linux) they use Dolphin 5.0-20840 according to their changelog - I tried here with both USB wired and Bluetooth connections as they seem to work the same on Linux, and Dolphin and RPCS3 respond the same to both

official Sony DS3 controller (I've tried with 2 of them)

Is there anything else that can help developers narrow down the issue? (e.g. logs, screenshots,
configuration files, savefiles, savestates)

The gyroscope seems to work fine on RPCS3 on Batocera, they have a help page explaining how to enable DS3 support on Linux:
https://wiki.rpcs3.net/index.php?title=Help:Controller_Configuration#On_Linux

The DualShock 3 on Linux works with HIDAPI, allowing for the controller to work through USB as well as Bluetooth. To use the DualShock 3 Backend, users need to create a file called /etc/udev/rules.d/99-ds3-controllers.rules (you will need root permissions to create this file), and fill it with the following:

# DualShock 3 over USB
KERNEL=="hidraw", ATTRS{idVendor}=="054c", ATTRS{idProduct}=="0268", MODE="0666"

# DualShock 3 over Bluetooth
KERNEL=="hidraw*", KERNELS=="*054C:0268*", MODE="0666"

I checked the Batocera install and there are no saved DS3 rules in /etc/udev/rules.d/ (the DS3 gyroscope just works with no extra configuration in RPCS3 - you just have to choose their DS3 handler and not SDL or evdev, the gyro yaw axis is shown as "G" under the Configure Motion Controls panel - it's possible to test just yaw by placing the controller on a flat surface and rotating it left and right)

On macOS 11, RPCS3 doesn't seem to work well with any DS3 motion inputs (it's super janky)

I also found this Dolphin bug tracker post for Linux referencing these inputs for the DualSense (PS5 controller), which I guess is also how the DS3 should work, but I only see the Accel and not the Gyro inputs for my DS3

IMUAccelerometer/Up = `evdev/0/Wireless Controller Motion Sensors:Accel Y+`
IMUAccelerometer/Down = `evdev/0/Wireless Controller Motion Sensors:Accel Y-`
IMUAccelerometer/Left = `evdev/0/Wireless Controller Motion Sensors:Accel X-`
IMUAccelerometer/Right = `evdev/0/Wireless Controller Motion Sensors:Accel X+`
IMUAccelerometer/Forward = `evdev/0/Wireless Controller Motion Sensors:Accel Z+`
IMUAccelerometer/Backward = `evdev/0/Wireless Controller Motion Sensors:Accel Z-`
IMUGyroscope/Pitch Up = `evdev/0/Wireless Controller Motion Sensors:Gyro X+`
IMUGyroscope/Pitch Down = `evdev/0/Wireless Controller Motion Sensors:Gyro X-`
IMUGyroscope/Roll Left = `evdev/0/Wireless Controller Motion Sensors:Gyro Z+`
IMUGyroscope/Roll Right = `evdev/0/Wireless Controller Motion Sensors:Gyro Z-`
IMUGyroscope/Yaw Left = `evdev/0/Wireless Controller Motion Sensors:Gyro Y+`
IMUGyroscope/Yaw Right = `evdev/0/Wireless Controller Motion Sensors:Gyro Y-`

thanks for looking into this, I'm not even sure if the Linux issue is just due to Batocera or Dolphin, but evdev seems to not show gyro inputs on Batocera for RPCS3 either, while their DS3 handler works fine

note: to access the filesystem on Batocera press F1, the Dolphin app in is Applications along with RPCS3

Actions #1

Updated by JMC4789 3 months ago

It's most likely either the APIs that Dolphin support or the controller driver isn't reporting the gyro support on the controller. Last time I tried my DS4 it was working fine, but with my DS3s I wasn't able to get them working properly. Then again, they barely work in the PS3.

In my experience, if Dolphin isn't showing the inputs at all in the advanced input config, then it's not being reported them.

Actions #2

Updated by Billiard26 3 months ago

  • Status changed from New to Won't fix

It seems Linux DS3 drivers do not expose the gyroscope data because it is difficult to implement, only single-axis, and overall inaccurate.
https://github.com/torvalds/linux/blob/2c8159388952f530bd260e097293ccc0209240be/drivers/hid/hid-sony.c#L1105

I'm guessing RPCS3 passes through the raw data, letting the emulated PS3 directly interface with the gamepads, which is why it works there?

I think writing a DS3 driver is out of the scope of dolphin. SDL or Linux will have to improve if DS3 gyroscope data wants to work.

Actions #3

Updated by mstoper 3 months ago

Billiard26 wrote in #note-2:

It seems Linux DS3 drivers do not expose the gyroscope data because it is difficult to implement, only single-axis, and overall inaccurate.
https://github.com/torvalds/linux/blob/2c8159388952f530bd260e097293ccc0209240be/drivers/hid/hid-sony.c#L1105

I'm guessing RPCS3 passes through the raw data, letting the emulated PS3 directly interface with the gamepads, which is why it works there?

I think writing a DS3 driver is out of the scope of dolphin. SDL or Linux will have to improve if DS3 gyroscope data wants to work.

Thanks for your response, I do see the linux kernel comment so I guess it isn't super simple. But RPCS3 shows the gyro yaw axis directly in its gamepad settings, without booting any games so I guess (based on the /etc/udev/rules.d/99-ds3-controllers.rules) they are using the raw hid data somehow. Could you please take a look at how it works in RPCS3? I'm not expecting a fix but would appreciate it, thanks

Actions #4

Updated by mstoper 3 months ago

edit:

I found 3 files from the RPCS3 github that might be of interest if you decide to look into it

  1. the main DS3 pad handler
    https://github.com/RPCS3/rpcs3/blob/master/rpcs3/Input/ds3_pad_handler.cpp

  2. the hid pad handler (mentions gyro)
    https://github.com/RPCS3/rpcs3/blob/e32c48d0dd87e5a9978af2e2841e7951903ff757/rpcs3/Input/hid_pad_handler.h#L20

  3. the SDL pad handler (a bunch of gyro mentions)
    https://github.com/RPCS3/rpcs3/blob/e32c48d0dd87e5a9978af2e2841e7951903ff757/rpcs3/Input/sdl_pad_handler.cpp

  4. the evdev joystick handler which specifically mentions the yaw-only DS3 gyro axis and has the code for the "G" yaw axis from the RPCS3 gamepad motion settings window
    https://github.com/RPCS3/rpcs3/blob/e32c48d0dd87e5a9978af2e2841e7951903ff757/rpcs3/Input/evdev_joystick_handler.cpp#L83

	cfg->motion_sensor_x.axis.def = ::at32(motion_axis_list, ABS_X);
	cfg->motion_sensor_y.axis.def = ::at32(motion_axis_list, ABS_Y);
	cfg->motion_sensor_z.axis.def = ::at32(motion_axis_list, ABS_Z);
	cfg->motion_sensor_g.axis.def = ::at32(motion_axis_list, ABS_RY); // DS3 uses the yaw axis for gyros

thanks again

Actions #5

Updated by Billiard26 3 months ago

SDL has an HIDAPI driver for DS3 gamepads but it similarly does not handle the gyroscope data.

It would make more sense for SDL or Linux to improve their drivers to support the gyroscope data instead of Dolphin having to do the entire job of these drivers.

Actions

Also available in: Atom PDF