Skip to content

fix: preserve forwarded mouse DPI metadata during injection#1290

Merged
sezanzeb merged 6 commits into
sezanzeb:mainfrom
mizuikki:fix/forwarded-mouse-dpi
May 10, 2026
Merged

fix: preserve forwarded mouse DPI metadata during injection#1290
sezanzeb merged 6 commits into
sezanzeb:mainfrom
mizuikki:fix/forwarded-mouse-dpi

Conversation

@mizuikki

@mizuikki mizuikki commented May 9, 2026

Copy link
Copy Markdown
Contributor

Summary

This fixes a pointer feel regression when injecting mouse devices.

Before this change, the forwarded virtual mouse created by input-remapper
could lose hwdb-derived properties such as MOUSE_DPI. On devices like the
Logitech G Pro, that caused the injected pointer to feel different from the
original device even though the event capabilities were copied.

What changed

  • keep the forwarded device name identical to the source device so system
    mouse hwdb rules can still match
  • assign a dedicated input-remapper/... phys path to forwarded devices so
    they remain distinguishable without reusing the original hardware phys
  • add a udev rule that restores ID_BUS for forwarded devices before
    70-mouse.rules runs, allowing MOUSE_DPI to be applied
  • prevent autoload and device discovery from treating input-remapper-created
    devices as real hardware
  • update tests and local uinput mocks to cover forwarded phys handling and
    input-remapper device filtering

Why

On my system, enabling injection for a Logitech G Pro changed the effective
pointer curve/DPI feel. Inspecting the injected device showed that the
forwarded virtual mouse was missing the original device's MOUSE_DPI
metadata.

After this patch, the forwarded device keeps the original device name, gets
ID_BUS=usb, and successfully receives the same MOUSE_DPI value as the
physical mouse.

Verification

Manual verification on Linux with a Logitech G Pro:

  • before the patch, the forwarded device had no MOUSE_DPI

  • after the patch, both the physical device and the forwarded device expose:

    MOUSE_DPI=400@1000 *800@1000 1600@1000 3200@1000 6400@1000

  • pointer feel is now indistinguishable during injection in real use

Notes

I also observed unrelated instability in the local test environment on
Python 3.14, but the DPI/metadata fix itself was validated on the real
device.

mizuikki added 2 commits May 9, 2026 10:21
- keep the forwarded device name identical to the source device so system mouse hwdb rules still match
- assign a dedicated input-remapper phys path to forwarded devices so they stay distinguishable without reusing the original hardware phys
- add a udev rule that restores ID_BUS for forwarded devices before 70-mouse.rules runs, allowing MOUSE_DPI to be applied
- prevent autoload and device discovery from treating input-remapper-created devices as real hardware
- update tests and local uinput mocks to cover forwarded phys handling and input-remapper device filtering
- remove the old input-remapper device group from reader tests now that discovery skips synthetic devices
- format forwarded phys assertions to satisfy black
@mizuikki mizuikki force-pushed the fix/forwarded-mouse-dpi branch from d6b991e to 1d8e946 Compare May 9, 2026 06:49

@sezanzeb sezanzeb left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

There are a few old open issues about the mouse pointer speed, are they fixed with this?

Comment thread tests/lib/patches.py Outdated
Comment thread tests/unit/test_groups.py Outdated
- expose phys as an explicit UInputMock argument

- keep the forwarded-device skip test aligned with find filtering semantics
@mizuikki

mizuikki commented May 9, 2026

Copy link
Copy Markdown
Contributor Author

Thanks! I addressed the two inline comments in 89709c3:

  • UInputMock now exposes phys as an explicit argument.
  • The forwarded-device discovery test no longer uses include_inputremapper=True, since that option is about filtering already-discovered input-remapper groups. Devices with an input-remapper phys marker should be skipped during discovery.

All checks are passing on the latest commit.

About the linked pointer-speed issues: I would not claim this PR fixes all of them yet. This specifically fixes the case where the forwarded virtual mouse loses hwdb-derived metadata such as MOUSE_DPI, because the virtual device no longer matches the original mouse hwdb rules. That matches the issue I reproduced locally with my Logitech G Pro.

For reports caused by missing MOUSE_DPI on the forwarded device, this should help. Some of the linked reports also involve KDE/Wayland/X11 pointer speed, acceleration, or per-device settings not being applied to the forwarded virtual device, so those still need confirmation from affected users before closing the issues.

@sezanzeb

sezanzeb commented May 9, 2026

Copy link
Copy Markdown
Owner

I think include_inputremapper can be removed from both filter and find

mizuikki added 2 commits May 9, 2026 21:57
- remove the unused filter and find flag now that input-remapper devices are skipped during discovery

- update reader publishing and group tests to use the simplified API
@mizuikki

mizuikki commented May 9, 2026

Copy link
Copy Markdown
Contributor Author

Done, thanks. I removed include_inputremapper from both filter and find in 988e24c.

Since input-remapper-created devices are now skipped during discovery, the extra flag is no longer needed there. I also updated the reader client and group tests to use the simplified API.

5251c11 only fixes the resulting black formatting issue in reader_client.py. All checks are passing on the latest commit.

@sezanzeb

sezanzeb commented May 9, 2026

Copy link
Copy Markdown
Owner

I just tried your changes locally, and mouse speed correctly stays the same (Kubuntu 25.10). I am happy about the code comments and that you also worked on the tests.

Just one more thing, probably: Now that filter doesn't filter anything anymore, lets rename it to get_groups. Then I think I'll merge this.

- reflect that the method now returns discovered groups without additional filtering

- update GUI callers and group tests
@mizuikki

Copy link
Copy Markdown
Contributor Author

Done, thanks. I renamed filter() to get_groups() in e82807b and updated the GUI callers and tests.

All checks are passing on the latest commit.

@sezanzeb sezanzeb merged commit 8c3f771 into sezanzeb:main May 10, 2026
6 checks passed
@mizuikki mizuikki deleted the fix/forwarded-mouse-dpi branch May 11, 2026 00:03
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.

2 participants