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=054c, idProduct=0cda
# 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

Hey, I miss-looked at first (I looked these gpio values as physical controller values).
Actually physical controller has unique vendor and product ids and they are even in your Stadia
controller tutorial (PSC/PSX mode on Stadia controller).

# Playstation Classic Controller SCPH 1000R via USB
# PSC controller mapping
# idVendor=054c, idProduct=0cda

info from Win11Pro PowerShell ADB shell:

shell@android:/ $ su
shell@android:/ # getevent -i
add device 1: /dev/input/event1
  bus:      0019
  vendor    0001
  product   0001
  version   0100
  name:     "gpio-keys"
  location: "gpio-keys/input0"
  id:       ""
  version:  1.0.1
  events:
    KEY (0001): 0074
  input props:
    <none>
add device 2: /dev/input/event0
  bus:      0003
  vendor    054c
  product   0cda
  version   0111
  name:     "Sony Interactive Entertainment Controller"
  location: "usb-tegra-ehci.2-1/input0"
  id:       ""
  version:  1.0.1
  events:
    KEY (0001): 0130  0131  0132  0133  0134  0135  0136  0137
                0138  0139
    ABS (0003): 0000  : value 1, min 0, max 2, fuzz 0, flat 0, resolution 0
                0001  : value 1, min 0, max 2, fuzz 0, flat 0, resolution 0
    MSC (0004): 0004
  input props:
    <none>
  HID descriptor: 0003:054C:0CDA.0001

    05 01 09 05 a1 01 15 00 25 01 75 01 95 0a 05 09 19 01 29 0a 81 02 05 01 09 30 09 31 15 00 25 02 35 00 45 02 75 02 95 02 81 02 75 01 95 02 81 01 c0

      INPUT[INPUT]
        Field(0)
          Application(GenericDesktop.GamePad)
          Usage(10)
            Button.0001
            Button.0002
            Button.0003
            Button.0004
            Button.0005
            Button.0006
            Button.0007
            Button.0008
            Button.0009
            Button.000a
          Logical Minimum(0)
          Logical Maximum(1)
          Report Size(1)
          Report Count(10)
          Report Offset(0)
          Flags( Variable Absolute )
        Field(1)
          Application(GenericDesktop.GamePad)
          Usage(2)
            GenericDesktop.X
            GenericDesktop.Y
          Logical Minimum(0)
          Logical Maximum(2)
          Physical Minimum(0)
          Physical Maximum(2)
          Report Size(2)
          Report Count(2)
          Report Offset(10)
          Flags( Variable Absolute )

    Button.0001 ---> Key.BtnA
    Button.0002 ---> Key.BtnB
    Button.0003 ---> Key.BtnC
    Button.0004 ---> Key.BtnX
    Button.0005 ---> Key.BtnY
    Button.0006 ---> Key.BtnZ
    Button.0007 ---> Key.BtnTL
    Button.0008 ---> Key.BtnTR
    Button.0009 ---> Key.BtnTL2
    Button.000a ---> Key.BtnTR2
    GenericDesktop.X ---> Absolute.X
    GenericDesktop.Y ---> Absolute.Y

could not get driver version for /dev/input/js0, Invalid argument
shell@android:/ #

What device did you use to connect the Playstation Classic controller to the OUYA? AFAIK playstation didn’t use USB but their own adapters.

I guess the USB vendor+product IDs are from that adapter.

1 Like

This, Playstation classic controller, is from year 2018. It has wired usb connection. Playstation classic uses ARM chipset and runs custom Sony PSXreARMed emulator. Controller uses xInput. Full description here:

The fixed key layout has many commented-out lines, and the analogue axes are disabled as well. Do all axes and buttons work with that file?

Commented out lines can all be deleted. Only axis is d-pad (directional pad, up-down, left-right). No physical thumb-sticks.

All buttons work. RetroArch detects it correctly. Issue is with Ouya custom games. Every game does its own button detection.

I want to write it that for Ouya pulling usb-wire out and reconnect usb makes Ouya “see” controller. With usb-wire connected and powering Ouya on most times Ouya does not understand controller is connected.

With this controller ouya-system menu in-game does not work. It fails to bring up system-menu in-game. I have mapped select and start buttons to Home and Home Alt. It does nothing in-game.

In RetroArch select+start is detected correctly and I use it to bring up RetroArch menu to exit Playstation iso games like Gran Turismo 1.

Even in ouya menu (play, discover, make, etc). Y button is mapped to L2.

In keylayout file all looks good, but in Ouya things get wacky.

Wierd is that in Ouya game Crono Time Demo ‘press any key’ does not detect any controller buttons. When I use 8bitDo SN30 pro+ controller in xbox360 wired mode Crono Time Demo ‘press any key’ detects button presses.

From my understanding both Playstation and 8BitDo xbox360 wired mode are in x-input.

Why Ouya is like that…

Edit 13.01.2025
I removed all comments and left only required fields.

# Playstation Classic Controller SCPH 1000R via USB
# PSC controller mapping
# idVendor=054c, idProduct=0cda
# wrong - L2 button = Y(OUYA) system menu
# 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
#left-right
axis 0x00 HAT_X
#up-down
axis 0x01 HAT_Y