RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    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

    Is it possible to filter out certain (faulty) button inputs?

    Scheduled Pinned Locked Moved Help and Support
    joystickdragonriseghost inputs
    3 Posts 2 Posters 733 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ClydeC
      Clyde
      last edited by Clyde

      Hi,

      both of my DragonRise zero delay encoders (one more often than the other) have a glitch from time to time on only one button port that sometimes creates absurd values like 16552, 32767 or even negative numbers of type 2. Normal button presses have the type 1 value 1, so it came to my mind to somehow filter out all other values. Ideally, it should work system-wide so that neither ES nor its screensaver or any emulator registers these values.

      Does anyone have an idea how to achieve this? Mind the different event type of the ghost inputs. edit: According to the joystick API documentation, type 1 means "button pressed/released" and type 2 means "joystick moved". So, I need a way to filter out joystick movements but let button presses through.

      $ jstest --event /dev/input/js1
      Driver version is 2.1.0.
      Joystick (DragonRise Inc.   Generic   USB  Joystick  ) has 7 axes (X, Y, Z, Rx, Rz, Hat0X, Hat0Y)
      and 12 buttons (Trigger, ThumbBtn, ThumbBtn2, TopBtn, TopBtn2, PinkieBtn, BaseBtn, BaseBtn2, BaseBtn3, BaseBtn4, BaseBtn5, BaseBtn6).
      Testing ... (interrupt to exit)
      Event: type 129, time 1247460, number 0, value 0
      Event: type 129, time 1247460, number 1, value 0
      Event: type 129, time 1247460, number 2, value 0
      # rest of initialisation lines removed
      Event: type 2, time 1451440, number 2, value 32767 # here be dragons
      Event: type 2, time 1451450, number 2, value 0                                                                                                                                                                                                        
      Event: type 2, time 1617270, number 2, value 16552 # here be dragons                                                                                                                                                                                                 
      Event: type 2, time 1617280, number 2, value 0     
      Event: type 1, time 2826590, number 2, value 1 # normal button press                                                                                                                                                                                                       
      Event: type 1, time 2826710, number 2, value 0                                                                                                                                                                                                        
      

      edit: Oh, and it's neither the button nor the cable, I changed all of them and the effect remained on port 2 of the decoder.

      Thanks in advance
      Clyde

      mediamogulM 1 Reply Last reply Reply Quote 0
      • mediamogulM
        mediamogul Global Moderator @Clyde
        last edited by

        @clyde

        Are the joysticks analog? It sounds like an overly sensitive deadzone problem.

        RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

        ClydeC 1 Reply Last reply Reply Quote 0
        • ClydeC
          Clyde @mediamogul
          last edited by

          @mediamogul No, the joysticks have digital microswitches. I noticed an error in my reasoning: The buttons have nothing to do with the problems, as their ports are generating type 1 events. Only the joystick ports on the decoder board (four for each joystick, one per microswitch) generate type 2 events.

          That said, the joysticks' microswitches are connected to the ports for axis number 0+1, whereas the ghost inputs only come from axis number 2, which nothing is connected to.

          I tried to set the dead zones of axis 2 on both joysticks to its whole range of -32767 to 32767, hoping that would lead to the driver ignoring them alltogether. After that, jstest doesn't show any input from them anymore, but the screensaver still recognizes some input in irregular intervals and quits back to ES.

          $ jscal -s 7,1,0,127,127,4227201,4194176,1,0,127,127,4227201,4194176,1,10,-32767,32767,2147483647,2147483647,1,0,127,127,2147483647,2147483647,1,0,127,127,2147483647,2147483647,1,0,0,0,2147483647,2147483647,1,0,0,0,2147483647,2147483647 /dev/input/js0
          $ jscal -s 7,1,0,127,127,4227201,4194176,1,0,127,127,4227201,4194176,1,10,-32767,32767,2147483647,2147483647,1,0,127,127,2147483647,2147483647,1,0,127,127,2147483647,2147483647,1,0,0,0,2147483647,2147483647,1,0,0,0,2147483647,2147483647 /dev/input/js1
          

          The part for axis 2 is 1,10,-32767,32767,2147483647,2147483647, see jscal's manpage for more information.

          I got this idea after some research, from these two sites:

          • https://ubuntuforums.org/showthread.php?t=1079284 (a similar problem to mine)
          • https://blog.gimx.fr/joystick-calibration-in-gnulinux/ (it explains the working of jscal -s in some more detail)
          1 Reply Last reply Reply Quote 0
          • First post
            Last post

          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.