JoyShockMapper icon indicating copy to clipboard operation
JoyShockMapper copied to clipboard

[Bug] Cannot Call Configs Using Buttons On Linux - Broken Modeshifting

Open Jazztache opened this issue 1 year ago • 1 comments

Hello. I found a critical piece of missing/busted functionality on Linux.

I am unable to reference configs from other configs by using button presses. This means that I cannot use the mode shifting functionality of the application at all.

I made sure I was at /home/jazztache/.config/JoyShockMapper before starting the program, and also verified the location of JSM_DIRECTORY was the correct one. I also made sure to copy over my configs directly to the root directory's config folder in order to work with sudo permissions.

I have read the README, and it mentions using both the absolute paths and relative paths. I have tried 4 variations of absolute paths, and 4 variations of relative paths. I used a mix of quotes and Windows paths as well.

The screenshot below shows all of the variations I tested, plus a few extra commands to verify the directories were correct.

Screenshot_20241126_181100

This is really hampering my ability to use JSM, because I would like to have my binds separated into separate files for convenience, and for the sake of using certain combinations for modeshifting.

For reference, I compiled my build from source using commit 2c4f767b42893f2bdf6736222c4c8aadb5a5586d

Thankyou!

Jazztache avatar Oct 20 '24 23:10 Jazztache

Hi Jazztache,

I too feel that broken modeshifting is a critical bug for JSM on linux that negatively impacts on it's usefulness. Unfortunately from my understanding the current linux code relies on the TIOCSTI syscall which has been disabled by default in the Linux kernel since 6.3 for security reasons (so it's unlikely to be coming back any time soon). Technically it can can still be accessed with a sysctl change and adding sys_admin capability to the binary but I could not get that working on my system at all. To this end I have developed a patch (currently for JoyShockMapper 3.5.3) that redirects the WriteToConsole output to a named pipe

/tmp/Joyshockmapper.pipe

If Joyshockmapper is run to receive input from that named pipe i.e. with

/usr/bin/JoyShockMapper < /tmp/Joyshockmapper.pipe

then JSM is able to again write to its own console and the following features work again

  • Systray File Loading
  • Modeshifting (chainloading configs via buttons)

Note that this fix may not suit everyone but I currently run JoyShockMapper with the named pipe redirection anyway as I write the path to the current game to this named pipe (using a udev script that automatically fire off when a controller device is connect). I have read that others have worked around the retirement of the TIOCSTI syscall bu tracking down and writing to the input fd of the grandfather process but I and not sure how to investigate this option.

So here is my patch as a gist. Note that I have used slightly modified code from https://github.com/murtazasmart/named-pipes-c but this shouldn't present a problem as this code is under the MIT Licence, same as JoyShockMapper itself.

This should apply cleanly to the downloaded source code for JoyShockMapper-3.5.3 with the command

patch -p1 < ~/JoyShockMapper_3.5.3_namedpipe_linux_2.patch when run in the JoyShockMapper directory then build as normal Remember to load this with

cd ~/.config/JoyShockMapper /usr/bin/JoyShockMapper < /tmp/Joyshockmapper.pipe

and let me know if systray config loading and chainloading works for you.

I will update this code to work with the latest JoyShockMapper git when the bug fix Electronicks is working is released.

mdbott avatar Feb 12 '25 11:02 mdbott