Kodi Community Forum
Xbox One controller Support - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Windows (https://forum.kodi.tv/forumdisplay.php?fid=59)
+---- Thread: Xbox One controller Support (/showthread.php?tid=202869)

Pages: 1 2 3 4 5 6 7


RE: Xbox One controller Support - natethomas - 2015-11-23

To be honest guys, at the moment I don't know any dev with a controller, so it'll be tougher to fix. What would help quite a lot would be a map showing what each id or axis aligns with while pressing a particular button. That's what the below code is. Just a map. If one of you could fill that in with your wireless xbone controller, the rest would be pretty easy.

To get the map, you need turn on debug logging, and then click each button on your controller in an exact pattern. It doesn't matter what that pattern is; you just need to remember the pattern.

Then shut down Kodi, open the debug log, and look for every button press. For example, on an Xbox 360 controller, pressing and depressing the B button will look like this in the debug log:

08:31:25 T:29412 DEBUG: Joystick 0 button 2 Down
08:31:25 T:29412 DEBUG: Joystick 0 button 2 Up

Once we have the map with the new d-pad inputs, everything else should go quickly.

Code:
<!-- Button Mappings in Windows:               -->
<!--                                           -->
<!-- ID              Button                    -->
<!--                                           -->
<!-- 1               A                         -->
<!-- 2               B                         -->
<!-- 3               X                         -->
<!-- 4               Y                         -->
<!-- 5               Left Sholder              -->
<!-- 6               Right Sholder             -->
<!-- 7               Back                      -->
<!-- 8               Start                     -->
<!-- 9               Left Stick Button         -->
<!-- 10              Right Stick Button        -->
<!-- 11              D-Pad Up                  -->
<!-- 12              D-Pad Down                -->
<!-- 13              D-Pad Left                -->
<!-- 14              D-Pad Right               -->
<!-- 15              Back                      -->

<!-- Linux alterations for default Xpad Driver -->
<!-- 9               Guide                     -->
<!-- 10              Left Stick Button         -->
<!-- 11              Right Stick Button        -->
<!-- 12              D-Pad Left                -->
<!-- 13              D-Pad Right               -->
<!-- 14              D-Pad Up                  -->
<!-- 15              D-Pad Down                -->
<!-- Axis 3 +1/-1    Triggers left/right (win) -->
<!-- Axis 3          Left Trigger (linux)      -->
<!-- Axis 6          Right Trigger (linux)     -->

<!-- Axis Mappings:                   -->
<!--                                  -->
<!-- ID              Button           -->
<!--                                  -->
<!-- 1               Left Stick L/R   -->
<!-- 2               Left Stick U/D   -->
<!-- 3 limit +1      Left Trigger     -->
<!-- 3 limit -1      Right Trigger    -->
<!-- 4               Right Stick L/R  -->
<!-- 5               Right Stick U/D  -->

<!-- Hat Mappings for some drivers:   -->
<!--                                  -->
<!-- ID  Position    Button           -->
<!--                                  -->
<!-- 1   up          D-Pad Up         -->
<!-- 1   down        D-Pad Down       -->
<!-- 1   left        D-Pad Left       -->
<!-- 1   right       D-Pad Right      -->



RE: Xbox One controller Support - RazorFR - 2015-11-26

Tried to do that, for both microsoft wireless pads (old and new)
Though debug seems to record exactly the same inputs, except that for Xbox one, the d-pad button does nothing in Kodi
Also, there is a difference in the way Kodi is reading the joystick specs as you'll see below

I can't see L and R triggers recordings in the debug even with the old pad, and I know triggers are axis
So I guess I may be missing something here and I am not sure it will be useful as the whole problem seems to come down to an axis change/addition


Let me know if anything else can help


X360 wireless

17:23:36 T:7580 NOTICE: CJoystick::EnumJoysticksCallback : Enabled Joystick: Controller (Xbox 360 Wireless Receiver for Windows)
17:23:36 T:7580 NOTICE: CJoystick::EnumJoysticksCallback : Total Axis: 5 Total Hats: 1 Total Buttons: 10

<!-- 1 A -->
17:23:39 T:7580 DEBUG: Joystick 0 button 1 Down
17:23:39 T:7580 DEBUG: Joystick 0 button 1 Up
<!-- 2 B -->
17:23:40 T:7580 DEBUG: Joystick 0 button 2 Down
17:23:41 T:7580 DEBUG: Joystick 0 button 2 Up
<!-- 3 X -->
17:23:42 T:7580 DEBUG: Joystick 0 button 3 Down
17:23:42 T:7580 DEBUG: Joystick 0 button 3 Up
<!-- 4 Y -->
17:23:43 T:7580 DEBUG: Joystick 0 button 4 Down
17:23:43 T:7580 DEBUG: Joystick 0 button 4 Up
<!-- 5 Left Sholder -->
<!-- 6 Right Sholder -->
<!-- 7 Back -->
17:23:54 T:7580 DEBUG: Joystick 0 button 7 Down
17:23:54 T:7580 DEBUG: Joystick 0 button 7 Up
<!-- 8 Start -->
17:23:55 T:7580 DEBUG: Joystick 0 button 8 Down
17:23:55 T:7580 DEBUG: Joystick 0 button 8 Up
<!-- 9 Left Stick Button -->
17:24:00 T:7580 DEBUG: Joystick 0 button 9 Down
17:24:00 T:7580 DEBUG: Joystick 0 button 9 Up
<!-- 10 Right Stick Button -->
17:24:01 T:7580 DEBUG: Joystick 0 button 10 Down
17:24:01 T:7580 DEBUG: Joystick 0 button 10 Up
<!-- 11 D-Pad Up -->
17:24:07 T:7580 DEBUG: Joystick 0 hat 1 value 1
17:24:07 T:7580 DEBUG: Joystick 0 hat 1 hat centered
<!-- 12 D-Pad Down -->
17:24:08 T:7580 DEBUG: Joystick 0 hat 1 value 4
17:24:08 T:7580 DEBUG: Joystick 0 hat 1 hat centered
<!-- 13 D-Pad Left -->
17:24:09 T:7580 DEBUG: Joystick 0 hat 1 value 8
17:24:09 T:7580 DEBUG: Joystick 0 hat 1 hat centered
<!-- 14 D-Pad Right -->
17:24:10 T:7580 DEBUG: Joystick 0 hat 1 value 2
17:24:10 T:7580 DEBUG: Joystick 0 hat 1 hat centered
<!-- 15 LB -->
17:24:11 T:7580 DEBUG: Joystick 0 button 5 Down
17:24:12 T:7580 DEBUG: Joystick 0 button 5 Up
<!-- 16 RB -->
17:24:15 T:7580 DEBUG: Joystick 0 button 6 Down
17:24:15 T:7580 DEBUG: Joystick 0 button 6 Up


XBox One wireless

17:37:04 T:5608 NOTICE: CJoystick::EnumJoysticksCallback : Enabled Joystick: Controller (Xbox One For Windows)
17:37:04 T:5608 NOTICE: CJoystick::EnumJoysticksCallback : Total Axis: 6 Total Hats: 1 Total Buttons: 11

<!-- 1 A -->
17:37:06 T:5608 DEBUG: Joystick 0 button 1 Down
17:37:06 T:5608 DEBUG: Joystick 0 button 1 Up
<!-- 2 B -->
17:37:07 T:5608 DEBUG: Joystick 0 button 2 Down
17:37:07 T:5608 DEBUG: Joystick 0 button 2 Up
<!-- 3 X -->
17:37:08 T:5608 DEBUG: Joystick 0 button 3 Down
17:37:09 T:5608 DEBUG: Joystick 0 button 3 Up
<!-- 4 Y -->
17:37:09 T:5608 DEBUG: Joystick 0 button 4 Down
17:37:10 T:5608 DEBUG: Joystick 0 button 4 Up
<!-- 5 Left Sholder -->
<!-- 6 Right Sholder -->
<!-- 7 Back -->
17:37:14 T:5608 DEBUG: Joystick 0 button 7 Down
17:37:14 T:5608 DEBUG: Joystick 0 button 7 Up
<!-- 8 Start -->
17:37:15 T:5608 DEBUG: Joystick 0 button 8 Down
17:37:15 T:5608 DEBUG: Joystick 0 button 8 Up
<!-- 9 Left Stick Button -->
17:37:16 T:5608 DEBUG: Joystick 0 button 9 Down
17:37:16 T:5608 DEBUG: Joystick 0 button 9 Up
<!-- 10 Right Stick Button -->
17:37:17 T:5608 DEBUG: Joystick 0 button 10 Down
17:37:17 T:5608 DEBUG: Joystick 0 button 10 Up
<!-- 11 D-Pad Up -->
17:37:19 T:5608 DEBUG: Joystick 0 hat 1 value 1
17:37:19 T:5608 DEBUG: Joystick 0 hat 1 hat centered
<!-- 12 D-Pad Down -->
17:37:21 T:5608 DEBUG: Joystick 0 hat 1 value 4
17:37:21 T:5608 DEBUG: Joystick 0 hat 1 hat centered
<!-- 13 D-Pad Left -->
18:00:54 T:6572 DEBUG: Joystick 0 hat 1 value 8
18:00:54 T:6572 DEBUG: Joystick 0 hat 1 hat centered
<!-- 14 D-Pad Right -->
18:00:55 T:6572 DEBUG: Joystick 0 hat 1 value 2
18:00:55 T:6572 DEBUG: Joystick 0 hat 1 hat centered
<!-- 15 LB -->
17:37:25 T:5608 DEBUG: Joystick 0 button 5 Down
17:37:25 T:5608 DEBUG: Joystick 0 button 5 Up
<!-- 16 RB -->
17:37:27 T:5608 DEBUG: Joystick 0 button 6 Down
17:37:27 T:5608 DEBUG: Joystick 0 button 6 Up


RE: Xbox One controller Support - RazorFR - 2015-11-27

For those wanting a workaround without any keypress. I found something working quite OK with eventghost
It will be better for those already using the program as I am, not sure it is really worth it if you have to install eventghost just for that.

you will need 2 plugins in eventghost for this to work: HID generic (to see pad input) and XBMC2 (to send remote commands to Kodi)

Image

1. Create a new folder for the Xbox one d-pad
2. The trigger event will be HID.Value.16 (any d-pad input). BTW X360 wireless d-pad was HID.Value.15, so that might be a hint for dev to implement the native support
3. Under the event insert a python script that will check if Kodi is here, read the HID event payload (pad direction up, left...) and trigger the correct action.

here below the script

from eg.WinApi import (GetWindowText)
from eg.WinApi.Dynamic import (GetForegroundWindow)
Focus = 'Foreground.' + GetWindowText(GetForegroundWindow())

if Focus == "Foreground.Kodi":

if eg.event.payload == 1:
eg.plugins.XBMC2.GamepadDpadUp()
if eg.event.payload == 5:
eg.plugins.XBMC2.GamepadDpadDown()
if eg.event.payload == 7:
eg.plugins.XBMC2.GamepadDpadLeft()
if eg.event.payload == 3:
eg.plugins.XBMC2.GamepadDpadRight()

else:
eg.Exit()

You need to enable remote control by programs on this system in Kodi services
Voila. It will behave almost like native support i.e. no keyboard press or anything. It will not interfere with any other application (steam/games etc.)
Only small drawback I can see is that it is not repeating events. but I don't really care as the triggers are there to scrollup/down very fast

Compared to my old X360 wireless pad it is not a huge change. The pad feels a bit more sensitive, and the real advantage is probably the headphone support you can plug directly in the pad. That's a really nice feature.


I fixed it! - profucius - 2015-12-07

I've created a native solution to the problem here. I made a keymap .XML file that can be put into the Kodi folder that makes the Xbox One Wireless Controller used through the Xbox Wireless Adapter work correctly. This solution is just version 1.0, as it has not been optimized fully. Once it has been, the Kodi team can implement it into their app so everyone can have it working effortlessly.

See solution here: Reddit Post


RE: Xbox One controller Support - profucius - 2015-12-07

...


RE: Xbox One controller Support - bugmenot2015 - 2015-12-07

Hope devs add more dead zone to xbox 360 and xbox one controllers.

Some controllers comes (brand new) with loose analog centers and easily hangs the kodi interface, thinking analog stick is moving. Sometimes think kodi freeze then see the volume bar showing, I have to move a little the analog stick until the bar goes away. But with other analog stick inputs, you canĀ“t notice anything, just interface hangs.

At least 5 to 10% will be fine and wont change usability.


RE: Xbox One controller Support - natethomas - 2015-12-07

Posted on reddit, but I repeat here.

In reading your notes, I noticed you say you've changed the behavior between the 360 and the One. My impression is that this means the buttons people expect to do something on the 360 won't do the same thing on the One, is that right?

If so, we have to split these out into two different PRs. The first PR makes the One behave the way users would expect it to, based on previous 360 experience. The second PR updates (hopefully) both the One and the 360 to be more intuitive, as you say. The problem is that changing the behavior of buttons is a feature, while making a controller go from not working to working is a bug fix. We can get a bug fix in to the beta. We can't get a feature in.


RE: Xbox One controller Support - profucius - 2015-12-07

Yes, the version I've been editing (version 3 now) has some mappings changed from the 360 version. The changes are intuitive to the controller, but as you say if people come from a 360 they may have to relearn some buttons. Not everyone will come from a 360 though.

Essentially the One controller not working is a bug. There is something in one of the other default keymaps that is causing it to constantly pull down/right. When I removed the default keymaps, it stopped doing that. Also it would do nothing. With only this new keymap XML in place, it works like a charm.

So essentially, if your team can find the bug and fix it, then my keymap could become an optional remapping people could download if they wished.

I suspect the bug is somewhere between the current xbox keymap, and the way Windows handles the One controller through the Wireless Adapter (which is technically a Network Adapter under Device Manager, which also relates to an XINPUT device). My keymap essentially tells controllers with the name of the Network Adapter "Xbox Wireless Adapter for Windows" to have the below mappings. Maybe this will help your debugger pinpoint the issue. Feel free to cross-examine my keymap for clues to resolving the issue.

And thanks for your assistance on this.


RE: Xbox One controller Support - RazorFR - 2015-12-07

So there is only a couple of lines to change, but there is still a little issue

With
<axis id="3" trigger="true" limit="0">ScrollUp</axis>
<axis id="6" trigger="true" limit="0">ScrollDown</axis>

Trigger works as intented. Dpad is not working.

With
<axis id="3" trigger="true" rest="-32768">ScrollUp</axis>
<axis id="6" trigger="true" rest="-32768">ScrollDown</axis>

At kodi startup fast scrollup/down (or volume up/down in profucius keymap, which is indeed less confusing)
one can press any button/axis on the joystick to stop this, and then triggers begin to work as intended
Unfocus Kodi and go back to it and the scrollup/down is immedialely back
Dpad is working

So something like triggers starting position is still not read correctly
If that can help custom keymap.xml


RE: Xbox One controller Support - profucius - 2015-12-07

RazorFR, I'm curious about the issue you're having with D-Pad not working at launch of Kodi. I don't have this issue at all.

What version are you using? I'm using latest stable 15.2.

Also, have you removed all the other default keymaps from the User\AppData\Roaming\Kodi\userdata\keymaps\ folder?

Nothing I was doing was working until I zipped/backed up all the files that started with "joystick" then deleted them. There is a conflict in another (unknown, suspected 360) keymap file that prevents my keymap from working properly. Kodi team can probably fix this. It's fine for me since I only intend to use the Xbone controller, but others may want the flexibility of controller choice.

Also, yes switching the volume to the triggers hit me at the end of last night as I thought about a good way to use the triggers without fear of accidentally hitting them (which can be easier to do than the old 360). Scroll makes more sense on the right thumb stick anyway.

I'm open to keymap configuration suggestions too. If we can make an intuitive mapping by the time Kodi rolls out a bug fix, I'd like to submit it to the team for implementation consideration.


RE: Xbox One controller Support - RazorFR - 2015-12-08

I am using beta 16. I am no expert but I don't think it matters or that any other standard keymap coming with the install interferes. I only have one custom keymap overriding all other mappings for xbox one pad.

dpad issue was created by the first workaround in this post (replacing by limit="0"). You don't have that in your file.
The limit 0 was interesting, because kodi was then handling triggers correctly (but again no working dpad)

Your file with rest="-32768" makes the dpad and the triggers work but
I guess when you start Kodi you see the volume progress bar? I see scrolling, because different mapping for triggers.
In both case Kodi is probably not reading the trigger initial position correctly, until we press a button on the pad


RE: Xbox One controller Support - profucius - 2015-12-08

Not sure if being on beta16 matters, Kodi team would have to verify that.

However, I can say with certainty that the preinstalled default keymaps DO interfere with the Xbox One controller functioning as it should.

Take note, there are two locations where keymaps are located. One is the one you probably are aware of, which holds custom keymaps is located at:

C:\Users\[yourname]\AppData\Roaming\Kodi\userdata\keymaps\

And the other, which is where the default keymaps are placed when you installed Kodi originally, is located at:

C:\Program Files (x86)\Kodi\ (not at my windows computer right now, its under userdata\keymaps, which may be under a system folder)

You must go into the Program Files location, backup, and delete those keymaps named starting with "joystick" to gain optimal functionality that my posted keymap offers.
(Note: I haven't tested to find out exactly which keymap is interfering, but I suspect it may be the 360 one. Try it for yourself)

Also, I haven't played around with the axis/triggers values "0", "-32768", etc. Those came default with the starter keymap I used, which was the previous 360 one. It just worked for me automatically so I never tweaked the numbers. Curious about what the Kodi team thinks of this.

Your last paragraph leads me to believe, again, that your default keymaps are overriding the one I've posted. Try doing the removal of them and see if that helps (it really should, given beta16 isn't itself the culprit).


RE: Xbox One controller Support - profucius - 2015-12-08

(dupe post)


RE: Xbox One controller Support - Bedwyr - 2015-12-08

Other than the mapping changes, it works as expected. Well done profucious.


RE: Xbox One controller Support - natethomas - 2015-12-08

Any PR would replace the default keymap with your altered version, so there shouldn't be any problem. Needless to say, we'll need to build a test build to make sure it works.

With that said, we still can't use your version 3. We need a version that doesn't alter keymapping. If you want to provide a version that keeps the old keymapping but just adds support for the One controller, we can add that to Kodi 16, but we'll need it pretty quick. We can then get the newer v3 keymap PR'd for Kodi 17.