Kodi Community Forum
Android Let's get controllers on Android fully working for v20.4 - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Game support (https://forum.kodi.tv/forumdisplay.php?fid=292)
+--- Thread: Android Let's get controllers on Android fully working for v20.4 (/showthread.php?tid=376084)

Pages: 1 2 3 4


Let's get controllers on Android fully working for v20.4 - garbear - 2024-01-28

We've recently (and not so recently) seen a lot of regressions and bugs with controllers on Android.

I'm pulling in all the recent threads with the common goal of fixing controllers on Android for good:
 
 

Also, there's two recent issues on GitHub tracking Android controllers:

 

I had once success, confirmed in PR 24502: I reverted the Android buttonmaps I added, and all buttons were working again.

Android buttonmaps are removed in the following releases:

 
  • Nexus - peripheral.joystick v20.1.15
  • Omega - peripheral.joystick v21.1.11


With the buttonmaps reverted, I'll try to reproduce any issues on my NVidia Shield, Pixel Tablet, and old failing LG tablet.

As I attempt to reproduce, let's bring comments from the other threads into this one.


RE: Let's get controllers on Android fully working for v20.4 - NoviceGames - 2024-01-28

Awesome! Is there any new releases that you’ve done? The last I tried was the 1/16/24 release


RE: Let's get controllers on Android fully working for v20.4 - garbear - 2024-01-28

Not of Kodi, but I did releases for peripheral.joystick (reverts Android buttonmaps) and game.libretro (fixes crash with Mesen). Because these are add-ons you'll get the fixes automatically in a day or so.

EDIT: Sorry, that's false, you'll only get the updates on Vanilla Kodi, not my test builds. However my 2024-01-16 builds include in the Android buttonmap revert, so testing on that build would be appreciated.

I'm pulling out my Android devices for testing now. I tested everything on my shield, and I suspect it's still working so it'll take some time setting up my other Android devices looking to reproduce a problem.


RE: Let's get controllers on Android fully working for v20.4 - NoviceGames - 2024-01-28

Copy that. Ya I tested on the 1/16 build, sent a debug log as well on previous post. Still wouldn’t work. I didn’t do a fresh install of the 1/16 build tho I just installed over the kodi 20.3. Let me know if you need a new debug log. I had both ps4 controllers connected during test


RE: Let's get controllers on Android fully working for v20.4 - garbear - 2024-01-29

OK, I've hunted down and fixed all the problems I've seen so far. I've tested a few of the fixes with my own controllers, but I'll need confirmation from the following testers:



Testing from everyone else is appreciated!

Builds are at https://github.com/garbear/xbmc/releases


RE: Let's get controllers on Android fully working for v20.4 - NoviceGames - 2024-01-29

(2024-01-29, 12:29)garbear Wrote: OK, I've hunted down and fixed all the problems I've seen so far. I've tested a few of the fixes with my own controllers, but I'll need confirmation from the following testers:



Testing from everyone else is appreciated!

Builds are at https://github.com/garbear/xbmc/releases
I’ll have a debug log over to you in a hour


RE: Let's get controllers on Android fully working for v20.4 - garbear - 2024-01-30

We discovered in https://github.com/garbear/xbmc/issues/137 that the problem lies in mapping the button so that it can be used in games. The definition of the controller looks like:

Code:
debug <general>: CPeripheralBusAndroid: Device discovered:
debug <general>:   Name: "Logitech Logitech(R) Precision(TM) Gamepad"
debug <general>:     ID: 140
debug <general>:     Controller number: 0
debug <general>:     Descriptor: "4704e7c96f110c..."
debug <general>:     Product ID: C21A
debug <general>:     Vendor ID: 046D
debug <general>:     Has microphone: false
debug <general>:     Is virtual: false
debug <general>:     Source flags: 0x1000111
debug <general>:     Has source: SOURCE_JOYSTICK (0x1000010)
debug <general>:     Has source: SOURCE_KEYBOARD (0x000101)
debug <general>:     Has key: AKEYCODE_BUTTON_1 (188)
debug <general>:     Has key: AKEYCODE_BUTTON_2 (189)
debug <general>:     Has key: AKEYCODE_BUTTON_3 (190)
debug <general>:     Has key: AKEYCODE_BUTTON_4 (191)
debug <general>:     Has key: AKEYCODE_BUTTON_5 (192)
debug <general>:     Has key: AKEYCODE_BUTTON_6 (193)
debug <general>:     Has key: AKEYCODE_BUTTON_7 (194)
debug <general>:     Has key: AKEYCODE_BUTTON_8 (195)
debug <general>:     Has key: AKEYCODE_BUTTON_9 (196)
debug <general>:     Has key: AKEYCODE_BUTTON_10 (197)
debug <general>:     Has axis: AMOTION_EVENT_AXIS_X (0)
debug <general>:       Endpoints: [-1.000000, 1.000000]
debug <general>:       Center: 0.117647
debug <general>:       Fuzz: 0.000000
debug <general>:     Has axis: AMOTION_EVENT_AXIS_Y (1)
debug <general>:       Endpoints: [-1.000000, 1.000000]
debug <general>:       Center: 0.117647
debug <general>:       Fuzz: 0.000000
 info <general>: CPeripheralBusAndroid: added input device

The generic button keycodes in use (e.g. AKEYCODE_BUTTON_1, etc) are because Android doesn't know how to map the controller, as Android has a large database of buttonmaps internally.

When we go to map the button in the controller configuration utility, you can see that the button is silently dropped, and then Kodi tries to reprocess as a keyboard key:

Code:
debug <general>: game.controller.snes: Waiting for input for feature "a"
debug <general>: CAndroidKey: key ignored (code: 190)
debug <general>: CAndroidKey: key down (dev: 140; src: 257; code: 23; repeat: 0; flags: 0x8; alt: no; shift: no; sym: no)
debug <general>: Keyboard: scancode: 0x17, sym: 0x0d, unicode: 0x00, modifier: 0x0
debug <general>: game.controller.snes: mapping feature "a" for device keyboard to "key enter"

The challenge is to figure out where the button's keycode is getting dropped. Without a controller not in Android's database, I can't track this down. Can anyone with generic button keycodes try mapping the button in the controller configuration utility?

There is also an "Ignore Input" dialog that could be helpful in tracking down the problem, because it shows in realtime the buttons and axes being pressed on the controller.


RE: Let's get controllers on Android fully working for v20.4 - garbear - 2024-02-02

OK, I've merged the joystick fixes into v21 and opened a backport PR for v20.4.

Because the code has diverged between v21 and v20, it's possible that the backport could have a problem. So I created new builds for a v20.4 release candidate, basically same code as v20.3 but shuffled on top of the backport.

I'd appreciate testing of the v20.4 release candidate build: https://github.com/garbear/xbmc/releases/tag/retroplayer-20.4-rc-20240202

If everything is working as well as v21, then we'll do a v20.4 release with much better working controllers.


RE: Let's get controllers on Android fully working for v20.4 - Canada4ever488 - 2024-03-09

I have two Android 13 boxes. I am running the latest version of Diggz and the builds are working fine. I can open and run the arcade with no issues, along with any game I try BUT I am having one problem. None of my controllers will work when I launch a game.

I can connect my controllers but any button I press, just opens the in game menu. I have tried two different Xbox controllers, 3 bluetooth keyboards and the stock android box remote. They all do the same thing, just open the in game menu. Each and every button I press, just pops the menu open. I tried mapping and configuring every controller and they are working just fine, everything is automatically mapped. I can maneuver Kodi just fine everywhere else, but soon as I launch a game, any button I press just opens the in game menu.

Does anyone know a fix for this? Can't find ANY fix for this online.


RE: Let's get controllers on Android fully working for v20.4 - Hitcher - 2024-03-09

(2024-03-09, 15:41)Canada4ever488 Wrote: I am running the latest version of Diggz and the builds are working fine.
No support for banned addons.

https://kodi.wiki/view/Official:Forum_rules/Banned_add-ons


RE: Let's get controllers on Android fully working for v20.4 - Kagemm - 2024-03-12

Hello, I’m also having problems with my controller not working correctly in retroplayer. Most buttons just bring up the menu, but works correctly navigating the kodi menus. Trying to map buttons in kodi settings just ignores every button.  I’ve updated to 20.5 which says it fixes some android controller problems but it still persists. I’m running on a 2017 nvidia shield and I’ve tried both the shield controller and a wired Xbox 360 controller. Just wondering if this is the same problem or something different that I will need to figure out. Any help is appreciated, thanks! 

Log: https://paste.kodi.tv/ufihixojad.kodi


RE: Let's get controllers on Android fully working for v20.4 - garbear - 2024-03-14

(2024-03-12, 09:25)Kagemm Wrote: Hello, I’m also having problems with my controller not working correctly in retroplayer. Most buttons just bring up the menu, but works correctly navigating the kodi menus. Trying to map buttons in kodi settings just ignores every button.  I’ve updated to 20.5 which says it fixes some android controller problems but it still persists. I’m running on a 2017 nvidia shield and I’ve tried both the shield controller and a wired Xbox 360 controller. Just wondering if this is the same problem or something different that I will need to figure out. Any help is appreciated, thanks! 

Log: https://paste.kodi.tv/ufihixojad.kodi


Thanks for the debug log. However, debug logging wasn't enabled, so it's only info-level logging. Debug logging details the Android input devices found, so a new log with debugging enabled would be useful.

I got controllers working in Android almost flawlessly: https://github.com/xbmc/xbmc/pull/24604 . It was merged for 20.3.

However, this broke remotes, so it was reverted for 20.4.

If you'd like to try the controller fixes and are ok with a broken remote, you can use my test builds which include the Android controller fixes: https://github.com/garbear/xbmc/releases

Actually, hopefully you have a remote, and it breaks. Then we can work on fixing it, and get the controller fixes into v21.


RE: Let's get controllers on Android fully working for v20.4 - Kagemm - 2024-03-14

Thanks, I’ll get a debug log uploaded when I can. To try the test build, would I have to uninstall 20.5 first or could I have them both installed? I do use a remote and it’s way more important than the controller so I can understand why they rolled it back hehe. Thanks for the help!


RE: Let's get controllers on Android fully working for v20.4 - garbear - 2024-03-14

(2024-03-14, 07:13)Kagemm Wrote: Thanks, I’ll get a debug log uploaded when I can. To try the test build, would I have to uninstall 20.5 first or could I have them both installed?

I'm actually not sure, my builds are signed with the same keys as the official releases, so you can probably install them over 20.5. But switching back might be problematic, as Android pukes at downgrades. I would recommend using adb to backup your userdate files via adb pull, and restore them with adb push when you're back on stable 20.5.

(2024-03-14, 07:13)Kagemm Wrote: I do use a remote and it’s way more important than the controller so I can understand why they rolled it back hehe. Thanks for the help!

Now I know who else to ping when the controller fixes are ready for testing! I ran out of Kodi time for probably the next few months, so I won't be able to get the controller fixes up to par for a while, but I'll post back here when I have Kodi time next.


RE: Let's get controllers on Android fully working for v20.4 - Kagemm - 2024-03-14

Here’s the new log lawiqacege.kodi (paste)

I’ll get to backing up everything and trying out your test build. Hopefully it’ll be some help.