Playstation Classic Controller

I would like to get working Playstation Classic controller (with usb). I tried following and doing
CWeiske tutorials. Controller works partially, in some games better than others, without OUYA homebuton I have to hard reset.
https://cweiske.de/tagebuch/ouya-stadia-ctrl.htm
https://cweiske.de/tagebuch/ouya-usb-joysticks.htm
Controller is something gpio-keys/input0
and my so far keylayout is:

# Playstation Classic Controller SCPH 1000R via USB
# PSC controller mapping
# idVendor=0001, idProduct=0001
# /\ triangle = O(OUYA) OK
# O circle = A(OUYA) Back
# [] square = U(OUYA) launch
# L2 button = Y(OUYA) system menu

# X cross
key 258   BUTTON_A
# O circle
key 257   BUTTON_B
# [] square
key 259   BUTTON_X
# /\ triangle
key 256   BUTTON_Y

key 262   BUTTON_L1
key 260   BUTTON_L2
key 263   BUTTON_R1
key 261   BUTTON_R2

key 264   BUTTON_SELECT
key 265   BUTTON_START

key 298   BUTTON_THUMBL
key 299   BUTTON_THUMBR

axis 0x00 X
axis 0x01 Y
axis 0x02 HAT_X
axis 0x03 HAT_Y
axis 0x04 RZ
axis 0x05 Z
1 Like

Hello I got new info. I try to keep it short and informative. OUYA itself has issue with 3rd party controllers. OUYA has keylayout files for popular 3rd party controllers Xbox 360, PS3, etc.
These work in OUYA main menu because OUYA itself honors and uses keylayout mappings in main menu.
It is very different with each OUYA game. Even launch titles by-pass keylayout mappings and do not honor and use ADB (Android Debug Bridge) virtual key presses (button presses). In my three days investigation I verified with trial and error which ADB commands work, for example same command works in one OUYA game, but does not work in another game, etc.
I post for here my findings because for starters it is such a mess to even understand basics (is it my controller? is it OUYA game? is it OUYA main menu that fails, is it ADB itself).

Everybody can post messages, where should I post my research and how to fix it? Or just post here to see forum is alive somewhat. Everybody are welcome to share ideas small or bigger.

My setup is OUYA connected to power and laptop Win10Pro with tiny USB cable and ADB installed. I use PSC controller and ADB commands to move around OUYA and shutdown games if no input works (from controller and ADB commands).

I should say that hex2dec converts Hexadecimal to Decimal numbers, for example ADB sendevent uses only decimal numbers an all keylayout numbers are hexadecimal. We are using Andoroid 4,1 JB (Jellybeen) here:

#button O on OUYA
input keyevent BUTTON_A
#button A on OUYA
input keyevent BUTTON_B
#button U on OUYA
input keyevent BUTTON_X
#button Y on OUYA
input keyevent BUTTON_Y

# exit game
# find PID proccess ID and kill it to exit OUYA main menu
ps
#usually starts with com. in middle game name in the end _OUYA
kill <PID>

# LONGPRESS HOME button
input keyevent HOME ; input keyevent HOME ; input keyevent HOME

#OUYA O button
#OUYA main menu ignores, but accepts input keyevent BUTTON_A
sendevent /dev/input/event0 1 304 1 # Hex: 0001 0130 00000001

#OUYA A button
sendevent /dev/input/event0 1 307 1 # Hex: 0001 0133 00000001

#Key down HOME ALT

adb shell su 0 sendevent /dev/input/event0 1 319 1 # Hex: 0001 013f 00000001
adb shell su 0 sendevent /dev/input/event0 0 0 0   # Hex: 0000 0000 00000000

#Key up HOME ALT

adb shell su 0 sendevent /dev/input/event0 1 319 0 # Hex: 0001 013f 00000000
adb shell su 0 sendevent /dev/input/event0 0 0 0   # Hex: 0000 0000 00000000

Linux sPSXs emulator mapping (Linux keylayout)


This is fixed or better PSC keylayout file and numbers are in hex:

# Playstation Classic Controller SCPH 1000R via USB
# PSC controller mapping
# idVendor=0001, idProduct=0001
# wrong - L2 button = O(OUYA) OK
# O circle = A(OUYA) Back
# [] square = U(OUYA) launch
# /\ triangle = Y(OUYA) system menu

# X cross
key 0x132   BUTTON_A
# O circle
key 0x131   BUTTON_B
# [] square
key 0x133   BUTTON_X
# /\ triangle
key 0x130   BUTTON_Y

#L1
key 0x136   BUTTON_L2
#L2
key 0x134   LTRIGGER
#R1
key 0x137   BUTTON_R2
#R2
key 0x135   RTRIGGER

#SELECT
key 0x138   HOME ALT
#START
key 0x139   HOME

# D-pad, not used
#key 390    DPAD_UP
#key 391    DPAD_DOWN
#key 388    DPAD_LEFT
#key 389    DPAD_RIGHT

#CLICK, not used
#key 298   BUTTON_THUMBL
#key 299   BUTTON_THUMBR

#ANALOG thumb sticks, not used
#axis 0x00 X
#axis 0x01 Y

#D-pad
#left-right
axis 0x00 HAT_X
#up-down
axis 0x01 HAT_Y

# Not used, d-pad, sticks
#axis 0x02 HAT_X
#axis 0x03 HAT_Y
#axis 0x04 RZ
#axis 0x05 Z
1 Like

Too bad that they have no “real” USB ids and only idVendor=0001, idProduct=0001.
Otherwise I’d have added them to the ouya key layout repository.

1 Like