X3: Terran Conflict

X3: Terran Conflict

View Stats:
2Karl Sep 28, 2014 @ 1:01am
CH Products Pro Throttle and MS Force Feedback 2 on Linux how-to
Hi all, I posted over in the X3: Reunion Linux thread on the official X Universe boards, but this is probably relevant to some of you here:

I have managed to get the my CH Products Pro Throttle and Microsoft Sidewinder Force Feedback 2 to work together perfectly in X3: Terran conflict. It was a pain in the backside to do, but here's how:

First I grabbed the source code to joy-map[linuxjoymap.sourceforge.net], the linux userspace joystick mapping program. This allows you to remap axes and buttons on existing devices and assign them to a new virtual device. By default, joy-map sets all the evdev abs_max values to 32767 and all the evdev abs_min values to -32767 for all axes. When I was running it out of the box, this caused the virtual stick to barely register movement, as the raw output from the USB devices was in the region of -256 to 256 for the throttle and -512 to 512 for the sidewinder.... and then the stick twist was -32 to 32, and the hats were -1 to 1. As X3 doesn't let you recalibrate in game, and any joydev calibration with jscal is ignored, this was not much use.

So I used evtest to find out what the maximum and minimum reported raw values were for each and every axis I was remapping. I then edited devices.c, one of the joy-map source files. Line 127 is the start of the loop which sets up the abs_max and abs_min values for all of the axes, so I commented out the loop and hard-coded the values for each axis in. After that was done, I compiled the mapper, and wrote a map file which combined all of the axes and buttons I needed.

Finally, I copied the compiled loadmap executable and my joystick map config to my X3:TC directory and modified the last line of testandlaunch to read


./loadmap CH-sidewinder.map & ./$1 killall loadmap


It's not as straighforward as the CH Products Control Manager software in Windows, and if I change my stick setup (as I plan on doing next payday when I intend to get a CH Fighter Stick and CH Pro Pedals) then I'll have to edit the joy-map source and recompile, but it works, and I can play X3:TC in Linux with mt HOTAS setup.

If anyone is interested in the hacked joy-map source or the config map file, I can provide them. There's probably a way to get joy-map to set abs_max and abs_min values based on the values supplied by the devices themselves, but that's something I'll work on when I have more time.

This may be of use to people whose joysticks do not work without calibration, as well as anyone looking to combine multiple stick setups to play X3:TC
< >
Showing 1-15 of 65 comments
Grumpy_Old_Man Sep 28, 2014 @ 11:11am 
Yes you need a third party joystick mapper to get throttle/pedals to work together. I use PPJoy.
2Karl Sep 28, 2014 @ 11:24am 
Originally posted by Dieu_Le_Fera:
Yes you need a third party joystick mapper to get throttle/pedals to work together. I use PPJoy.

Did you even read the post?
Grumpy_Old_Man Sep 28, 2014 @ 11:43am 
Yes I did. Though my problem and yours wasn't exactly the same, it is very similiar. X3 does not detect multiple joysticks, so you had to go to third party. The only difference really is that you had to "hack" to get yours to work properly, from experience I knew not to expect a none hardcore sim to detect and properly run seperate controllers together, and I knew what program to use to get mine to work without much of a problem.

Though in your defense I am not sure if PPjoy which isn't updated anymore works for linux.
2Karl Sep 28, 2014 @ 12:48pm 
PPjoy does not work on Linux. The purpose of this post was to help people who are on Linux to get their setup working. Of course I had read numerous solutions which Windows users have been able to utilise, but none of them worked for Linux. It was only recently that I found a solution, and it was a tricky one, so I wanted to help others out. If PPjoy was an option I certainly would have mentioned it.
Grumpy_Old_Man Sep 28, 2014 @ 1:29pm 
Well you can't be to angry, you are running an OS that is free! The rest of us pay for windows and judging by the magority of steam support Linux is still seen as a "red herring" but it seems the tide is turning in your favore slowly.
Last edited by Grumpy_Old_Man; Sep 28, 2014 @ 1:29pm
2Karl Sep 28, 2014 @ 3:36pm 
I'm not angry at all. I'm trying to help people.
Ovadex Jan 1, 2015 @ 7:23pm 
Thanks for the info 2Karl. I'm suprised there isn't a more user friendly way to do this yet. Joy-map was first released back in 09. Trying to get it working with a saitek x55 but I'm on the verge of gouging my eyes out. lol
Last edited by Ovadex; Jan 1, 2015 @ 7:23pm
Ovadex Jan 2, 2015 @ 11:18am 
Hey 2Karl, think I could get a copy of your files to work off of?
2Karl Jan 3, 2015 @ 2:11am 
sure thing, here's the archive: http://www.triplesix.co.uk/joymap.tar.gz

You want to look in the "devices.c" file, line 133 to 154. Mine is currently this:
dev.absmax[0]=512; dev.absmin[0]=-512; dev.absmax[1]=512; dev.absmin[1]=-512; dev.absmax[2]=32; dev.absmin[2]=-32; dev.absmax[3]=230; dev.absmin[3]=13; dev.absmax[4]=198; dev.absmin[4]=62; dev.absflat[4]=15; dev.absmax[5]=183; dev.absmin[5]=58; dev.absflat[5]=15; dev.absmax[6]=1; dev.absmin[6]=-1; dev.absmax[7]=1; dev.absmin[7]=-1; dev.absmax[8]=1; dev.absmin[8]=-1; dev.absmax[9]=1; dev.absmin[9]=-1;

The index of the arrays dev.absmax and dev.absmin refer to the various axes of the two sticks - 0 and 1 are the sidewinder's x and y, 2 is the sidewinder twist, etc. Note that this is based on the axis mapping as performed in http://www.triplesix.co.uk/CH-sidewinder.map . I've commented that map file pretty extensively, but obviously there's going to be a whole load of changes you'll need to make in order to get it working with a saitek.

Happy to help you out if you run into problems though!
Ovadex Jan 3, 2015 @ 9:10am 
Would the axes and buttons in the map file align with the numbers listed in jstest-gtk?
2Karl Jan 3, 2015 @ 9:21am 
Yes, but note that jstest recalibrates on the fly so specifies all axis ranges from -32767 to 32767, so don't use jstest to find out the ranges of the axes, use evtest for that. Also note that (on the sidewinder and CH throttle) the 8-way POV hat is mapped as an axis - you can find out what event code this maps to using evtest. For example the evtest output for my sidewinder looks like this:

Input driver version is 1.0.1 Input device ID: bus 0x3 vendor 0x45e product 0x1b version 0x100 Input device name: "Microsoft SideWinder Force Feedback 2 Joystick" Supported events: Event type 0 (EV_SYN) Event type 1 (EV_KEY) Event code 288 (BTN_TRIGGER) Event code 289 (BTN_THUMB) Event code 290 (BTN_THUMB2) Event code 291 (BTN_TOP) Event code 292 (BTN_TOP2) Event code 293 (BTN_PINKIE) Event code 294 (BTN_BASE) Event code 295 (BTN_BASE2) Event code 303 (BTN_DEAD) Event type 3 (EV_ABS) Event code 0 (ABS_X) Value 0 Min -512 Max 511 Fuzz 3 Flat 63 Event code 1 (ABS_Y) Value 40 Min -512 Max 511 Fuzz 3 Flat 63 Event code 5 (ABS_RZ) Value 0 Min -32 Max 31 Flat 3 Resolution 57 Event code 6 (ABS_THROTTLE) Value 127 Min 0 Max 127 Flat 7 Event code 16 (ABS_HAT0X) Value 0 Min -1 Max 1 Event code 17 (ABS_HAT0Y) Value 0 Min -1 Max 1 Event type 4 (EV_MSC) Event code 4 (MSC_SCAN) Properties: Testing ... (interrupt to exit)

You can see which event code each axis is mapped to there - you should get some similar output from the saitek I should imagine
Ovadex Jan 3, 2015 @ 10:59am 
Yea, my ranges line up with the defaults thankfully. Working my way through the file now. Hope to test it in an hour or so. If it work good I'm gonna post the config so others may benefit.
2Karl Jan 3, 2015 @ 12:42pm 
nice one, let me know if you need any more help

Ovadex Jan 3, 2015 @ 1:16pm 
Nearly there. The X55 has soooo mannnnyyy buttons. lol
Ovadex Jan 3, 2015 @ 6:15pm 
Ok, progress is being made but I'm hitting this when I run loadmap

Failed to grab device: Device or resource busy
Failed to lock device with vendor=0x0738, product=0x2215. Continuing anyway...

repeating.


I have

rmmod ehci_hcd
rmmod ohci_hcd
rmmod uinput
modprobe uinput
/sbin/reserve_js
modprobe ehci_hcd
modprobe ohci_hcd

in rc.local

Any suggestions?
< >
Showing 1-15 of 65 comments
Per page: 1530 50

Date Posted: Sep 28, 2014 @ 1:01am
Posts: 65