There are many questions about this subject:
- Remapping both mouse and keyboard to a gamepad
- How do I configure a joystick or gamepad?
- How to control the mouse pointer via my keyboard?
- …
But the purpose of these questions/answers is to be able to use the gamepad for playing a game.
I would like a solution to use the gamepad to control THE mouse.
To replace the mouse by the gamepad in all applications.
That way I could control my computer in the living-room from my couch with a wireless gamepad.
Best Answer
Following Grumbel's answer, I tried *
xboxdrv
solution with the support of this website and especially this page:Install xboxdrv 0.8.2 from Ubuntu Software Center.
Install also uinput and joydev if needed. I did it this way:
Need to know the event of the gamepad:
Launch
udevadm monitor --udev
and then plug the game pad:I conclude that my gamepad's event is
/dev/input/event8
Display names of every key, axis, button of the gamepad.
The idea is to launch
xboxdrv
and test every button and note the result on paper.In my case the result is:
Set the config file
Create an
xboxdrv-mouse.ini
file to set X Y axis and left and right mouse button.Here I set gamepad buttons 2 for left mouse button and 3 for right mouse button:
Note that value for
REl_X
andREL_Y
seems to define the speed of the mouse, and by defining a negative value it inverts the axis (see here forREL_Y
)Another example with more button definition
Launch it
To avoid launching it with
sudo
, create a udev rule.CONCLUSION
It works fine, it's the best solution for me.