Reputation: 537
I'm trying to move a logitech steering wheel to a certain angle and keep it there using the Force Feedback API. I'm fine with absolutely any programming language, on any platform (Windows, Linux, macOS), if you could please provide me a few hints as to how I can go about implementing this.
Upvotes: 2
Views: 2804
Reputation: 141
Force feedback support is actually in the Linux kernel in most distributions. I think it is best looking into the joystick application to control it. It features joystick control with force feedback support. You can install it on a debian-based distribution like Ubuntu using:
sudo apt-get install joystick
Next to applications to read controller positions (jstest and jstest-gtk) It features a couple of commands to control force feeedback like:
fftest
ffcfstress
ffmvforce
You will need to find out the port where your race wheel can be controlled on. You can do this by entering:
cat /proc/bus/input/devices |less
If connected, you should find your racing wheel with a proper name description and after that something like:
N: Name="Logitech Inc. WingMan Formula Force GP"
...
H: Handlers=js0 event9
Then you can use ffcfstress to let your race wheel oscillate. Fix it securely and enter:
sudo ffcfstress -d /dev/input/event9
You might need to specify the axis which has force feedback which usually only is on the wheel (not on the pedals)
sudo ffcfstress -d /dev/input/event9 -x 6
So I guess now you are interested in the source code, so you should do this to get it:
apt-get source joystick
You will find the source code here:
./utils/ffcfstress.c
You also might find this documentation page about force feedback in the kernel usefull:
Have fun, and please give your result back to the community!
Upvotes: 3