Kodi Community Forum

Full Version: PS3 Controller
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I have a PS3 dualshock 3 sixaxis and I managed to get it detected by XBMC thanks to the ps3d.py server. When I turn on the controller I can see a "PS3 Sixaxis detected" popup in XBMC.

My problem is that I can't find out how to get it working with the right keys. Right now the "default" mapping looks like :

Cross joystick : every direction is working ( UP, DOWN, LEFT, RIGHT)
Circle button : seems to be the "back" function
Cross button : trigger some pvr popup saying I have no pvr recording device
Analog joystick right : Volume up and down
R3 : Select screenshot directory popup
R2 : go to element furthest right
L2 : go to element furthest left

And that's pretty much everything. As you can see I can't do anything since I do not have an "ENTER" key.
In ~/.xbmc-current/xbmc-bin/share/xbmc/system/keymaps/ I have a joystick.Sony.PLAYSTATION®3.Controller.xml file which says :

<!-- Do 'cat /proc/bus/input/devices' or see your xbmc log file to find the names of -->
<!-- detected joysticks. The name used in the configuration should match the detected name. -->

I don't have anything except my usb keyboard in cat /proc/bus/input/devices. I did a "hcitool name bt_addr" which gave me "PLAYSTATION®3 Controller" so I wrote that as name. I tried to swap keys but it doesn't do anything.

What am I doing wrong ?

Thanks in advance,
Khivar
Using XBMC log, I was able to get the buttons and commands :

Code:
01:33:36 T:3036078816   DEBUG: OnKey: 0 (100) pressed, action is XBMC.ActivateWindowAndFocus(MyPVR, 31,0, 10,0)
01:33:37 T:3036078816   DEBUG: OnKey: 1 (101) pressed, action is Back
01:33:37 T:3036078816   DEBUG: OnKey: 2 (102) pressed, action is FullScreen
01:33:38 T:3036078816   DEBUG: OnKey: 3 (103) pressed, action is Queue
01:33:39 T:3036078816   DEBUG: OnKey: 4 (104) pressed, action is XBMC.Skin.ToggleSetting(HomeViewToggle)
01:33:40 T:3036078816   DEBUG: OnKey: 5 (105) pressed, action is ContextMenu
01:33:41 T:3036078816   DEBUG: OnKey: 14 (10e) pressed, action is Up
01:33:41 T:3036078816   DEBUG: OnKey: 15 (10f) pressed, action is Down
01:33:42 T:3036078816   DEBUG: OnKey: 16 (110) pressed, action is Left
01:33:43 T:3036078816   DEBUG: OnKey: 17 (111) pressed, action is Right
01:33:44 T:3036078816   DEBUG: OnKey: 18 (112) pressed, action is XBMC.ActivateWindow(PlayerControls)
01:33:44 T:3036078816   DEBUG: OnKey: 19 (113) pressed, action is PreviousMenu
01:33:49 T:3036078816   DEBUG: OnKey: 20 (114) pressed, action is Screenshot
01:33:50 T:3036078816   DEBUG: OnKey: 21 (115) pressed, action is XBMC.ActivateWindow(ShutdownMenu)
01:33:51 T:3036078816   DEBUG: OnKey: 22 (116) pressed, action is ScrollUp
01:33:51 T:3036078816   DEBUG: OnKey: 22 (116) pressed, action is ScrollUp
01:33:52 T:3036078816   DEBUG: OnKey: 23 (117) pressed, action is ScrollDown
01:33:52 T:3036078816   DEBUG: OnKey: 23 (117) pressed, action is ScrollDown

Looking at the first button, which is the cross button we can see that it triggers XBMC.ActivateWindowAndFocus(MyPVR, 31,0, 10,0) so I searched in the xbmc/system/keymaps/ folder which xml use this command and there were only 2 : keyboard.xml and remote.xml.
On remote.xml it was on line 70:

Code:
<guide>XBMC.ActivateWindowAndFocus(MyPVR, 31,0, 10,0)</guide>

I switched it with :

Code:
<guide>Select</guide>

Rebooted and tested the cross button again, victory ! It now does the Select command !

So basically my PS3 controller is detected as a remote and not as a joystick. Any idea why ? Since I'm using the XBMC ps3d.py server to connect the controller it should be properly detected as a joystick.

This is doable as is but it will make the configuration tricky and ugly because I will have to find all buttons/remote equivalent( e.g. the cross button refers to the <guide>) and modify the remote.xml consequently.
Having the same issue here... Is this how it's supposed to work?
Managed to fix this problem by copying the system gamepad.xml to the userdata dir. This shouldn't make a difference, but for some reason it does.

I figured this out after I had started making my own keymap: as Khivar states, some buttons can be mapped as <remote>, but ALL buttons can be mapped as <gamepad> ie. X is both <guide> as a remote, but as a gamepad it's <A>. If <A> doesn't have a "custom" map, the <guide> action from remote.xml will be used. On the other hand, the triangle button can only be mapped as a gamepad (<Y>). By copying the system gamepad.xml, all actions can now be mapped as gamepad.

So it's working, but can anyone explain why? Wink
You should always make edits to the .xml files in your userdata directory anyway, not the system defaults. I haven't used a gamepad with XBMC but I suspect it's such a seldom used feature that they don't ship a system-wide gamepad.xml, which is why you'll have to place a copy of it in your userdata folder in order to make any edits.