SukkoPera / PsxNewLib

Playstation controller interface library for Arduino
GNU General Public License v3.0
128 stars 27 forks source link

Controller features detection #28

Open sonik-br opened 1 year ago

sonik-br commented 1 year ago

Opening this more as a way to talk about it. :)

I've been testing and debugging a lot of psx controllers lately. And comparing my findings with what's documented online. There's a lot of wrong or missing information.

So the big news: There are controllers with multiple switchable modes (not just digital/analog). And rumble can be supported on all modes, not just on the dualshock device.

Command 0x45 returns the constants: amount of modes amount of actuators And the variable: current mode (led state too)

Then command 0x46 can get info for each actuator with the constants: Actuator function (rumble, jog rotation,...) Sub function (low speed, high speed,...) Parameter length (if it's just on/off or more complex arguments) Max current drain

And command 0x44C can get info for each controller mode with some data that I don't understand yet, but can be used to identify the protocol (negcon, digital, analog,...)

I've seen a controller with a physical switch for digital, analog, negcon. All with rumble and two motors. This device reports as single mode, too signal that the software can't change it's mode. user must move the switch.

And I've seen a controller with a mode button and 4 possible modes (digital, analog, flightstick, negcon). It reports correctly and all 4 modes can be set from software. (via command 0x44)

So it looks like that rumble is not tied to specific controller types. And most important, games can use those features! There's some games that only have analog input with a negcon controller. And the same game can have rumble enabled with a negcon compatible controller.

Some of my debug data in the next message...

sonik-br commented 1 year ago

Debug from a DualShock2 device

CMD 0x45: 0xFF, 0xF3, 0x5A, 0x3, 0x2, 0x0, 0x2, 0x1, 0x0, 
Controller Info:
Type: 3
Mode Count: 2
Current Mode: 0
Actuator Count: 2

Actuators:
Actuator: 0
CMD 0x46: 0xFF, 0xF3, 0x5A, 0x0, 0x0, 0x1, 0x2, 0x0, 0xA, 
Function Number: 1 : vibration
Sub Function Number: 2 : high speed rotation
Parameter Data Length: 0 : on/off
Max Curent Drain (units): 10

Actuator: 1
CMD 0x46: 0xFF, 0xF3, 0x5A, 0x0, 0x0, 0x1, 0x1, 0x1, 0x14, 
Function Number: 1 : vibration
Sub Function Number: 1 : low speed rotation
Parameter Data Length: 1 bytes
Max Curent Drain (units): 20

CMD 0x47: 
0xFF, 0xF3, 0x5A, 0x0, 0x0, 0x2, 0x0, 0x1, 0x0, 

Modes:
Mode: 0
CMD 0x4C: 0xFF, 0xF3, 0x5A, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 
Digital Pad???

Mode: 1
CMD 0x4C: 0xFF, 0xF3, 0x5A, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 
Analog Pad???

Trying to switch modes (with 3 seconds interval)...

Mode: 0
PSPROTO_DIGITAL

Mode: 1
PSPROTO_DUALSHOCK

Debug from a JogCon device

CMD 0x45: 0xFF, 0xF3, 0x5A, 0x1, 0x2, 0x0, 0x1, 0x1, 0x0, 
Controller Info:
Type: 1
Mode Count: 2
Current Mode: 0
Actuator Count: 1

Actuators:
Actuator: 0
CMD 0x46: 0xFF, 0xF3, 0x5A, 0x0, 0x0, 0x4, 0x3, 0x1, 0x1E, 
Function Number: 4 : rotation
Sub Function Number: 3 : jog?
Parameter Data Length: 1 bytes
Max Curent Drain (units): 30

CMD 0x47: 
0xFF, 0xF3, 0x5A, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 

Modes:
Mode: 0
CMD 0x4C: 0xFF, 0xF3, 0x5A, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 
Digital Pad???

Mode: 1
CMD 0x4C: 0xFF, 0xF3, 0x5A, 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 
JogCon???

Trying to switch modes (with 3 seconds interval)...

Mode: 0
PSPROTO_DIGITAL

Mode: 1
PSPROTO_JOGCON

Debug from a Hori controller with 4 possible modes

CMD 0x45: 0xFF, 0xF3, 0x5A, 0x1, 0x4, 0x3, 0x2, 0x1, 0x0, 
Controller Info:
Type: 1
Mode Count: 4
Current Mode: 3
Actuator Count: 2

Actuators:
Actuator: 0
CMD 0x46: 0xFF, 0xF3, 0x5A, 0x0, 0x0, 0x1, 0x2, 0x0, 0xA, 
Function Number: 1 : vibration
Sub Function Number: 2 : high speed rotation
Parameter Data Length: 0 : on/off
Max Curent Drain (units): 10

Actuator: 1
CMD 0x46: 0xFF, 0xF3, 0x5A, 0x0, 0x0, 0x1, 0x1, 0x1, 0x14, 
Function Number: 1 : vibration
Sub Function Number: 1 : low speed rotation
Parameter Data Length: 1 bytes
Max Curent Drain (units): 20

CMD 0x47: 
0xFF, 0xF3, 0x5A, 0x0, 0x0, 0x2, 0x0, 0x1, 0x0, 

Modes:
Mode: 0
CMD 0x4C: 0xFF, 0xF3, 0x5A, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 
Digital Pad???

Mode: 1
CMD 0x4C: 0xFF, 0xF3, 0x5A, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 
Analog Pad???

Mode: 2
CMD 0x4C: 0xFF, 0xF3, 0x5A, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 
Negcon???

Mode: 3
CMD 0x4C: 0xFF, 0xF3, 0x5A, 0x0, 0x0, 0x0, 0x5, 0x0, 0x0, 
Analog Stick???

Trying to switch modes (with 3 seconds interval)...

Mode: 0
PSPROTO_DIGITAL

Mode: 1
PSPROTO_DUALSHOCK

Mode: 2
PSPROTO_NEGCON

Mode: 3
PSPROTO_FLIGHTSTICK