mickelson / attract

A graphical front-end for command line emulators that hides the underlying operating system and is intended to be controlled with a joystick or gamepad.
http://attractmode.org
GNU General Public License v3.0
399 stars 115 forks source link

Joystick down movement not detected in menu #250

Closed Machinas closed 6 years ago

Machinas commented 8 years ago

Hello!

Our DragonRise Inc. Generic USB Joystick (ID 0079:0006) exhibits a potential bug: When configuring the controls, the joystick "up" movement is detected as "Joy0 Uneg" and is added correctly as such, with that exact label. It also works perfectly to scroll "up" in the game carousel.

The "down" movement is detected as "Joy0 Upos". HOWEVER once you go back from adding an action, it shows up as "Joy0 Up" (note Up in overview vs. Upos in add action screen), and it does NOT work for scrolling "down" in the game carousel.

I also tried to manually overwrite ~/.attract/attract.cfg with "up Joy0 Upos" (after closing attract first, of course). However, after restarting attract, the "down" movement still isn't working in the game carousel.

Finally, I changed "Joy0 Upos" back to "Joy0 Up" and "Joy0 Uneg" to "Joy0 Down", which resulted in none of the directions working in the carousel.

The weird thing is, in all of the games, the joystick works perfectly in all directions, up, down, etc. Only the menu exhibits this erroneous behaviour.

Is this something that needs to be fixed in https://github.com/mickelson/attract/blob/master/src/fe_input.cpp ?

Attract built today manually from git on Raspi v3:

attract -v Attract-Mode v2.1.0 (Linux, SFML 2.3 +FontConfig +RPi +SWF +7z)

Using Libav for Audio and Video. avcodec 56.1.0 / avformat 56.1.0 / swscale 3.0.0 / avresample 2.1.0

Shaders are not available.

yullaw commented 8 years ago

Hi, I have the same gamepad DragonRise Inc. Generic USB Joystick (ID 0079:0006) with the same results. It seems to be kernel's issue. Try to downgrade/upgrade kernel and remap axis UP/DOWN in Attract-Mode again. My is NOT working between kernel 4.1.15 and 4.6.

It is not an issue in Attract-Mode. See also https://bbs.archlinux.org/viewtopic.php?pid=1593822#p1593822

Hope it helps and bug report can be closed here if necessary.

$ cat /etc/issue Mageia release 5 (Official) for x86_64 Kernel 4.4.16-desktop-1.mga5 on a 4-processor x86_64 / \l

$ attract -v Attract-Mode v2.1.0 (Linux, SFML 2.2 +FontConfig +Xinerama +SWF)

Using FFmpeg for Audio and Video. avcodec 56.1.100 / avformat 56.4.101 / swscale 3.0.100 / swresample 1.1.100

Shaders are available.

chrisaq commented 8 years ago

The retropie guys have found a solution: use a hex editor on the hid-dr.ko file...

https://retropie.org.uk/forum/topic/1686/up-down-y-axis-not-working-in-3-8/52

Works for me on arch amd64.

maziac commented 8 years ago

Hi,

same problem here. I'm on Ubuntu 16.04 LTS/kernel 4.4.0-36-generic on a NUC. I have edited the file as described, but after reboot the driver does not work anymore. I.e. the joystick is not found anymore. (Did it twice to be sure and also verified the changes.)

Is there anything I need to do additionally?

fatavatar commented 8 years ago

I'm not set up with a build environment for this, but is the issue here (which I am also having) this particular check:

if ( val.compare( 0, strlen(joyStrings[i]), joyStrings[i] ) == 0 )

on line 360 of fe_input.cpp?

Seems like the ordering of joyStrings will cause issues with this check as shorter strings are first in the array that can match later, longer values if you limit the length of comparison.

mickelson commented 8 years ago

@fatavatar thanks for pointing that out,. I've fixed the ordering of joyStrings so the matching should work now. Hopefully this fixes the original issue as well

vossim commented 7 years ago

@fatavatar @mickelson I have just tested 25e2781dc62aafd887c3f58dd282ac2335efc93f, it fixes the issue.

madlittlepixel commented 7 years ago

Hello, Im fairly new to this. But how can I fix this issue on Retropie? My older builds I never had an issue, but now I am having the same Joystick issue and cannot figure out how to edit the src/fe_input.cpp as you guys have linked to. Can anyone help? Sorry if I sound like an idiot. Just cannot figure this out and just wanna be pointed in the correct direction. Thanks,

vossim commented 7 years ago

@madlittlepixel no need to patch any files, you just need to get the master branch and recompile. Either use git to pull the code in, or download a zipped version: https://github.com/mickelson/attract/archive/master.zip

madlittlepixel commented 7 years ago

@vossim Thanks, I guess I need to figure out how to pull the code in properly. Thats where I am stuck at. Im still learning.

yullaw commented 7 years ago

Hello, I have tested the new release Attract Mode 2.2.0 and my gamepad DragonRise (0079:0006) still does not work. But I found an issue. It is in ../drivers/hid/hid-dr.c of kernel.

Current patch/file which affects a good setting:

Now /drivers/hid/hid-dr.c is reverted to previous version, so soon should work again. For more info, see:

At this moment who has the same troubles still, boot an older kernel.

Hope, it helps.

Happy playing!

vossim commented 7 years ago

@yullaw the patch mentioned in this thread (https://github.com/mickelson/attract/commit/25e2781dc62aafd887c3f58dd282ac2335efc93f) isn't in the 2.2.0 release. The master does contain the patch and works fine for me with the standard amd64 4.8.0 kernel that's in debian testing currently.

yullaw commented 7 years ago

@vossim ou, thanks for the notice! I recompiled the master branch on my affected kernel and it works! Ok, I had to re-set the joypad controls in AttractMode (example for UP: Joy1 Up to Joy1 Uneg) and then works as it should. However, https://github.com/10ne1/linux/commit/28a444cc20f23657a87aecd3ab14cbd265342507 and https://github.com/10ne1/linux/commit/a7dd8e257fc7ea615b3b25a16ebb3eefb395c6f2 should be the solution as well. I am waiting for pushed updates of our distro and then I will test it and let you know.

Tested on Mageia 5 (64bit), kernel 4.4.32-desktop-1.mga5

Thanks

yullaw commented 7 years ago

Yeah, today I have got an update of kernel, where is the fix implemented and it works with AttractMode 2.2.0 as well! And it solves not only AttractMode, but also other apps like KDE4/Plasma5 → SystemSettings → Inputs → Gamepad.

Then I recompiled the master branch too, and still it works with any change.

For me/Mageia users it is solved. Thanks.

KingVarus commented 7 years ago

@yullaw @vossim

Hey guys, i have built my own bartop arcade, now that its finished i came along the same problem. My UP does not work, it does though in retropie and in the games NOT in attract mode displays.

I updated the kernel via the Retropie setup, but that did not fix any problems. I googled the last few hours about the stuff you´ve written here. Could someone please tell me how to fix my problem, i´ve put so much work in my cabinet, yet i cant use UP on my Joystick...please help me

vossim commented 7 years ago

@KingVarus if you just get the code on the master branch, compile it and use that, it just works.

KingVarus commented 7 years ago

@vossim would you mind telling me what the master branch is, and how to get it and compile it? can´t i update my "current image" i´m running now? because it was so much work i don´t want to start all over.

vossim commented 7 years ago

@KingVarus the master branch is the most up to date version of the source code of attract mode, you can either use git to pull it in, or download a zipped version from https://github.com/mickelson/attract.

Compilation instructions are in Compile.md.

If you want a precompiled version, you'll have to wait for the next release.

KingVarus commented 7 years ago

@vossim i´m really sorry that i´m not that good in all that stuff.

My question is, can i just type something in the terminal and it pulls it in?

I´ve read the compile.md but i dont get it. Where do i have to put the zip? so many questions....

KingVarus commented 7 years ago

@vossim i´ve read the compile.md again, there is nothing stated about putting anything on the SD card, or SSH, i just dont get how i change anything when i´m not doing anything over SSH or the SD card...

If you dont have the time to help me out in detail, where can i find the precompiled versions? and are those easier to install?

fatavatar commented 7 years ago

@KingVarus take a look at https://github.com/mickelson/attract/wiki and look for the compile instructions for your particular version of Raspbian. You will SSH onto the pi and execute the commands the from the instructions. Its a bit more explicit than the steps in the compile.md. Hopefully that gets you up and going if you are not there already.

KingVarus commented 7 years ago

@vossim @fatavatar First of all, thanks for all the Help! I fixed my problem, maybe i was just stupid not to figure it out but for anyone that has the same problem i´ll just state my problem again and tell you my solution. So i ordered two Dragonrise controllers with buttons and 2 identical USB decoders. As they were the same they had the same vedor ID and BUS and so on, so the Pi treated them as one decoder even though there were two of them. Which led to not being able to configure both! So my fix for my problem was rather easy, i checked the button connectors on the decoder and i found out that one button was not connected the same as on the other board. In Conclusion: If you have the same Error as i have check your connections, and if you want to map both controllers (Or decoders) the same, just wire them up identically and configure one of them, and both should work fine, and be identified as Joy1 and Joy2

Thanks Again, KingVarus

ghost commented 7 years ago

Hello, I've tried the hex editor method and it works but my joystick and buttons no longer works in EmulationStation and my keyboard arrows no longer work. I reverted that change and then compiled attract mode via the instructions on the wiki page and that did not fix the problem. Also my "A" button doesn't work in Attract Mode. Everything works fine in a game, however. Is there anything else I could try? I think I've read that upgrading or downgrading the kernel could fix it but that's pretty scary to me :)

ghost commented 7 years ago

Got it working by running rpi-update to update the kernel then rebinding the inputs in emulation station.