Skip to content

Restore angle snapping for discussion - #124

Draft
Gnarus-G wants to merge 19 commits into
mainfrom
feat/107-angle-snap-draft
Draft

Restore angle snapping for discussion#124
Gnarus-G wants to merge 19 commits into
mainfrom
feat/107-angle-snap-draft

Conversation

@Gnarus-G

@Gnarus-G Gnarus-G commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Important

Draft only: do not merge without an explicit maintainer decision and demonstrated user demand.

Context

PR #122 added angle snapping and PR #123 reverted it because the maintenance cost was not justified by a single request; this draft preserves the tested implementation for discussion without shipping it.

Verification

  • cargo fmt --all --check
  • cargo test --all
  • make test
  • make build

Related to #107.

On pre-6.11 kernels the handler returns void and cannot communicate
a new event count, so injecting synthetic events into the vals buffer
is undefined behavior. Restrict ensure_axes_for_rotation() and the
memmove injection to __cleanup_events (>= 6.11) only.
* Improve C test reporting

* Handle snapshot diff pipe failures
* Add root cause analysis for divide-by-zero kernel panic in maccel_events

Add three RCA documents analyzing the #DE divide-by-zero panic in
maccel_events (issue #112). The documents cover the fault mechanism
where consecutive EV_SYN events with identical ktime_get() timestamps
produce a zero divisor in input_speed(), triggering a fatal idivq in
interrupt context. Each RCA examines the call path, root causes
including unguarded fixed-point divisions and missing parameter
validation, and potential fix strategies.

* Add tests for division-by-zero and invalid timing guards

Add a test for div128_s64_s64 with a zero divisor, running it in a
forked child to catch the current SIGFPE trap and assert a clean exit
once the guard is implemented.

Create a new test suite for acceleration functions that validates
survival and correct behavior when given zero or negative time deltas,
zero input DPI, and a motivity of exactly one (which produces a zero
logarithm divisor). Each case runs in a forked child to prevent the
current SIGFPE from killing the test runner.

* Add guard tests for division-by-zero kernel panic

Encode the safety invariant for maccel#112: division by zero in the
fixed-point hot path (time_ms, input_dpi, motivity) must return a defined
value, not trap #DE/SIGFPE. Each case runs in a forked child so the current
unsafe behavior fails as an assertion instead of core-dumping the suite.
Red until the guards are implemented.

* Guard fixed-point division and input speed against zero/invalid divisors

fpt_div and div128_s64_s64 returned undefined behavior (SIGFPE in
userspace, #DE in IRQ context) on a zero divisor. input_speed also
divided by time_ms without checking, and left LAST_INPUT_MOUSE_SPEED
stale on early return. Return 0 on zero divisor, and return 0 / clear
the published speed when time_ms <= 0 or distance calculation fails.
Fixes the panic in maccel#112.

* Remove outdated RCAs for divide-by-zero kernel panic

The root cause analysis documents for issue #112 are no longer
relevant as the fix has been implemented. These files contained
duplicate and superseded analysis from multiple AI models, and
keeping them in the repository would cause confusion about the
current state of the fix.

* Handle interrupted test child waits
…ishing

# Conflicts:
#	.github/workflows/Release_AUR.yml
#	AGENTS.md
Remove all installed DKMS versions
Automate and publish the AUR package
@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
maccel Ready Ready Preview Aug 2, 2026 1:59am

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e7a8d01d-2f00-4708-8b3c-3e0175e12a0a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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