Jump to content

Eggsome

New Members
  • Posts

    1
  • Joined

  • Last visited

Reputation

1 Neutral
  1. Ok, so this same problem prevented me from using KSP for years. A close friend had been nagging me to try it out, so I decided to buckle down and finally get this sorted. I struggled to find a solution, but eventually realized that the easiest option would be to just brute force it by inverting the mouse whenever the right mouse button is held down system wide. (A dirty hack, but it's the best I could come up with). First make sure you're running a modern version of Ubuntu or Debian (I've tested on 20.04 and Bookworm) and that you have Wayland disabled (I'm not sure what the Wayland replacement for xinput would be). Then install xinput and gcc: user@your-pc:~$ apt install xinput gcc Now identify the event queue for your mouse: user@your-pc:~$ cat /proc/bus/input/devices | grep -B4 mouse0 The output will be something like this: N: Name="Logitech USB Optical Mouse" P: Phys=usb-0000:00:14.0-10/input0 S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb1/1-10/1-10:1.0/0003:046D:C077.0002/input/input5 U: Uniq= H: Handlers=mouse0 event5 Your mouse should always have "mouse0" as a handler, but what we need is the event queue number as well - since that is what we will be querying next. In this case it's event5. Now you can cut and paste the following into a file called ksp_mouse_invert.c #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> #include <linux/input.h> int main() { // initialize variables int fd; struct input_event ev; // Open the event device (replace /dev/input/event5 with your mouse) fd = open("/dev/input/event5", O_RDONLY); if (fd == -1) { perror("Failed to open event device"); return -1; } // Event loop to check mouse input while (1) { ssize_t bytes = read(fd, &ev, sizeof(struct input_event)); if (ev.code == 273) { if (ev.value == 1) { system( "xinput set-prop 10 \"Coordinate Transformation Matrix\" 1 0 0 0 -1 0 0 0 1" ); } if (ev.value == 0) { system( "xinput set-prop 10 \"Coordinate Transformation Matrix\" 1 0 0 0 1 0 0 0 1" ); } } } // Close the event device close(fd); return 0; } You should update the /dev/input/event5 to match whatever the event queue is for your mouse. Now compile the program like this: user@your-pc:~$ gcc ksp_mouse_invert.c -o ksp_mouse_invert And finally run it with elevated privileges so it can connect to the event queue: user@your-pc:~$ sudo ./ksp_mouse_invert You'll have to leave the terminal window open/running with the inverter going while your using KSP. Once you're done, you can just do the normal CTRL+C to terminate/exit. Hopefully this will help other old timers like me who are used to inverted mice in 3d games. I'm so excited to finally get into KSP - wish me luck :-)
×
×
  • Create New...