I have this G940 joystick/throttle/pedal set. I've tried it in both Linux and Windows, and there seems to be a dilemma in how to write the joystick file. Several dilemmas actually...
In Windows it is detected as 3 joysticks (different names) with 8, 6, and 8 axes respectively (not all of which do anything); while in Linux it is detected as 1 joystick (different name again) with 16 or 18 axes depending which test program you believe.
Can anyone tell me if this is possible to adapt to this situation with 1 joystick xml file? or do I need 4 (3 for Windows and 1 for Linux)?
I would like to submit this to Git eventually but the wiki page on joysticks isn't detailed enough to handle this case.
In Windows it shows:
- Code: Select all
C:\Program Files\FlightGear\bin\Win32>js_demo.exe
Joystick test program.
~~~~~~~~~~~~~~~~~~~~~~
Joystick 0: "Logitech G940 Joystick"
Joystick 1: "Logitech G940 Pedals"
Joystick 2: "Logitech G940 Throttle"
Joystick 3 not detected
Joystick 4 not detected
Joystick 5 not detected
Joystick 6 not detected
Joystick 7 not detected
+--------------------JS.0----------------------+--------------------JS.1----------------------+--------------------JS.2----------------------+
| Btns Ax:0 Ax:1 Ax:2 Ax:3 Ax:4 Ax:5 Ax:6 Ax:7 | Btns Ax:0 Ax:1 Ax:2 Ax:3 Ax:4 Ax:5 | Btns Ax:0 Ax:1 Ax:2 Ax:3 Ax:4 Ax:5 Ax:6 Ax:7 |
+----------------------------------------------+----------------------------------------------+----------------------------------------------+
| 0000 -0.0 -0.1 -1.0 ^C.2 +0.1 +0.3 +0.0 +0.0 | 0000 +1.0 +1.0 -1.0 +0.2 -1.0 -1.0 . . | 0000 -1.0 -1.0 -0.0 +0.0 -1.0 -1.0 +0.0 +0.0 |
C:\Program Files\FlightGear\bin\Win32>
Whereas in Linux:
- Code: Select all
~/Apps/fg/bin $ ./js_demo
Joystick test program.
~~~~~~~~~~~~~~~~~~~~~~
Joystick 0: "G940"
Joystick 1 not detected
Joystick 2 not detected
Joystick 3 not detected
Joystick 4 not detected
Joystick 5 not detected
Joystick 6 not detected
Joystick 7 not detected
+--------------------JS.0----------------------+
| Btns Ax:0 Ax:1 Ax:2 Ax:3 Ax:4 Ax:5 Ax:6 Ax:7 Ax:8 Ax:9 Ax:10 Ax:11 Ax:12 Ax:13 Ax:14 Ax:15 |
+----------------------------------------------+
| 0000 +0.0 -0.1 -0.1 +1.0 +1.0 +0.0 -1.0 -1.0 +1.0 -0.8 +0.1 -0.1 +0.0 +0.0 +0.0 +0.0 |
I have made detailed notes on which axes and buttons (at least according to js_demo) connects to which real-world actions of the joystick, pedals, hat switches, trim wheels, etc. But I don't think I'll clutter this post with all that yet, because there are contradictions and omissions within them. For example on the windows side, there are two controls which affect the same axis in js_demo. On the Linux side, there are no axes that are affected by the first two trim wheels on the joystick base.
I've also noticed some strangeness with what the common Linux program jscal says about this device:
- Code: Select all
$ jscal /dev/input/js0
Joystick has 18 axes and 21 buttons.
Correction for axis 0 is broken line, precision is 3.
Coeficients are: 0, 0, 1394469, 1394469
Correction for axis 1 is broken line, precision is 3.
Coeficients are: 0, 0, 1394469, 1394469
Correction for axis 2 is broken line, precision is 0.
Coeficients are: 127, 127, 5534751, 5534751
Correction for axis 3 is broken line, precision is 0.
Coeficients are: 127, 127, 5534751, 5534751
Correction for axis 4 is broken line, precision is 0.
Coeficients are: 127, 127, 5534751, 5534751
Correction for axis 5 is broken line, precision is 0.
Coeficients are: 127, 127, 5534751, 5534751
Correction for axis 6 is broken line, precision is 0.
Coeficients are: 127, 127, 5534751, 5534751
Correction for axis 7 is broken line, precision is 0.
Coeficients are: 127, 127, 5534751, 5534751
Correction for axis 8 is broken line, precision is 0.
Coeficients are: 127, 127, 5534751, 5534751
Correction for axis 9 is broken line, precision is 0.
Coeficients are: 127, 127, 5534751, 5534751
Correction for axis 10 is broken line, precision is 0.
Coeficients are: 127, 127, 5534751, 5534751
Correction for axis 11 is broken line, precision is 0.
Coeficients are: 127, 127, 5534751, 5534751
Correction for axis 12 is broken line, precision is 0.
Coeficients are: 0, 0, 536870912, 536870912
Correction for axis 13 is broken line, precision is 0.
Coeficients are: 0, 0, 536870912, 536870912
Correction for axis 14 is broken line, precision is 0.
Coeficients are: 0, 0, 536870912, 536870912
Correction for axis 15 is broken line, precision is 0.
Coeficients are: 0, 0, 536870912, 536870912
Correction for axis 16 is broken line, precision is 0.
Coeficients are: 0, 0, 536870912, 536870912
Correction for axis 17 is broken line, precision is 0.
Coeficients are: 0, 0, 536870912, 536870912
Though I don't know what would be "normal" output from the above command.
Strangely, the --print-mappings output of that command indeed has 18 buttons, but they're numbered 0 to 21, skipping 12 to 15:
- Code: Select all
$ jscal --print-mappings /dev/input/js0
jscal -u 18,0,1,2,3,4,5,6,7,8,9,10,11,16,17,18,19,20,21,21,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,720,721,722,723,724 /dev/input/js0
It seems to be reset to the above after every reboot.
I experimented with rearranging these, or with mapping them only to 0 to 17, and in each case it would give a segmentation fault, but then if I repeated the exact same command a second time it would appear to work (no seg fault), but the behaviour in js_demo output got very strange, such as two different joystick motions (that were previously different axes) affecting the same axis, or some axes being -1 in the middle and +1 at both extremes (instead of the usual, 0 in the middle, -1 at one extreme, and +1 at the other extreme).
Any suggestions for me on how to proceed? Could js_demo be improved to output data for 18 axes instead of the current limit which appears to be 16?
Also I can see that as a general rule, any new joystick files should first control elevator and ailerons with their "main" up-down-left-right controls, then if they have pedals that would naturally control rudder (next most important), and so on. What would be in general the first few most critical things to assign to the first few buttons? or first few most-standard-between-different-joysticks to assign? or most-standard-between-different-aircraft?