IL-2 Sturmovik: 1946 Forum

This is a community forum and not official technical support. — If you need official support: Contact Us

The following comments are owned by whoever posted them. We are not responsible for them in any way.

Back to Threads Reply to Thread

USB Joystick issues - Linux (Help Don!)

In the "tips and tricks" section Don wrote:

Note: the game doesn't seem to let you remap the joystick functions...or
rather, decides for you what your joystick functions will map to, depending
on what your joystick actually identifies itself as. In linux, using the 'analog'
joystick module, you can change what the joystick identifies as (and what
functions it supports) by passing insmod parameters to the analog module
at module load time using 'map(x)' arguments.

I'm relatively new to Linux -- just where will I find the module? Any tips on editing it? I'm using a Thrustmaster T.Flight Stick X". The stick and hat work, even the rudder (twist stick), but I can only get the main fire button to work (trigger - guns). None of the buttons seem to work bombs or rockets (couldn't get bombs with my wireless keyboard either, but the space bar for rockets worked -- only tried a P-47D). The stick itself has a mapping and a preset button, and I had to play with them to get the trigger to work. It's mapped for MS Flight Sim and "most" PC flight games in auto mode. I need to learn the joystick too, obviously.

After about 5-6 flights the joystick started being really sluggish, and hardly responding at all. Not sure if it was Linux or CrossOver Games problem. Anyone experienced this problem? My trial time is quickly running out and I have to decide whether to buy this or a copy of Win7 (or use a copy of XP I have) for my HTPC. I've been running Linux Mint and am happy with it, but I want to be able to play a good selection games on my 52" TV also. IL-2 is my "acid test"!

Hi Frank,

....I'm not familiar with Mint (apart from PVR/HTPC distros based on that),  

so just be aware there may be differences wrt me talking here about CLFS or Deb6...

...and to be honest, I haven't given this a second thought as to the 'why' of it,
but my other meanderings with joysticks in wine means I should revisit it all...

...the analog module is a linux kernel module - you don't need to find it ; if
you poke at it with modinfo, it should return thusly;

bash-3.2$ /sbin/modinfo analog
filename:       /lib/modules/2.6.34/kernel/drivers/input/joystick/analog.ko
license:        GPL
description:    Analog joystick and gamepad driver
author:         Vojtech Pavlik <vojtech@ucw.cz>
depends:
vermagic:       2.6.34 SMP preempt mod_unload
parm:           map:Describes analog joysticks type/capabilities (array of charp)

..the last line there is what I speak of. The functionality/mapping happens automatically
as the device is initiated, as dictated by device entries (if present) in the input
driver layer ; if no specific device entry is found (and we're pretty sure it's really
a joystick), it gets cast the 'generic' mapping for the 'basic' HID device types. That
is to say a '2 axis/4button' joystick or what-have-you. What can happen, is a piece of
hardware gets mapped like this, but it's not really appropriate due to the HID design
(or how they've mapped things in hardware)...

...on the wine side, these mappings are interpreted into directx namespace...umm...

static const char *axis_names[] = {"X", "Y", "Z", "Rx", "Ry", "Rz",
                                           "Slider1", "Slider2",
                                           "POV1", "POV2", "POV3", "POV4"};

..etc etc. Buttons are similarly mapped to namespace Button0, 1, 2 ..blabla (or is
it Btn0??...), whatever, I'm sure you ge the idea. Now, what can happen, is that
thing you call 'main fire button', may actually be defaultly mapped to say Button8
(because that's where the linux driver layer found/enumerated it). but IL-2 (apart
from probably never expecting to see more than 'x' buttons) may have that mapped to
another function (or oblivion if it's not coded to handle more than 4 buttons), and
ergo it doesn't work. What you want to do (or need to happen), is tell the linux
analog module to map button8 to button0 instead, so it's actually appearing (to the
game) where it should be....

...and that was probably where I left it, in trying to map the xbox controller to IL-2 =)

In that situation, all sort of weird things happen..for example...(//my comment indented);

bash-3.2$ jscal /dev/js0
Joystick has 8 axes and 10 buttons.
//X axis ; Joy1
Correction for axis 0 is broken line, precision is 16.
Coeficients are: -128, 128, 16513, 16513
//Y axis ; Joy1
Correction for axis 1 is broken line, precision is 16.
Coeficients are: -128, 128, 16513, 16513
//Right trigger (ugh)
Correction for axis 2 is broken line, precision is 0.
Coeficients are: 127, 127, 4227330, 4227330

...in IL-2, X & Y are fine, but it 'sees' the next axis and maps it to where I would have
the -other- joystick defined for flight controls, and if you were to imagine an xbox analog
trigger mapped to ailerons (which iirc is what it did), you end up having to fly the plane
with your finger constantly holding the right trigger centered to maintain level flight =)
note other games do things like this too when confronted with a xpad...

...I'll aside some time this weekend to have a closer look at things - I've been meaning to
do it anyhow since I bought a USB 6channel R/C flight controller HID ... 8)

Cheers!

Update:

...m'kay, so I'm guessing my speculations are close to the mark ; I was
looking at something else steamish and noticed I still have the Steam
release of IL-2 installed. Just a quick breeze over the game's pdf
manual, tells me it only supports 4 joystick buttons...

...ummm...you'll need to work out just which joystick buttons map to
whatever dinput hook ... I normally look at that with the dinput_test
lib that's part of mainstream wine ; it's built by default and lives
in/as wine-{$VERSION}/dlls/dinput/tests/dinput_test.exe.so and you can
bang on it with wine in an xterm/konsole ..ie; cd into the directory
as per path above and do..

bash-3.2$ wine ./dinput_test.exe.so
Usage: Z:\usr\local\wine-1.3.27\dlls\dinput\tests\dinput_test.exe.so test_name

Valid test names:
    device
    dinput
    joystick
    keyboard
    mouse

...then you can query one of the namespaces to get wine's idea of what it's
seeing ... for example, my xpad returns this...

bash-3.2$ wine ./dinput_test.exe.so joystick
joystick.c:621: -- Testing Direct Input Version 0x0700 --
joystick.c:206: ---- Microsoft X-Box pad v2 (US) ----
joystick.c:577:
joystick.c:596: X    0 Y  255 Z-2000 Rx  143 Ry  128 Rz-2000 S0    0 S1    0 POV0   -1 POV1   -1 POV2   -1 POV3   -1 B 0 0 0 0 0 0 0 0 0 0 0 0

joystick.c:601:
joystick.c:621: -- Testing Direct Input Version 0x0500 --
joystick.c:206: ---- Microsoft X-Box pad v2 (US) ----
joystick.c:577:
joystick.c:596: X    0 Y  255 Z-2000 Rx  143 Ry  128 Rz-2000 S0    0 S1    0 POV0   -1 POV1   -1 POV2   -1 POV3   -1 B 0 0 0 0 0 0 0 0 0 0 0 0

joystick.c:601:
joystick.c:621: -- Testing Direct Input Version 0x0300 --
joystick: 307 tests executed (0 marked as todo, 0 failures), 0 skipped

...now, you see the button(s) to the right at the end (B 0 0 0 ..) and because my
xpad's laying on the floor with no buttons depressed, we get the expected logical 0
for all buttons -- a depressed button returns a logical 1 instead... so, because the
test prog here is only a one-shot (it always returns), I find it easier to issue
this command instead..;

bash-3.2$ watch -n 2 wine ./dinput_test.exe.so joystick

..which will run the command every 2 seconds while you sit there pushing buttons
and moving axis' until you've obtained your joystick's mapping "as wine is seeing
things" ; control-c to quit when finished. At the end of this foray, you will know
what joystick buttons (physical) map to which joystick functions (in dinput), full
well knowing IL-2 is only likely to see the first 4 buttons...

...that, wouldn't be the end of the world either I don't think, because although
IL-2 may only support 4 joystick buttons, you could remap any other joystick buttons
available to keyboard events using something like qjoyctl to intercept the linux
input events and send them to wine as whatever you define them to be, including
mouse events etc...

...the important thing to establish relative to your issue, is whether or not your
'main' fire button is being mapped to one of the first four dinput joystick button
events -- if it is, IL-2 should be seeing it (suggesting something else is awry),
and if not, at least we know why it's doesn't work =)

CrossOver Forums: the place to discuss running Windows applications on Mac and Linux

CodeWeavers or its third-party tools process personal data (e.g. browsing data or IP addresses) and use cookies or other identifiers, which are necessary for its functioning and required to achieve the purposes illustrated in our Privacy Policy. You accept the use of cookies or other identifiers by clicking the Acknowledge button.
Please Wait...
eyJjb3VudHJ5IjoiVVMiLCJsYW5nIjoiZW4iLCJjYXJ0IjowLCJ0enMiOi02LCJjZG4iOiJodHRwczpcL1wvbWVkaWEuY29kZXdlYXZlcnMuY29tXC9wdWJcL2Nyb3Nzb3Zlclwvd2Vic2l0ZSIsImNkbnRzIjoxNzMxNDM1MjAzLCJjc3JmX3Rva2VuIjoiQmE3ZXNobVU4QWZybnU3YyIsImdkcHIiOjB9