Haptics

= Haptics =

Haptics are usually taken for granted on devices, they make it easier to tell if your finger has hit the keyboard when typing, and generally add a new dimension of UX.

Device Support
Non-SoC haptic drivers:
 * GPIO vibrator uses a simple GPIO line to provide a vibrating feedback
 * Regulator Haptic uses a regulator
 * PWM vibrator uses a PWM
 * MAX77693 vibrator - an MFD that includes haptic support

The following SoCs support haptics:


 * MSM8916 (and newer related SoCs?) (drivers/input/misc/pm8xxx-vibrator.c)
 * MSM8996 - SDM845 (pmi8998_haptics.c) drivers/input/misc/pmi8998-haptics.c <- the driver is not yet upstream, a version can be found here.

If your device uses one of MSM8996, MSM8998, SDM845, you can use this WIP haptics driver (and associated dts node). You will have to find the correct play-rate for your device and fill it out like this.

Currently only the buffer play mode and LRA (Linear Resonant Actuator) are supported, contributions welcome! For more detailed information on how the haptics hardware works, see the bottom of this page.

You can test the haptics device using  which is part of the   package.

feedbackd
Once your hardware is up and running, copy the  file and adjust it to match the DTS compatible line for your device (e.g.  ).

In order for feedbackd to detect your haptics hardware, you need to add a new udev rule, below is the rule for.

After this, run

This will find the haptics input device and add the  property for feedbackd.

With the above changes, you should now feel ForceFeedback in Phosh!

Tweak your feedbackd theme file to work well with your device, then upstream it to feedbackd-device-themes.

hfd-service
hfd-service is used by Lomiri (previously known as Unity8). It is now supported by Alpine Linux. Support for forcefeedback vibrators is added by this PR. The Manjaro ARM unstable branch also currently has these patches.

hfd-service automatically detects the first input device that supports forcefeedback and uses it for haptics.

fftest
The program fftest from the alpine package linuxconsoletools can be used to test a haptic device if you have a driver for it. For a device with a max77693 mfd responsible for the vibrations, fftest checks for possible vibration pattern modes and lets you select which one to run: