Recalbox Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • recalbox.com
    • Gitlab repository
    • Documentation
    • Discord

    Régler manuellement les deadzones

    Manettes/GPIO/Encodeurs
    régler manuellement deadzones
    7
    23
    7056
    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.
    • voljega
      voljega Banned @ironic last edited by voljega

      @ironic @OyyoDams

      Ok merci, bon malheureusement ça ne marche pas.
      en éxécutant jscal -s 6,1,16,-16000,16000,16513,16513,1,16,-16000,16000,16513,16513,1,16,-16000,16000,16513,16513,1,16,-16000,16000,16513,16513,1,0,0,0,536870912,536870912,1,0,0,0,536870912,536870912 /dev/input/js0

      avec les couples -6000/6000, -8000/8000 et même -16000/16000 et en mettant bien timed=flase aucun effet (c'est principalement le stick droit mappé sur la souris dans dosbox qui fait chier)

      j'ai aussi un clavier de brancher est ce que mon joy ne serait pas en js1 ? je pense pas mais bon

      sinon comment voir l'état de mon joy au repos pour les valeurs du stick en passant par une commande, comme le fait ton soft ?

      1 Reply Last reply Reply Quote 0
      • ironic
        ironic last edited by ironic

        sdl2-jstest -t 0

        Mais sdl2-jstest n'utilise pas les deadzones.
        Je pousserais un peu plus loin les recherches des que j'aurais le temps.
        Ou si quelqu'un en sait plus...

        Rpi2/Rpi3 - LCD/CRT- NES30 Pro-iBUFFALO

        voljega 1 Reply Last reply Reply Quote 0
        • voljega
          voljega Banned @ironic last edited by

          @ironic

          Joystick Name:   'Microsoft X-Box 360 pad'
          Joystick Number: 0
          
          Axes  4:
             0:    795  [                              #                             ]
             1:  -1445  [                            #                               ]
             2:   2137  [                               #                            ]
             3:  -2799  [                          #                                 ]
          
          Buttons 13:
             0: 0  [ ]
             1: 0  [ ]
             2: 0  [ ]
             3: 0  [ ]
             4: 0  [ ]
             5: 0  [ ]
             6: 0  [ ]
             7: 0  [ ]
             8: 0  [ ]
             9: 0  [ ]
            10: 0  [ ]
            11: 0  [ ]
            12: 0  [ ]
          Hats  1:   0: value: 0  +-----+  up:    0B***s  0: Press Ctrl-c to exit
          

          bizarre... après c'est ptet le fait de mapper dans dosbox la souris sur le stick droit qui merde je sais pas, le gauche a l'air de faire moins de bétises tout seul

          1 Reply Last reply Reply Quote 0
          • acris
            acris last edited by acris

            @voljega
            Une faute de frappe sur le forum ou dans tin fichier ?

            timed= flase
            

            Au lieu de

            timed=false 
            
            voljega 1 Reply Last reply Reply Quote 0
            • voljega
              voljega Banned @acris last edited by

              @acris faute de frappe sur le forum 😉

              1 Reply Last reply Reply Quote 0
              • redm
                redm last edited by redm

                Hi guys. Maybe I can shed some light on this. @voljega notified me of this thread... I speak no word of french (exept maybe merci ;), but Google helped so much to understand, but I choose to answer in english if you don't mind...

                First thing to note is there there are (at least) two different ways to access joysticks in Linux:

                1. the joydev joystick driver and API, with devices /dev/input/js*, which is what you used here. This is configured using jscal and friends.
                2. and the raw event devices, /dev/input/event*. It's not clear to me if this is configurable. Some sources say it's just raw events, not configurable, the Archwiki @voljega linked seems to suggest you can configure/calibrate them...). Otherwise the apps or SDL would have to take care of that. No idea if SDL has any support for this.

                So what do we have?

                • the coefficients you modified for jscal at pretty much wrong. When I take the initial line from @ironic:

                  jscal -s 6,1,16,-128,128,16513,16513,1,16,-128,128,16513,16513,1,16,-128,128,16513,16513,1,16,-128,128,16513,16513,1,0,0,0,536870912,536870912,1,0,0,0,536870912,536870912 /dev/input/js0
                  

                  then the coefficents of the first axis are: -128,128,16513,16513. As you figured out the first two are the borders of the deadzone. But they have to stay in the input range, i.e. between 0..255. So changing them to 8000 or whatever is likely just plain wrong. The other two are actually scaling factors, mapping the remaining input range to the entire output range (-32767..0, 0..32767). You can not simply change them, but you have to actually calculate them, taking into account the actual input range minus deadzone.

                • if you want to test these changes you should use jstest. If you want to verify how things behave in SDL apps you can use sdl-jstest/sdl2-jstest, for SDL 1 and 2 respectively.

                • as for making the values persistent, you should use some udev magic. Relying on the generic device is likely to fail sooner or later, as they are just numbered by the OS as they are detected or plugged in. If at all, you should use the named devices /dev/input/by-id/usb-Foo_Bar-joystick. And the init script won't work if you plug in the device later on. The debian joystick package (used in Raspbian or Retropie) also ships jscal-store/-restore, which take of the udev magic. But they are not available on Recalbox.

                • somehow something else seems wrong on Recalbox as jscal button mapping is broken:

                  # jscal -q /dev/input/js0 
                  "jscal: error getting axis map: Success"
                  

                The other thing is, as I just found out, that the joydev driver devices (js0) are ignored by SDL1 and SDL2 (and thus programs like dosbox) on Recalbox. See https://forum.recalbox.com/post/75291

                For SDL1 you can override the default device and work around this with export SDL_JOYSTICK_DEVICE=/dev/input/js0. If you do that then sdl-jstest should give you the results you expect, same as jstest. Otherwise you only get the erratic, uncalibrated default behaviour.

                For SDL2 however this does not work. It just ignores this variable. As dosbox on Recalbox uses SDL2 your jscal based calibration will never end up there. It will always use the erratic, uncalibrated default.

                The open questions are:

                • can SDL2 be compile configured to obey SDL_JOYSTICK_DEVICE?
                • can SDL2 be compile configured to default to joydev driver devices (js*)?
                • can the raw event devices be calibrated (as the archwiki page suggests)? At least the tools are not available in Recalbox.

                So yea, I guess we are stuck the way things currently are. No calibration for Dosbox (or any other SDL2 based apps, ScummVM? uae4arm/amiberry?).

                Btw: what is this blue program? I couldn't find a "Recalbox Joystick/Gamepad Utility" anywhere...

                voljega 1 Reply Last reply Reply Quote 2
                • voljega
                  voljega Banned @redm last edited by

                  @redm it's a program @ironic wrote but didn't share yet

                  @rockaddicted @substring any thoughts on what redm discovered ?

                  1 Reply Last reply Reply Quote 0
                  • Substring
                    Substring last edited by

                    Just read a part of https://www.reddit.com/r/linux_gaming/comments/5xics8/a_big_problem_with_joysticks_in_linux_right_now/ today, it's the same as what @redm said.

                    Regarding Recalbox :

                    • the joystick API is outdated, clearly. I think only AplleII and scummvm use SDL 1 for now. Scummvm will switch to SDL2 on the next b*mp, leaving only AppleII on SDL1 (if my memory is not failing)
                    • considering the joystick API shouldn't be used anymore, we removed jstest

                    The questions so far are :

                    • can we patch dosbox to add a custom deadzone
                    • is there a way to calibrate a joystick for evdev

                    Just a reminder : we're talking about a system that needed joystick calibration. Today, is the emulation right regarding this technologic gap ?

                    Former dev - Please reply with @substring so that i am notified when you answer me
                    Ex dev - Merci de me répondre en utilisant @substring pour que je sois notifé

                    redm rockaddicted voljega 3 Replies Last reply Reply Quote 0
                    • redm
                      redm @Substring last edited by

                      @substring said in Régler manuellement les deadzones:

                      Just read a part of https://www.reddit.com/r/linux_gaming/comments/5xics8/a_big_problem_with_joysticks_in_linux_right_now/ today, it's the same as what @redm said.

                      doh .. I should have found this page earlier, it would have saved me a lot of time 😉

                      The questions so far are :

                      • can we patch dosbox to add a custom deadzone

                      I think this is only the 2nd best option. I would do as much as possible outside of dosbox. Not only because configuring dosbox is a pain anyway, but also because you could then reuse the calibration for all other SDL based emulators and possibly add a UI somewhere.

                      • is there a way to calibrate a joystick for evdev

                      Apparently there is a calibration tool now, but evdev is still lacking making the changes persistent though udev.

                      I would add another point related to this:
                      -is there a way to select joystick devices for dosbox?

                      With joydev and SDL1 you could set the env variable SDL_JOYSTICK_DEVICE, which is not possible anymore with SDL2. Patch dosbox? Apparently somebody created a patch for dosbox to add a config option: https://sourceforge.net/p/dosbox/patches/253/. But also here, doing this from outside would be nicer. You could add per rom controller configuration to the ES context menu...

                      Just a reminder : we're talking about a system that needed joystick calibration. Today, is the emulation right regarding this technologic gap ?

                      What do you mean with this question? I think we need calibration outside of dosbox, if that is the question. At least in my (limited) experience I found it to be more reliable to calibrate with system tools and leave alone all possible in game joystick calibration. That only made things worse. Or are you questioning whether we need calibration at all? In this case I would also say: yes.

                      1 Reply Last reply Reply Quote 0
                      • rockaddicted
                        rockaddicted @Substring last edited by

                        @substring said in Régler manuellement les deadzones:

                        the joystick API is outdated, clearly. I think only AplleII and scummvm use SDL 1 for now. Scummvm will switch to SDL2 on the next b*mp, leaving only AppleII on SDL1 (if my memory is not failing)

                        scummvm is already using sdl2 since last b*mp.

                        ScummVM-RASPBERRYPI README
                        ==============================================================================
                        
                        Notes
                        ============
                        
                        This version of ScummVM uses SDL2 hardware accelerated graphics, be it
                        plain SDL2 which in turn uses dispmanx/gles2 or by using gles1 via an
                        SDL2-configured GLES1 context.
                        

                        Recalbox V4.1.0 - RPI3 OC - Xbox360 wireless
                        Wiki ENG : https://github.com/recalbox/recalbox-os/wiki/Mini-How-To-(EN)
                        Wiki FR : https://github.com/recalbox/recalbox-os/wiki/Mini-How-To-(FR)

                        Don't forget to upvote messages if it has been useful ;)

                        1 Reply Last reply Reply Quote 0
                        • voljega
                          voljega Banned @Substring last edited by

                          @substring said in Régler manuellement les deadzones:

                          can we patch dosbox to add a custom deadzone

                          yes : http://www.vogons.org/viewtopic.php?t=24832

                          but as redm stated it might be better to handle that on the OS part maybe ?

                          1 Reply Last reply Reply Quote 0
                          • ironic
                            ironic last edited by

                            Hi.
                            Really happy to see some guys working on deadzone.

                            Sorry for not releasing this piece of code, i have no time to rewrite/release it. It can be used to try joystick on jsX. Later, i think i'll make it better.
                            Get it here but it was written for 450*270 screen resolution.
                            It'll be tiny on LCD resolution. (edit line 123 for font path).

                            Python 2.7 (Pygame) use SDL1 too.

                            Rpi2/Rpi3 - LCD/CRT- NES30 Pro-iBUFFALO

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post

                            Want to support us ?

                            87
                            Online

                            99.6k
                            Users

                            28.1k
                            Topics

                            187.1k
                            Posts

                            Copyright © 2021 recalbox.com