Skip to content

feat(input): implement libvirtualhid adding new gamepad styles - #5368

Merged
ReenigneArcher merged 4 commits into
masterfrom
libvirtualhid
Aug 16, 2026
Merged

feat(input): implement libvirtualhid adding new gamepad styles#5368
ReenigneArcher merged 4 commits into
masterfrom
libvirtualhid

Conversation

@ReenigneArcher

@ReenigneArcherReenigneArcher commented Jul 3, 2026

Copy link
Copy Markdown
Member

Description

This PR implements libvirtualhid in Sunshine, replacing inputtino on Linux, vigembus on Windows AMD64, and moves the mouse/keyboard input for macOS as well.

We will still falling back to vigembus on Windows ARM64 or in cases where the user doesn't have libvirtualhid's driver installed.

TODO:

  • CI/CD passing
  • Sonar
  • Ensure we cover changes in the following PRs:
  • Test coverage
  • Testing
    • Windows
      • Gamepads
      • Keyboard
      • Mouse
      • Touchscreen
      • Pen
      • Trackpad (not supported on Windows)
    • Linux
      • Gamepads
      • Keyboard
      • Mouse
      • Touchscreen
      • Pen
      • Trackpad
    • FreeBSD
      • Gamepads (gamepads don't appear in browser gamepad API)
      • Keyboard
      • Mouse
      • Touchscreen
      • Pen
      • Trackpad
    • macOS
      • Gamepads (not supported on macOS currently)
      • Keyboard
      • Mouse
      • Touchscreen (not supported on macOS)
      • Pen (not supported on macOS)
      • Trackpad (not supported on macOS)
  • Remove vigembus helpers from web-ui
  • Create release of libvirtualhid

Known issues:

Screenshot

image

Issues Fixed or Closed

Roadmap Issues

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Unit tests have been added or updated for any new or modified functionality

AI Usage

  • None: No AI tools were used in creating this PR
  • Light: AI provided minor assistance (formatting, simple suggestions)
  • Moderate: AI helped with code generation or debugging specific parts
  • Heavy: AI generated most or all of the code changes

@ReenigneArcherReenigneArcher changed the title feat: implement libvirtualhidfeat(input): implement libvirtualhidJul 3, 2026
@codecov

codecovBot commented Jul 3, 2026

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 57.33kB (2.38%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle nameSizeChange
sunshine-esm877.86kB57.33kB (6.99%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: sunshine-esm

Assets Changed:

Asset NameSize ChangeTotal SizeChange (%)
assets/logo-*.js2.5kB384.41kB0.65%
assets/logo-*.css4.74kB285.74kB1.69%
assets/config-*.js-2.04kB73.1kB-2.72%
assets/index-*.js44.7kB47.09kB1872.69% ⚠️
assets/featured-*.js-320 bytes29.75kB-1.06%
assets/troubleshooting-*.js6.43kB14.77kB77.08% ⚠️
assets/Navbar-*.js482 bytes6.67kB7.79% ⚠️
assets/external-*.js(New)433 bytes433 bytes100.0% 🚀
assets/download-*.js(New)414 bytes414 bytes100.0% 🚀

@codecov

codecovBot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.14465% with 268 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.40%. Comparing base (cf52f4b) to head (8570785).
✅ All tests successful. No failed tests found.

Files with missing linesPatch %Lines
src/input.cpp60.19%79 Missing and 1 partial ⚠️
src/confighttp.cpp76.49%51 Missing and 8 partials ⚠️
src/platform/windows/input.cpp47.42%35 Missing and 16 partials ⚠️
src/system_tray.cpp86.77%21 Missing and 11 partials ⚠️
src/platform/virtualhid_input.cpp97.60%13 Missing and 4 partials ⚠️
src/platform/linux/input/virtualhid.cpp75.60%3 Missing and 7 partials ⚠️
src/config.cpp22.22%7 Missing ⚠️
src/platform/macos/input.cpp81.81%4 Missing ⚠️
src/stream.cpp20.00%2 Missing and 2 partials ⚠️
src/rtsp.cpp0.00%2 Missing ⚠️
... and 2 more
Additional details and impacted files

Impacted file tree graph

@@ Coverage Diff @@## master #5368 +/- ##
==========================================
+ Coverage 28.10% 32.40% +4.30% 
==========================================
Files 109 104 -5 Lines 24711 24931 +220 Branches 10910 11076 +166 ==========================================
+ Hits 6944 8079 +1135 + Misses 16783 14999 -1784 - Partials 984 1853 +869 
FlagCoverage Δ
Archlinux0.00% <0.00%> (ø)
FreeBSD-aarch64?
FreeBSD-amd6418.16% <64.30%> (+4.17%)⬆️
Homebrew-macos-1428.01% <76.88%> (+5.45%)⬆️
Homebrew-macos-1528.70% <76.88%> (+5.49%)⬆️
Homebrew-macos-2628.83% <76.88%> (+5.48%)⬆️
Homebrew-ubuntu-24.0418.83% <71.58%> (+4.82%)⬆️
Linux-AppImage18.26% <73.13%> (+4.83%)⬆️
Windows-AMD6423.62% <76.22%> (+6.20%)⬆️
Windows-ARM6420.32% <65.20%> (+5.33%)⬆️
macOS-arm6425.22% <65.11%> (+5.40%)⬆️
macOS-x86_6425.86% <65.11%> (+5.34%)⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing linesCoverage Δ
src/audio.cpp85.27% <ø> (ø)
src/config.h11.11% <ø> (+11.11%)⬆️
src/confighttp.h100.00% <ø> (ø)
src/input.h50.00% <ø> (ø)
src/platform/common.h58.59% <100.00%> (+25.00%)⬆️
src/platform/linux/audio.cpp60.50% <100.00%> (ø)
src/thread_pool.h30.00% <100.00%> (+5.00%)⬆️
src/platform/virtualhid_input.h0.00% <0.00%> (ø)
src/process.cpp33.41% <0.00%> (-0.08%)⬇️
src/rtsp.cpp23.07% <0.00%> (-0.08%)⬇️
... and 9 more

... and 20 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cf52f4b...8570785. Read the comment docs.

Comment threadsrc/confighttp.cpp Fixed
Comment threadtests/unit/test_confighttp.cpp Fixed
Comment threadtests/unit/test_confighttp.cpp Fixed
@ReenigneArcher
ReenigneArcherforce-pushed the libvirtualhid branch 7 times, most recently from a3e7ed7 to fe08cf1CompareJuly 15, 2026 12:30
@ReenigneArcher
ReenigneArcherforce-pushed the libvirtualhid branch 6 times, most recently from beab94f to 0af629eCompareAugust 10, 2026 19:59
@ReenigneArcher
ReenigneArcherforce-pushed the libvirtualhid branch 3 times, most recently from c0e7306 to be323a2CompareAugust 14, 2026 02:35
@ReenigneArcher
ReenigneArcherforce-pushed the libvirtualhid branch 2 times, most recently from da01bf8 to 3d2a82dCompareAugust 15, 2026 16:35
Add session-scoped retained input state so virtual gamepads survive paused transport connections and are rebound on resume instead of being recreated. Introduce explicit gamepad termination APIs for global and per-session cleanup, and call them when streams, RTSP sessions, or launched processes are terminated. Add a platform-level `rebind_gamepad` path for both virtualhid and Windows ViGEm backends (with feedback routing synchronization), refactor shared allocation logic, and extend unit coverage for rebind behavior and retained gamepad lifecycle.
Add Linux udev rules that grant input/uaccess permissions to libvirtualhid devices matched by their `phys` path for both `hidraw*` and `event*` nodes, in addition to existing name-based matches. This improves device permission handling when names are inconsistent. Also updates the `third-party/libvirtualhid` submodule to commit `7902b766`.
@sonarqubecloud

Copy link
Copy Markdown

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment