Régler manuellement les deadzones


  • Moderator
    Moderator
    Team

    @voljega said in Régler manuellement les deadzones:

    le simple fait que le fichier S97jscal soit dans /etc/init.d va l'exécuter automatiquement au démarrage (en dernier je suppose) ou alors il faut ajouer une référence quelque part ?

    S'il est en S97 il s'exécutera bien en dernier (juste avant le S98cleanup), il faut juste qu'il soit en chmod +x


  • CRT Maniac

    Merci @OyyoDams
    Tout est dit :)


  • Themer

    @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 ?


  • CRT Maniac

    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...


  • Themer

    @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:    0Balls  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


  • Moderator
    Team

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

    timed= flase
    

    Au lieu de

    timed=false 
    

  • Themer

    @acris faute de frappe sur le forum ;)



  • 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...


  • Themer

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

    @rockaddicted @substring any thoughts on what redm discovered ?



  • 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 bump, 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 ?



  • @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.


  • Moderator
    Team

    @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 bump, leaving only AppleII on SDL1 (if my memory is not failing)

    scummvm is already using sdl2 since last bump.

    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.
    

  • Themer

    @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 ?


  • CRT Maniac

    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.



Want to support us ?

Join us on :

264
Online

31176
Users

15131
Topics

113835
Posts

Looks like your connection to Recalbox Forum was lost, please wait while we try to reconnect.