• 6
Badsector

KSP 1.4 Joystick not found under linux

Question

The joystick is correctly installed and work fine in KSP 1.3.1

Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 002: ID 0079:0006 DragonRise Inc. PC TWIN SHOCK Gamepad
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 003: ID 04f2:0841 Chicony Electronics Co., Ltd HP Multimedia Keyboard
Bus 003 Device 002: ID 1bcf:0005 Sunplus Innovation Technology Inc. Optical Mouse
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

But in configuration the gamepad don't work like it is not installed

Edit

Bug Report

Edited by Badsector

Share this post


Link to post
Share on other sites

Recommended Posts

  • 2

Hello everyone, I have the same issue under Ubuntu Linux, and I found a workaround while we wait for a patch to fix this problem:

- Edit: Scratch all that i wrote below, it seems the settings don't get applied, and the joystick doesn't work in flight!  >:(

---------------------------------------------

In a Unity forum, (https://forum.unity.com/threads/no-joystick-detected.475870) someone posted a way to have your joystick recognized:

sudo apt-get install cmake
sudo apt-get install libsdl1.2-dev
sudo apt-get install libsdl2-dev
sudo apt-get install libncurses5-dev
cd ~/Downloads/sdl-jstest-master
mkdir build
cd build
cmake ..
make install

After compiling and installing, run: sdl2-jstest -l

sdl2-jstest -l
Found 5 joystick(s)

Joystick Name:     'Logitech Logitech Extreme 3D'
Joystick GUID:     030000006d04000015c2000010010000
Joystick Number:    0
Number of Axes:     4
Number of Buttons: 12
Number of Hats:     1
Number of Balls:    0
GameController:
  Name:    'Logitech Logitech Extreme 3D'
  Mapping: '030000006d04000015c2000010010000,Logitech Logitech Extreme 3D,a:b0,b:b4,back:b6,guide:b8,leftshoulder:b9,leftstick:h0.8,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:h0.2,start:b7,x:b2,y:b5,platform:Linux'

Joystick Name:     'Xbox 360 Wireless Receiver'
Joystick GUID:     030000005e040000a102000000010000
Joystick Number:    1
Number of Axes:     6
Number of Buttons: 15
Number of Hats:     1
Number of Balls:    0
GameController:
  Name:    'X360 Wireless Controller'
  Mapping: '030000005e040000a102000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,'

(.... el receptor instala 4 joysticks, usamos el nº1)

After that, append the mapping line to /etc/environment:

SDL_GAMECONTROLLERCONFIG="030000006d04000015c2000010010000,Logitech Logitech Extreme 3D,,lefttrigger:b0,righttrigger:b1,a:b2,b:b4,x:b2,y:b5,start:b7,back:b6,guide:b8,leftstick:b9,leftshoulder:b10,rightshoulder:b11,dpleft:h0.8,dpright:h0:2,dpup:h0.1,dpdown:h0.4,leftx:a2,lefty:a3,rightx:a0,righty:a1,platform:Linux,030000005e040000a102000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3"

In my case, I had to tweak the default mapping to get the 4 axes and <<most of>> the buttons to work,  enough to be playable ;-D

Cheers!

Edited by luke-lukem

Share this post


Link to post
Share on other sites
  • 1

I don't have an answer (sorry), but am having the same issue. My joystick works fine with 1.3.1 but not at all with 1.4 . I've calibrated the joystick, deleting the contents of ./.config/unity3d and using the 1.3.1 config file, all to no avail... One interesting note however, is that I looked at the 1.3.1 config file that I tried using, and all the joystick entries had been deleted. Don't know if that means anything or not, but you never know...

Share this post


Link to post
Share on other sites
  • 1

Some news, following @luke-lukem advice i have set SDL_GAMECONTROLLERCONFIG variable, you can find a database with mappings for your device at https://github.com/gabomdq/SDL_GameControllerDB and after you can check with gamepadtool application if all work fine, now the joystick is found and the setting accept keybinding but don't store gamepad axis and probably is related at that old issue

Now i'm going to update the issue on the bugtracker, if you can try that solution can be useful for solving this annoying bug

Edited by Badsector

Share this post


Link to post
Share on other sites
  • 1
8 hours ago, surge said:

As luke-lukem and Badsector have noted, it doesn't actually work yet, because KSP immediately forgets the settings.

The problem is not that KSP forget the axis, axis are recognised and stored perfectly in setting.cfg, the problem is that KSP don't use them.

I have already updated the issue, and i'm waiting for some news from squad

Share this post


Link to post
Share on other sites
  • 1

@luke-lukem

sdl2-jstest -l gives me:

Found 1 joystick(s)

Joystick Name:     'XEOX Gamepad SL-6556-BK'
Joystick GUID:     03000000450c00002043000010010000
Joystick Number:    0
Number of Axes:     4
Number of Buttons: 12
Number of Hats:     1
Number of Balls:    0
GameController:
  not a gamepad

but sdl2-jstest -t 0 recognizes all axes. Also all other joystick/gamepad testing tools I found.

KSP 1.3.1 and all other joystick games I've installed recognized the gamepad.

So this seems not to be the problem.

Exporting the XEOX string from the Git manually changes nothing.

 

KSP 1.4.1 does not recognize the gamepad! (1.4.0 I didn't test)

 

Alex

Share this post


Link to post
Share on other sites
  • 1
On 3/17/2018 at 11:41 PM, Badsector said:

The problem is not that KSP forget the axis, axis are recognised and stored perfectly in setting.cfg, the problem is that KSP don't use them.

It's clearly not that because I've noticed that after assigning an axis, and returning to the settings screen, it still shows '<>' as if it hasn't been assigned, rather than saying something like <Joy2, axis3> or whatever that stupid SDL2 mucks it up to be.

Admittedly, I havent checked the settings.cfg immediately after, but AFAIK, that is only saved on exit anyway. Or perhaps when you press "Apply".

Edited by surge

Share this post


Link to post
Share on other sites
  • 1

I've found a way to get my input working!

But first: The fact that there's a workaround should not stop the investigation of the original bug.

Advanced Fly-ByWire to the rescue! While the plugin has not officially been updated to KSP 1.4 yet, it can be recompiled against the new game dlls and the updated Toolbar with nearly no changes to the source code.

Edit 3: Scroll down to Edit 3 below, old text left for reference:

I don't know if I can post the dll I just compiled, as some modders are not too happy if someone else just recompiles their mod and uploads the dll... So, instead I'll just post a step-by-step guide of how I got it to work.

  1. Install a C# compiler. I used Mono 4.4.1.0.
  2. Download and install the old version of Advanced Fly-By-Wire. Delete the Toolbar mod that comes with it.
  3. Download Toolbar Continued and install it.
  4. Clone the git repo for Advanced Fly-By-Wire
  5. In the Advanced Fly-By-Wire source tree edit the file ksp-advanced-flybywire-linux.csproj to have dependency hints point to the correct dll paths in your KSP 1.4 folder (don't worry about KSPUtil.dll, that one isn't needed any more). I've also added <DefineConstants>LINUX</DefineConstants> to all configurations, just to be sure, but I don't think it's required if you select the correct configuration when building.
  6. In the same file fix the <PostBuildEvent> stuff. It'd try to copy the generated dll to the game folder. Maybe just remove that part.
  7. Edit SDLController.cs: Replace the line
    SDL.SDL_PollEvent(out ev);
    with this:
    SDL.SDL_PumpEvents();

    The reason is that recent Unity versions use SDL for input handling (at least on Linux), so advanced fly-by-wire mustn't consume the input event. The value given back by PollEvent() has not been used anyhow, so obviously the call was only there to cause population of the event queue.

  8. xbuild /property:Configuration=Release ksp-advanced-flybywire-linux.csproj
  9. That should create a subfolder "obj", which should contain the new Advanced Fly-By-Wire dll file.
  10. Replace the ksp-advanced-flybywire.dll in your GameData/ksp-advanced-flybywire with the newly built file.
  11. Use the toolbar in a flight scene to set up your input and enjoy joystick/gamepad support in KSP 1.4.

Edit: I've just seen that @linuxgurugamer has forked the Advanced Fly-By-Wire repo with an additional patch so it does not require Toolbar. I haven't tried to build that one though.

Edit2: I've also opened a pull request on Github containing this one line code change.

Edit 3: I tried to reach out to the author of Advanced Fly-By Wire (Alexander Dzhoganov) if he minds if I upload an updated .dll for 1.4.x, but didn't get a reply. Therefore I just assumed he won't mind, and upload the dll here. Installation is simple: Download the latest Advanced Fly-By-Wire release from Github and install it. Delete the toolbar folder. Get Toolbar Continued and install it. Then download my Advanced Fly-By-Wire dll for 1.4 and replace the dll from the official release. Read on.

Edit 4: I just found out that the .dll file I uploaded in Edit 3 does not work with libsdl2-2.0.8 (and probably other versions as well...). I've only tested it with libsdl2-2.0.4, for which it seems to be working fine. I'll try to fix it so it works with libsdl2-2.0.8 too.

Edit 5: Okay, I've got my Advanced Fly-By-Wire dll from Edit 3 working with libsdl2-2.0.8. Not by changing the source code, but by setting an environment variable. Let me explain: Unity is using SDL internally, yet for reasons beyond my understanding it is not linked dynamically against the system installed libsdl2, but instead uses static linking for this lib. That's usually fine, but if mods try to load the system installed SDL2 version, incompatibilities might arise. Anyhow, luckily the SDL developers are aware of this problem, and offer a solution. So, all one has to do to get the mod working on systems with a newer libsdl2 version is to set the  SDL_DYNAMIC_API=<Path_To_libsdl2.so> environment variable. In other words, I now run my KSP install with following command line:

SDL_DYNAMIC_API=/usr/lib64/libSDL2.so LC_ALL=C ./KSP.x86_64

 

Edited by soulsource
Add info on how to get advanced fly-by-wire working if system-installed libsdl2 version is not the same as the one Unity was built against.

Share this post


Link to post
Share on other sites
  • 0

I have try others solutions like add "SDL_JOYSTICK_DEVICE=/dev/input/js0" to /etc/environment but nothing

After checking the player log i don't find "Using libudev for joystick management" in 1.4

If someone can confirm the same issue i open a bug

Edited by Badsector

Share this post


Link to post
Share on other sites
  • 0

I've got the same problem with my custom controller. It appears under /dev/input/js1, jstest-gtk can see it, it even works under the Windows version, but doesn't appear at all under the Linux version.

Share this post


Link to post
Share on other sites
  • 0
1 hour ago, giganetom said:

I've got the same problem with my custom controller. It appears under /dev/input/js1, jstest-gtk can see it, it even works under the Windows version, but doesn't appear at all under the Linux version.

 

6 hours ago, Lindy said:

I don't have an answer (sorry), but am having the same issue. My joystick works fine with 1.3.1 but not at all with 1.4 . I've calibrated the joystick, deleting the contents of ./.config/unity3d and using the 1.3.1 config file, all to no avail... One interesting note however, is that I looked at the 1.3.1 config file that I tried using, and all the joystick entries had been deleted. Don't know if that means anything or not, but you never know...

 

I have open a bug if you have others information please send yours log or settings

Regards

Luca

Share this post


Link to post
Share on other sites
  • 0

I'm going bleary eyed looking at logs and not finding input references...

Share this post


Link to post
Share on other sites
  • 0
2 hours ago, Lindy said:

I'm going bleary eyed looking at logs and not finding input references...

Gone crazy and did the same with strace, got the same (negative) result: seems like it's not even trying.

Share this post


Link to post
Share on other sites
  • 0
2 hours ago, giganetom said:

Gone crazy and did the same with strace, got the same (negative) result: seems like it's not even trying.

Lolz! My best wild guess is that at best something got forgotten, or over zealously cleaned up, or at worst linux has been boned again by Unity and/or Mono

Share this post


Link to post
Share on other sites
  • 0

So am I the only person that finds it Ironic that after posting link's hailing Kerbal users building of fancy and elaborate custom controllers. And having a release stream on twitch featuring such a controller. Their new game Breaks said controllers. LOL Way to go squad!

Share this post


Link to post
Share on other sites
  • 0

Bah... That's a bit harsh, my joystick works with 1.4 in Windows just fine, it's Linux where the boning continues :P.

Share this post


Link to post
Share on other sites
  • 0

Just tried 1.4.1, same deal. Guess I won't be playing the making history thing for a long time.

But it's fine -  I just perfected an Energia in 1.3 thanks to tweakscaled vectors

Edited by surge

Share this post


Link to post
Share on other sites
  • 0
4 hours ago, surge said:

Just tried 1.4.1, same deal. Guess I won't be playing the making history thing for a long time.

But it's fine -  I just perfected an Energia in 1.3 thanks to tweakscaled vectors

Same here, if squad is able to fix the problem ok otherwise 1.3.1 is fine for me.

@luke-lukem thanks for the info.

Edited by Badsector

Share this post


Link to post
Share on other sites
  • 0

Here's something to do until the linux joystick problem gets sorted out.... Keep the Game Data folders in your windows and linux installs sync'ed, then diff the save files every now and then... I only really need the joystick for flying spaceplanes & atmospheric aircraft. When I have a few aircraft missions together I'll diff the save files, and fly airplanes in windows!

Share this post


Link to post
Share on other sites
  • 0

Nice, another fsck up that prevents me from even contemplating buying the DLC.
 

On 3/14/2018 at 11:04 AM, Delbrutis said:

So am I the only person that finds it Ironic...

No. In addition, I find it ridiculous that something as obvious as joysticks not working at all on GNU/Linux got through QA.

On 3/14/2018 at 11:04 AM, Delbrutis said:

LOL Way to go squad!

Indeed. Colour me not impressed. :mad:
 

1 hour ago, Lindy said:

Keep the Game Data folders in your windows and linux installs sync'ed

What "windows install"? Nobody mentioned one, I haven't had one in years, and I'm not starting now.

If this game didn't run natively on my OS, I would not have bought it in the first place.

Share this post


Link to post
Share on other sites
  • 0

In case we have to end up using this ridiculous system that basically maps the axes of my very expensive joystick to act like a pathetic console controller, heres one for the CH F-16 Combatstick (just the joystick, not the throttle controller):

SDL_GAMECONTROLLERCONFIG="030000008e060000f400000000010000,CH PRODUCTS CH COMBATSTICK USB,platform:Linux,a:b0,b:b2,x:b1,y:b9,back:b3,rightstick:b8,dpup:b4,dpdown:b6,dpleft:b7,dpright:b5,-leftx:h0.8,+leftx:h0.2,-lefty:h0.1,+lefty:h0.4,rightx:a0,righty:a1,lefttrigger:a2~,"
Don't forget to `export SDL_GAMECONTROLLERCONFIG`

Note that there are no new lines in these, the forum formatting will probably add more, so you need to remove them (I've forgotten how to do the codeblock thing)

As luke-lukem and Badsector have noted, it doesn't actually work yet, because KSP immediately forgets the settings.

While I have the extremely hard to find program (you basically have to recompile SDL2 completely) that generates these strings, heres one for a Logiteck MOMO Racing Wheel with pedals:

SDL_GAMECONTROLLERCONFIG="030000006d04000003ca000000010000,Logitech Logitech MOMO Racing,platform:Linux,a:b3,b:b5,x:b2,y:b7,back:b4,guide:b6,leftshoulder:b0,rightshoulder:b1,rightx:a0,-righty:a1~,+righty:a2~,"

The really moronic thing about this system is that the GUIDs (that huge hex number at the beginning) are generated seemingly randomly by SDL2. Theres no way to find out what they are without writing code that asks libSDL2 itself; they aren't related to USB addresses or vendor/product IDs at all.

Some "millenial" at SDL needs a good hard stabbing in the face.

Edited by surge

Share this post


Link to post
Share on other sites
  • 0

While I'm at the soapbox, in the 1990s I wrote a bit of code for a project called "gamedev" that automatically calibrated polled joysticks. Several months later, I found something similar in the linux kernel, similar to:

value > axis_max ? axis_max = value : value;

value < axis_min ? axis_min = value : value;

I think they missed the extra part that also centres the axes - they lost that when they started using /dev/input/jsX (evdev) instead of just /dev/jsX.

I released my bit as public domain, so no matter who wrote it, it has been used in SDL right up until SDL1.2 and because of it, I've always been able to laugh at windos users with impunity because they seem to need to constantly calibrate their joysticks.

Now this... nothing makes me angrier than morons "forgetting" good algorithms just to be more "windows-like", or lately, "console-like", or "ipad-like".

 

Edited by surge

Share this post


Link to post
Share on other sites
  • 0

I've been trying to get my Wiimote Classic Controller to work with KSP 1.4, to no avail. The PS4 controller works out of the box though...

Edit: Well, the buttons on the PS4 controller work. The axis are shown in settings, but do not work ingame (and no, dead zone isn't set to 1).

Edited by soulsource

Share this post


Link to post
Share on other sites
  • 0

Hi fellows, thank you for your support, I hope the devs fix this problem soon, because I really need the joystick to fly planes and drive rovers.

In the meantime I've restored my 1.3.1 install, so if this issue gets solved, I'll be happy to hear about it.

Cheers!

Share this post


Link to post
Share on other sites
  • 0

And luke-lukem, Squad has always screwed up linux (and apple) majorly in the first few new versions, hopefully take-two won't do any worse.

Although I wonder why you need a joystick to drive a rover :P 

I just write kOS code to do trivial crap like that :)

 

Edited by surge

Share this post


Link to post
Share on other sites
  • 0

Well, there are two issues.

Issue #1: If your input device is not a gamepad (or not recognized by SDL to be one), KSP will not recognize it at all. No buttons or axes work.

Issue #2: If your input device is recognized by SDL as a gamepad (or you are using the environment variable that maps it to a gamepad layout), buttons work just fine. Axes however cannot be assigned. They are shown in the assignment dialogue, and are stored to settings.cfg for the respective control-axis (e.g. AXIS_YAW), but are not shown directly in the input settings UI and are not usable ingame. Furthermore, the INPUT_DEVICES block in settings.cfg remains emtpy.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.