Author Topic: How do I force /dev/input/js2 for my joystick? [SOLVED]  (Read 4238 times)

0 Members and 1 Guest are viewing this topic.

How do I force /dev/input/js2 for my joystick? [SOLVED]
I just got Freespace2 installed on my AMD64 Gentoo linux box  :D  Everything works but I've got a lot of crap hooked up to this box.  I've got a Wireless keyboard made by Lemel with a 'thumb' joystick that I use like a remote control from my sofa, that thumb joystick is /dev/input/js0.  I've also got a noname wireless gamepad which gets picked up as /dev/input/js1.

Once I got fs2_open running the first thing I did was go but a Logitech Attack 3 (did that today btw :p).  The Attack 3 gets picked up as /dev/input/js2 and jstest recognizes all the buttons (there's like 11), that little throttle lever, and of course the joystick axis's.  So Linux fully supports this stick.

Unfortunately, I've discovered that fs2_open uses the Lemel keyboards thumb stick.

I want know if I can tell fs2_open to use /dev/input/js2. :hopping:

I compiled my fs2_open_r and if somebody tells me how I'd be willing to modify the source to hard code /dev/input/js2.

As far as I know Linux fs2 has no launcher so I've got to use the command line and this is how I start it:
./fs2_open_r -spec -env -glow -mipmap -orbradar -window -nograb -mod derelict,mediavps

I use -window because I've got two screens and fs2 will display half on one and half on the other without it, -nograb is just so I can mouse out of the window while I'm testing things out.

BTW, kudos to the developers and artists, the game looks fantastic.

SOLUTION:
Freespace uses the sdl library (at least for joystick input).
You can tell SDL what joystick you want it to use via an environmental variable.

Here's how I tell SDL I want it to use /dev/input/js2.

I go to a bash prompt and put in the following command and press enter:

SDL_JOYSTICK_DEVICE=/dev/input/js2;export SDL_JOYSTICK_DEVICE

then I start freespace in the regular way.  SDL seems to default to /dev/input/js0, so if your preffered Joystick shows up as something other than that you can use the above in a bash prompt to tell it where to look.

I've got a simple script called fs2 I use to start the game:

SDL_JOYSTICK_DEVICE=/dev/input/js2;export SDL_JOYSTICK_DEVICE

./fs2_open_r -tbp -spec -glow -env -mipmap -nomotiondebris -ship_choice_3d -3dwarp -warp_flash -decals -missile_lighting -normal -3dshockwave -cache_bitmaps -snd_preload -dualscanlines -targetinfo -orbradar -ballistic_gauge -window -nograb -mod mediavps -window -nograb
« Last Edit: April 14, 2009, 09:13:39 am by flinkdeldinky »

 

Offline FUBAR-BDHR

  • Self-Propelled Trouble Magnet
  • 212
  • Master Drunk
    • 165th Beer Drinking Hell Raisers
Re: How do I force /dev/input/js2 for my joystick?
No-one ever listens to Zathras. Quite mad, they say. It is good that Zathras does not mind. He's even grown to like it. Oh yes. -Zathras

 

Offline chief1983

  • Still lacks a custom title
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: How do I force /dev/input/js2 for my joystick?
If you do fiddle with that launcher, post your experience.  You're better off compiling it as well, the trunk in its SVN is several revisions newer than the latest posted build last I checked.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

  
Re: How do I force /dev/input/js2 for my joystick?
I'm going to check out that launcher.  What I've done for now is unplug every joystick and plug in my Logitech Attack 3 first then plug in my wireless keyboard.  That makes the attack 3 /dev/input/js0 and everything works.  Not the solution I was loooking for though because I don't always want the Attack 3 always plugged in and I don't want to unplug and replug everything just to play the game.