DS4 in textmode menus
-
My github bug report got closed without even investigating the issue.
Long story short. It doesn't work in runcommand and other console menus. I'm a software engineer but my Python skills are not good enough to debug the joy2key script.
I'm using the built in driver of the new 4.9 Raspbian kernel with the embedded BT of the Pi 3. The joypad works perfectly with jstest, emulationstation and all the emulators.
And yes the menus work with my Nintendo and 8bitdo controllers. So theres nothing wrong with my setup.
Any ideas?Here's the closed issue:
https://github.com/RetroPie/RetroPie-Setup/issues/1981#issuecomment-301320001 -
@mosi0815 the issue tracker clearly says to use the forum first for help when opening an issue.
Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first - please provide more details of set up. Eg RetroPie version.
-
Retropie 4.2 fully updated. (os packages and RetroPie)
Completely stock. -
@mosi0815 I've made some changes on joy2key and posted about it here: https://retropie.org.uk/forum/post/77799
The forum member @DarkWolf reported that his PlayStation 4 controller is working with my joy2key version.
If you wanna try it too, follow the steps detailed in that topic.
-
-
@meleu Oh yeah. Unified keymaps would be so great.
I'm gonna test it and report back on the other thread. -
@DarkWolf It doesn't work with mine. I have two brand new ones. AFAIK there is only one hardware version of the PS4 controller. I have one from 2013 and two new ones. They look exactly the same. The only thing they changed is the firmware. This is why at least kernel 4.5 or the ds4drv is needed for the newer ones.
The left joystick moves the selection from time to time but none of the buttons is working.
I'm only talking about the textmode menus. Emulationstation end emulators work perfectly fine with them.@BuZz What are the next step to file an issue to GitHub?
-
@mosi0815 I doubt we can fix it in retropie. I don't have one of these controllers either so not much point filing an issue. Could even be some issue with the in kernel driver - I have no idea - since joy2key works with all other controllers that we know of, it may well be nothing to do with RetroPie itself. Did you try using the userland ds4drv ?
-
@mosi0815 Huh, there are differences in the hardware at some point...
I don't know much about the firmware stuff, but the newer ps4 controllers worked fine without ds4drv and the "old" one was connection but had no input at all, so I used the (bad, I have to say) ds4drvIf your controller isn't working correctly it might be your controller or you need the ds4drv (what would be a shame since we have the new kernel that should fix this, huh)
joy2key (at this point of time) takes the button number from the retroarch button config and uses that one as [enter], so nothing changed really (everything else works as before) -
@BuZz I didn't tried the userland driver before the kernel update but never used a text menu with it. The weird thing is that the controller works perfectly fine with emulationstation and all emulators. Also in jstest axis 0/1 move normal (left stick) and the front buttons are 0-3. Can I somehow help you to get debug data? I think this controllers are going to become quite popular now that they work out of the box.
-
@BuZz I found out what's wrong with it. It works when I hold the controller almost level. The accelerometer data comes in on axis 11,12 and 13. Like with the other axis there's a deadzone. Somehow the joy2key script gets confused by this data. I have no Idea how the script decides which axis to use but maybe it would be a good Idea to either read the axis from the emulation station config or to add an option to ignore certain ones.
-
I confirm the same as @mosi0815 the buttons in runcommand are very slow to respond, but indeed it is much better (but not good!) when controler does not move. By very slow I mean we need several seconds to have the button acquired.
Thus, I need to constantly press (not hold) f.e. DPad Down button for few seconds to see the action reflected in runcommand menu.
Other menus and games work perfectly fine.
Edit:
The problem is due to time.sleep is always performed, even when there are events. So after each event is processed, the script waits some small amount of time, if there are many events waiting to be processed, then this is lagging menus. I fixed this problem by amending/opt/retropie/supplementary/runcommand/joy2key.py
At end of script I added check if the script can sleep, so if event occurs no sleep is performed:
js_fds = [] rescan_time = time.time() while True: # added this: do_sleep = True if not js_fds: js_devs, js_fds = open_devices() if js_fds: i = 0 current = time.time() js_last = [None] * len(js_fds) for js in js_fds: js_last[i] = current i += 1 else: time.sleep(1) else: i = 0 for fd in js_fds: event = read_event(fd) if event: # added this: do_sleep = False if time.time() - js_last[i] > JS_REP: if fd in js_button_codes: button_codes = js_button_codes[fd] else: button_codes = default_button_codes if process_event(event): js_last[i] = time.time() elif event == False: close_fds(js_fds) js_fds = [] break i += 1 if time.time() - rescan_time > 2: rescan_time = time.time() if cmp(js_devs, get_devices()): close_fds(js_fds) js_fds = [] # added this: if do_sleep: time.sleep(0.01)
Created pull request with this fix: https://github.com/RetroPie/RetroPie-Setup/pull/2039
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.