berarma / new-lg4ff

Experimental Logitech force feedback module for Linux
GNU General Public License v2.0
298 stars 18 forks source link
force-feedback linux logitech steering-wheel

new-lg4ff for Linux

Improved Linux module driver for Logitech driving wheels.

Thanks to Oleg Makarenko for adding support for the Logitech G923 Racing Wheel (PS4/PC version).

Supported devices:

This module is not compatible with the Logitech G920 Driving Force and XBOX/PC version of the Logitech G923 (046d:c26d, 046d:c26e). Both wheels use the HID++ protocol and are supported by the HID++ driver as of kernel 6.3.

Reports on success or failure using this module on untested devices are welcome.

Differences with the in-tree module

It has all the features in the in-kernel hid-logitech module and adds the following ones:

Requirements

Build and install

The module can be installed with DKMS or manually. Follow just one of these procedures.

DKMS

The module will be installed in the /usr/src directory. Removal, updates, and rebuilds for kernel upgrades will be managed by dkms. The module will load automatically at system reboot.

Follow these steps:

$ sudo dkms install /usr/src/new-lg4ff

Installing the module won't load it into memory. You'll have to load it manually or update your initramfs image and reboot.

When using DKMS the module will be installed as hid-logitech so it automatically replaces the old module. Once loaded, it will be displayed as hid-logitech-new though.

NOTE: If you had previously installed the module using the manual method then you must delete the module by hand: $ sudo rm /lib/modules/$(uname -r)/extra/hid-logitech-new.ko

Update initramfs image

DKMS is deprecating the feature to automatically update the initramfs image so after a reboot the default module will load instead of the new one. It needs to be done manually.

Users using the generic initramfs tool can do it with the command:

sudo update-initramfs -u

Updating

When updating the module, update the code in /usr/src/new-lg4ff and repeat the install step.

In case you want to rebuild the module, remove it and install again:

$ sudo dkms remove new-lg4ff/<version> --all
$ sudo dkms install /usr/src/new-lg4ff

Replace <version> with the version you want to remove.

Manual method

Type the following commands inside the project directory:

$ make
$ sudo make install

In some distributions, the install step might throw some SSL errors because it's trying to sign the module. These errors can be ignored.

Now the module is installed but not loaded.

To load the module:

$ sudo make load

To unload the module (restoring the in-kernel module):

$ sudo make unload

Check that the driver is loaded

Run:

sudo dmesg

You should see something like this (notice the version at the end of the module description):

[347092.750524] logitech 0003:046D:C24F.000B: Force feedback support for Logitech Gaming Wheels (0.2b)
[347092.750525] logitech 0003:046D:C24F.000B: Hires timer: period = 2 ms

Force Feedback clipping

There's been work done to be able to monitor FF clipping and avoid it. The FF force level is calculated as a maximum since we can't know the exact amount of force the wheel is applying because conditional effects are dynamic depending on wheel movements.

Games using conditional effects will report the maximum force level as if the conditional effects were playing at the maximum level. This way we may get a higher value than real one but never lower. Since the goal is to avoid clipping, this is the measure we are interested in.

Conditional effects gain can be tuned seperately for each effect type to leave more dynamic range for the other effects. The default value seems close enough to the gain used in the official Logitech driver for Windows.

Clipping isn't necesarily bad. To allow a wider dynamic range of forces to be played, it may be good to have some very light clipping, and even lots of clipping are acceptable when crashing or driving over very rough ground.

Options

You can use modinfo to query for available options.

New options available:

New SYSFS entries

They are located in a special directory named after the driver, for example:

/sys/bus/hid/drivers/logitech/XXXX:XXXX:XXXX.XXXX/

Entries in this directory can be read and written using normal file commands to get and set property values.

combine_pedals

This entry already existed. It has been extended, setting the value to 2 combines the clutch and gas pedals in the same axis.

gain

Get/set the global FF gain (0-65535). This property is independent of the gain set by applications using the Linux FF API.

autocenter

Get/set the autocenter strength (0-65535). This property can be overwritten by applications using the Linux FF API.

spring_level

Set the level (0-100) for the spring type effects.

damper_level

Set the level (0-100) for the damper type effects.

friction_level

Set the level (0-100) for the friction type effects.

ffb_leds

Use the wheel leds (when present) to monitor FF levels.

Led combinations:

peak_ffb_level

It returns the maximum detected FF level value as an integer. It can be written to reset the value and start reading again. Values read will be always greater or equal than the last value written. Values between 0-32768 mean no clipping, greater values mean there can be clipping.

Contributing

Please, use the issues to discuss bugs, ideas, etc.

Disclaimer

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.