Implement gamepad dual-rumble haptics on Linux via evdev FF_RUMBLE
Categories
(Core :: DOM: Device Interfaces, 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.
| Assignee | ||
Comment 1•3 months ago
|
||
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.
| Assignee | ||
Comment 3•1 month ago
|
||
Description
•