Page 1 of 5 123 ... LastLast
Results 1 to 10 of 46

Thread: HOWTO : Joystick/Gamepads under Ubuntu

  1. #1
    Join Date
    Jun 2006
    Beans
    89

    HOWTO : Joystick/Gamepads under Ubuntu

    Hi,

    I've seen there isn't a complete HOWTO about gamepad, here it is. I think it would be nice to make this threat STICKY under Gaming and Leisure....




    This HOWTO will learn you how to use a gamepad under Ubuntu. It should work for Dapper, Edgy, and all other following version of Ubuntu

    What you need

    * You need to have activate the « Universe » depository in your /etc/apt/sources.list or from Synaptic
    * A gamepad for gameport or USB.
    * A SoundBlaster card or compatible (gameport only).
    * Knowing how to use a terminal

    Introduction

    Ok, let's begin. First, plug your gamepad. In 50% of case, the gamepad is auto-detected (If it's a gameport gamepad, you need to reboot, cause it's not plug'n'play). Just test this, if it don't works, see what's next.


    You need to know one important thing under Linux. Most of Linux application use it own algorithm to detect gamepad. It's not like M$ Windows, where there is one tool that centerise all data (and the game use these data). That means that if your gamepad works with "jscalibrator" or other, it may not work with your game. You may need to check configuration of your program (joy_sensitivity for Zsnes for example).

    -------Calibration - Test

    We gonna show different method to calibrate (but especially test) your gamepad.

    ---With "jscalibrator" (unapproved, see below)

    Install the package :

    Code:
    sudo apt-get install jscalibrator
    Then calibrate with the command :

    Code:
    jscalibrator
    Clic on "calibrate".

    Use all your axes in all direction, so the program could save the minimal/maximal values of your gamepad.

    Re-clic on the « Calibrate » button so your data could be saved.

    /!\ Important /!\ : Once save, the informations of calibration are stocked in the file ".joystick" in your /home/user.

    ---By the configuration centre of KDE

    In the KDE menu, select « Configuration centre of KDE ».

    Clic on the section « Périphériques », then « Gamepad ».

    Clic on « Calibrer », then proceed to the calibration and follow instructions.

    ---By console

    The ultimate method !

    Code:
    cat /dev/input/js0
    If you see waird signs, that mean it should work !

    Code:
    sudo apt-get install joystick
    Joystick is a program to calibrate the gamepad in console. Use these command :

    Code:
    jscal /dev/input/js0
    jstest /dev/input/js0
    -------Manual method

    Your gamepad isn't detected ? You just pluged your gamepad and you do not want to reboot ? OK !

    1°/ Créate gameport on Linux

    In terminal :

    You need to place in the correct folder

    Code:
    cd /dev/input
    Create the gameport with command :

    Code:
    sudo MAKEDEV js
    2°/ Loading modules

    You will need "Drivers". Under ubuntu, these are modules that you will need to load with your linux kernel.

    In fist, we gonna do it manually. If all works, we gonna edit some files, so everything could be done at boot.

    A/ Test the solution before edit the files

    In a terminal, load in memory the modules required according to your gamepad.

    For example, for a Sidewinder GamePad (/!\ Check under to know the good modules !!! /!\) :

    Code:
    sudo modprobe joydev
    sudo modprobe ns558
    sudo modprobe sidewinder
    At all moment you can see the modules loaded with the command :

    Code:
    lsmod
    lsmod | grep gameport ## to display only lignes containing "Gameport"
    Now test your gamepad.


    If you success in calibrating your gamepad, it's good, you choose the good modules. Get to the following section.

    If you get an error message and don't suceed to calibrate your gamepad, you need to look under to know the good modules.

    Reminder : To unload a module, you need to use the command modprobe -r (remove) :

    Code:
    sudo modprobe -r sidewinder
    B/ Load the modules automaticaly at start

    For this, we gonna edit the configuration file "/etc/modules". In a Terminal, enter the following command :

    Code:
    sudo gedit /etc/modules (Ubuntu)
    sudo kate /etc/modules (Kubuntu)
    sudo mousepad /etc/modules (Xubuntu)
    Take car of casse sensitive. This file « modules » regroups a part of the driver to load with your Linux kernel.

    In the end of the file, add this text :

    Code:
    ## Pilotes de manette de jeu (joystick)
    joydev         ## Module for gamepads
    ns558          ## Module for gameport
    sidewinder     ## Module for MS-SideWinder pads
    This will give you a file /etc/modules that should look like this :
    Code:
    # /etc/modules: kernel modules to load at boot time.
    #
    # This file contains the names of kernel modules that should be loaded
    # at boot time, one per line. Lines beginning with "#" are ignored.
    
    lp
    
    ## Pilotes de souris
    psmouse
    mousedev
    
    ## Pilotes de carte de son ALSA Ensoniq ES1371 AudioPCI-97
    alias snd-card-0 snd-ens1371
    below snd-es1371
    snd-seq-device ## Optionnal (this is about MIDI)
    snd-seq-midi   ## Optionnal (this is about MIDI)
    
    ## Pilotes de manette de jeu (joystick)
    joydev         ## Module for gamepads
    ns558          ## Module for gameport
    sidewinder     ## Module for MS-SideWinder pads
    In addition of this, you need to create/edit the file /etc/modules.conf, to add lines

    Code:
    sudo gedit /etc/modules.conf (Ubuntu)
    sudo kate /etc/modules.conf (Kubuntu)
    sudo mousepad /etc/modules.conf (Xubuntu)
    In the end of the file, copy the following lines :

    Code:
    alias js0 input
    above input joydev ns558 sidewinder
    Save, and reboot.


    ------- MODULES LIST

    For a sound card with ens1371 chipset

    If you get a sound card with ens1371 (Ex : Sounblaster 64 and 128), you will need to do a small thing before.

    First, verify the model of your sound card : in a terminal, type

    Code:
    lsmod | grep snd_ens1371
    If you got something, that's good, continue, if not, you got an other soundcard (But maybe you can continue by replacing what's next « joystick_port=1 » by « joystick=1 » or « joystick » and adapting with your soundcard.)

    Edit the file /etc/modprobe.d/options :

    Code:
    sudo gedit /etc/modprobe.d/options
    And add the line :

    Code:
    options snd_ens1371 joystick_port=1
    Reboot, and restart the HOWTO from beginning.

    (Thanks PierreR)

    For an Aztech soundcard

    Here too, seems you need to activate the gameport.

    So in /etc/modules.conf, add :

    Code:
    above snd-trident snd-pcm-oss
    alias sound-slot-0 trident
    alias js0 input
    above input joydev pcigame analog adi
    For a MS Sidewinder gamepad

    Code:
    sudo modprobe joydev
    sudo modprobe ns558
    sudo modprobe sidewinder
    sudo modprobe analog ## This one work only for analog pad, like joysticks
    For a Logitech WingMan digital gamepad

    Code:
    sudo modprobe joydev
    sudo modprobe ns558
    sudo modprobe adi ## Specific driver for Logitech gamepads
    For a Logitech WingMan gamepad (analog)

    Code:
    sudo modprobe joydev
    sudo modprobe ns558
    sudo modprobe analog ## Module for analog gamepads
    sudo modprobe pcigame ## Module for PCI card (??)
    sudo modprobe adi ## Module for Logitech pads
    For a MS SideWinder ForceFeedBack Pro

    Code:
    sudo modprobe joydev
    sudo modprobe ns558
    sudo modprobe analog 
    sudo modprobe sidewinder
    sudo modprobe iforce ## Force Feedback driver
    sudo modprobe evdev ## driver for ???
    For a Guillemot dual analog gamepad (gameport, non-USB)

    Code:
    sudo modprobe joydev
    sudo modprobe ns558
    sudo modprobe guillemot
    sudo modprobe analog ## to check
    sudo modprobe iforce ## to check
    Think about the button that activate/desativate the joystick of this pad.

    For a USB gamepad

    (From http://www.linux-usb.org/USB-guide/x194.html )

    If auto-detect don't works (Very rare case !!)...

    Code:
    sudo modprobe usbhid
    sudo modprobe joydev
    Now, plugin your gamepad (If havn't do it before) and test.

    You just need to add usbhid and joydev in /etc/modules like showing before.


    Other gamepads

    To obtain a complete list of modules, you can type "modprobe -l"

    I suggest you to install the "modconf" package :

    Code:
    sudo apt-get install modconf
    Then launch modconf in sudo (It's better to run it with a maximized window) :

    Code:
    sudo modconf
    You will then land on a COMPLETE list of all modules loadable. Get in the folder "joystick", and you will see all joystick driver available !

    About multiples gamepads

    Multiple gamepads works fine. There is just a few bug with "jscalibrator" : /dev/input/js1 points to /dev/input/js0... I gonna report this to launchpad

    EDIT : reported directly to author.

    Links

    Kernel doc here: http://www.freelink.cx/joystick.html.

    Complete page about gamepads : http://www.charmed.com/txt/joystick.txt


    Credits :

    HOWTO by me and other french contributers.

    Thanks to all french user that are workings such hard to maintain the french wiki

    If you have any suggestion/question, post here.

    You are free to copy, redistribute, correct, improve this document, even if you don't quote me in credits.
    Last edited by adam0509; May 23rd, 2007 at 10:04 PM. Reason: corrections

  2. #2
    Join Date
    Jun 2005
    Location
    Belgium
    Beans
    392
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: HOWTO : Joystick/Gamepads under Ubuntu

    Thanks for the howto!
    Running jscalibrator was sufficient for my 'sidewinder gamepad pro'.
    Now I should test it in a game, I was hoping xmoto would support gamepads, but it doesn't seem to be the case

    A small remark about the howto:

    I think sometimes you have [i]sudo[i]s where it's unnecessary. For example cat /dev/input/js0 is sufficient. Also all those modprobe's also work without sudo.
    Atomic military built-up can be reversed: out-law the bomb!

  3. #3
    Join Date
    Jun 2006
    Beans
    89

    Re: HOWTO : Joystick/Gamepads under Ubuntu

    thanks for the answer !

    Quote Originally Posted by bernardfrancois View Post
    A small remark about the howto:

    I think sometimes you have [i]sudo[i]s where it's unnecessary. For example cat /dev/input/js0 is sufficient. Also all those modprobe's also work without sudo.
    No, you're wrong on this one, because modprobe is directly about Linux-kernel, so you need administrator's right...

  4. #4
    Join Date
    Jun 2006
    Beans
    89

    Re: HOWTO : Joystick/Gamepads under Ubuntu

    Another interresting topic about gamepad, and especially gameports :

    http://ubuntuforums.org/showthread.php?t=330607

  5. #5
    Join Date
    Nov 2005
    Location
    Oz
    Beans
    4,408

  6. #6
    Join Date
    Nov 2005
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HOWTO : Joystick/Gamepads under Ubuntu

    I have a USB gamepad (SaitekP220) and when I use jcalibrator it seem to calibrate. When I use snes9express the buttons work but not the D-buttons.

    So I dug about and discovered a programme called jcal which also claims to calibrate. It talks of my pad having 3 axes but I have no idea which one is which, it may be terribly noob of me, but how do you tell?

    If I calibrate with jcal, guessing which is which, and then test, it reports calibration. If I then recalibrate with jcalibrator and then test with jcal it reports that it is not calibrated.

    Also, is there anothe game using a gamepad that is a standard Ubuntu repository option so I can see if I have actually calibrated my pad and/or if it is a snes9/snes9express problem?

    Thanks folks

  7. #7
    Join Date
    Jun 2006
    Beans
    89

    Re: HOWTO : Joystick/Gamepads under Ubuntu

    LINUX IS JUST ****** UP WITH JOYSTICK....



    Sorry, I am a little angry, but you problems hapens to about 50% of peoples, me too I got same problems with zsnes 1.42, Gens and VisualBoyAdvance (+vbaexpress frontend, I just send a mail to the author about this...).


    The fact is, even if you had calibrated your joystick with jscalibrator or other, no other programs read the ".joystick" generated by this program... It's not like Windows where the software can read the data of calibration center...


    I'm gonna send a mail to freedesktop, this can't no longer happens...

  8. #8
    Join Date
    May 2007
    Beans
    82
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: HOWTO : Joystick/Gamepads under Ubuntu

    I just got a gamepad today and had troubles with the analog controls. I searched around and this is a very common problem, but I couldn't find any solution. This might apply to those people having D-pad problems too, because my gamepad maps the D-pad as an analog input.

    Anyway, I believe that after running jscalibrator the analog controls are no longer usable by other programs, even if jscalibrator sees them. The analog sticks and the D-pad become usable after rebooting my machine. Mupen64, ZSNES, Mednafen, and PSX all have no problems with any of the buttons, sticks, or the D-pad on my gamepad after rebooting, so long as I don't start up jscalibrator.

    Hopefully this will help some people, and probably only those with auto-detected gamepads. Mine is a Logitech Dual Action, and it works just fine now. Oh, if anyone has another work-around for this besides a reboot, I'd like to know.

  9. #9
    Join Date
    Jun 2006
    Beans
    89

    Re: HOWTO : Joystick/Gamepads under Ubuntu

    FOUND IT


    jscalibrator gives real values to kernel, that's why it don't works.


    ALL GAMES will works on Kubuntu, because of the joystick calibration thing give emulate value (it gives 32000 with my sidewinder gamepad, where jscalibrator will give "1"...)


    SO, JUST INSTALL :


    Code:
    sudo apt-get install kcontrol
    And it will work with ALL games !!!





    EDIT :

    That works well with the joystick package too :

    Code:
    sudo apt-get install joystick
    jscal -c /dev/input/js0
    then you can : "man jscal" and "man jstest".

    Code:
    jstest
    Verify that jstest takes values likes -32767 / 32767 !!!!
    Last edited by adam0509; May 20th, 2007 at 11:44 AM. Reason: adding

  10. #10
    Join Date
    May 2007
    Beans
    20

    Re: HOWTO : Joystick/Gamepads under Ubuntu

    worked like a charm with my cheap usb gamepad. thanks dude, made my day.

Page 1 of 5 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •