Open Bug 2048366 Opened 3 months ago Updated 1 month ago

Implement gamepad dual-rumble haptics on Linux via evdev FF_RUMBLE

Categories

(Core :: DOM: Device Interfaces, enhancement)

enhancement

Tracking

()

People

(Reporter: jesup, Assigned: jesup)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

The standard Gamepad.vibrationActuator playEffect('dual-rumble') / reset() API and its Windows XInput backend are implemented under bug 680289, but the Linux backend (dom/gamepad/linux/LinuxGamepad.cpp) reported zero haptic actuators, so vibrationActuator was null on Linux.

Implement the Linux backend using evdev force feedback: detect FF_RUMBLE via ioctl(EVIOCGBIT(EV_FF, ...) on device add and report a haptic actuator when present and the event node opens writable; upload an FF_RUMBLE/ff_effect via EVIOCSFF (strong/weak magnitudes, replay.length/replay.delay from duration/startDelay), play via an EV_FF write, and remove via EVIOCRMFF. The kernel handles effect timing; an nsITimer resolves the promise complete and removes the effect, and reset/preemption/device-removal resolve preempted.

Requires write access to /dev/input/eventN; degrades gracefully (reports no actuator) when unavailable. Bluetooth DS4/DS5 rumble via HID output reports is a separate follow-up.

Detect FF_RUMBLE on device add (EVIOCGBIT) and, when present and the event
node opens writable, report one haptic actuator. playEffect uploads an
FF_RUMBLE ff_effect (EVIOCSFF) and plays it; the kernel handles startDelay and
duration, and a timer resolves the promise 'complete' and removes the effect.
reset, preemption, and device removal stop the effect and resolve 'preempted'.
Routes the legacy pulse() through the same path.

Duplicate of this bug: 2049438
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: