Skip to content

feat(input): haptic.h - a force-feedback motor over evdev - #117

Merged
mcereal merged 1 commit into
mainfrom
feat/haptic
Nov 14, 2026
Merged

mcereal merged 1 commit into
mainfrom
feat/haptic

Conversation

@mcereal

@mcereal mcereal commented Nov 14, 2026

Copy link
Copy Markdown
Owner

Adds inkcell/ui/haptic.h: a force-feedback motor on an evdev node, the output side of the input devices inkcell already reads. A phone's haptic actuator and a gamepad's rumble both appear this way on Linux. inkos's audio service uses it for touch feedback and alarms (inkos roadmap R2).

  • One pulse at a time: inkcell_haptic_pulse(h, ms, strength) re-uploads one effect in place (EVIOCSFF with its id) and plays it with an EV_FF event, replacing whatever was playing. A pattern is the caller's timer stepping through pulses. One effect, updated in place, is what every driver supports; a bank of effects is not.
  • Effect kind: FF_RUMBLE where the device has it, otherwise an FF_PERIODIC sine. A node with neither refuses with -ENOTSUP.
  • inkcell_haptic_find(dir): the first event* node under a directory that has a motor.
  • inkcell_haptic_magnitude(): percent to the 16-bit magnitude, squared. Pure, tested everywhere.
  • Off Linux: every open refuses with -ENOSYS, as the KMS backend does. Request codes go through inkwell's base/ioctl.h.

Tests (tests/suites/ui_haptic.c):

  • the strength curve;
  • refusals for a missing node and an empty directory (-ENOSYS off Linux);
  • on Linux as root, the real kernel path: the test makes a uinput device with FF_RUMBLE, forks a child that finds it by capability and pulses it, answers the kernel's UI_FF_UPLOAD, and checks a 30 ms / 60 % rumble was uploaded and played. Without root or /dev/uinput it says it skipped.

Verified: make test and make format-check on macOS. In alpine under --privileged, all 439 tests pass, with the uinput round trip running for real.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VUf1KjpFGzyMfmDMRwey24

One pulse of a length and a strength, re-uploaded in place on one effect:
FF_RUMBLE where the device has it, else an FF_PERIODIC sine. A phone's haptic
actuator and a gamepad's rumble both speak this. Found by capability under
/dev/input; off Linux every open refuses. On Linux as root the test makes a
uinput motor, has a child pulse it, and answers the kernel's upload.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VUf1KjpFGzyMfmDMRwey24
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-14T13:13:56.567101Z
We couldn’t complete this review. Comment @codex review to try again.
0c21e08 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@mcereal
mcereal merged commit 45e71ea into main Nov 14, 2026
12 checks passed
@mcereal
mcereal deleted the feat/haptic branch November 14, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant