Skip to content

feat(input): implement libvirtualhid#5368

Draft
ReenigneArcher wants to merge 5 commits into
masterfrom
libvirtualhid
Draft

feat(input): implement libvirtualhid#5368
ReenigneArcher wants to merge 5 commits into
masterfrom
libvirtualhid

Conversation

@ReenigneArcher

@ReenigneArcher ReenigneArcher commented Jul 3, 2026

Copy link
Copy Markdown
Member

Description

This PR implements libvirtualhid in Sunshine, replacing inputtino on Linux, vigembus on Windows AMD64, but still falling back to vigembus on Windows ARM64.

TODO:

  • CI/CD passing
  • Sonar
  • Test coverage
  • Testing
    • Windows
      • Gamepads
      • Keyboard
      • Mouse
      • Touch
      • Pen
    • Linux
      • Gamepads
      • Keyboard
      • Mouse
      • Touch
      • Pen
    • FreeBSD
      • Gamepads
      • Keyboard
      • Mouse
      • Touch
      • Pen
  • Remove vigembus helpers from web-ui
  • Create release of libvirtualhid
  • Publish libvirtualhid driver to MSFT store

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

@ReenigneArcher ReenigneArcher changed the title feat: implement libvirtualhid feat(input): implement libvirtualhid Jul 3, 2026
@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Bundle Report

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

Detailed changes
Bundle name Size Change
sunshine-esm 855.85kB 1.31kB (0.15%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: sunshine-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/createLucideIcon-*.js 232 bytes 358.69kB 0.06%
assets/config-*.js 969 bytes 70.65kB 1.39%
assets/index-*.js 388 bytes 46.33kB 0.84%
assets/troubleshooting-*.js 135 bytes 9.21kB 1.49%
assets/download-*.js (Deleted) -414 bytes 0 bytes -100.0% 🗑️

@sonarqubecloud

sonarqubecloud Bot commented Jul 3, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
19 New issues
19 New Code Smells (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 9.06892% with 752 lines in your changes missing coverage. Please review.
✅ Project coverage is 27.14%. Comparing base (0a47d3d) to head (1a1b9ad).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/platform/virtualhid_input.cpp 1.50% 507 Missing and 16 partials ⚠️
src/confighttp.cpp 38.99% 68 Missing and 29 partials ⚠️
src/platform/windows/input.cpp 1.36% 63 Missing and 9 partials ⚠️
src/platform/linux/input/virtualhid.cpp 6.45% 55 Missing and 3 partials ⚠️
src/config.cpp 0.00% 1 Missing ⚠️
src/input.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5368      +/-   ##
==========================================
- Coverage   27.18%   27.14%   -0.05%     
==========================================
  Files         111      105       -6     
  Lines       25412    25267     -145     
  Branches    11214    11204      -10     
==========================================
- Hits         6909     6858      -51     
+ Misses      16570    16565       -5     
+ Partials     1933     1844      -89     
Flag Coverage Δ
Archlinux 0.00% <0.00%> (ø)
FreeBSD-aarch64 ?
FreeBSD-amd64 12.59% <7.77%> (-0.60%) ⬇️
Homebrew-macos-14 20.66% <66.15%> (+0.29%) ⬆️
Homebrew-macos-15 20.83% <66.15%> (+0.30%) ⬆️
Homebrew-macos-26 20.93% <66.15%> (+0.29%) ⬆️
Homebrew-ubuntu-24.04 13.08% <9.05%> (+0.12%) ⬆️
Linux-AppImage 12.42% <9.05%> (+0.13%) ⬆️
Windows-AMD64 15.24% <7.42%> (+0.04%) ⬆️
Windows-ARM64 13.26% <6.32%> (+0.01%) ⬆️
macOS-arm64 19.18% <50.00%> (+0.33%) ⬆️
macOS-x86_64 18.68% <57.97%> (+0.30%) ⬆️

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

Files with missing lines Coverage Δ
src/config.h 0.00% <ø> (ø)
src/confighttp.h 100.00% <ø> (ø)
src/config.cpp 24.00% <0.00%> (ø)
src/input.cpp 18.86% <0.00%> (+0.11%) ⬆️
src/platform/linux/input/virtualhid.cpp 6.45% <6.45%> (ø)
src/platform/windows/input.cpp 0.54% <1.36%> (+0.08%) ⬆️
src/confighttp.cpp 45.16% <38.99%> (+1.40%) ⬆️
src/platform/virtualhid_input.cpp 1.50% <1.50%> (ø)

... and 50 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 0a47d3d...1a1b9ad. Read the comment docs.

Replace the ViGEmBus install/status flow with a unified virtual input driver status endpoint and UI. Update Windows packaging, docs, locale strings, and troubleshooting pages to reflect libvirtualhid as the primary backend, with ViGEmBus shown only as a fallback. Add unit coverage for driver version parsing and status JSON helpers.
Replace Windows-native synthetic pointer/keyboard input implementations with libvirtualhid equivalents:

- Remove keylayout.h and its VK-to-scancode mapping (now handled by libvirtualhid)
- Remove Windows-specific touch/pen device management (HSYNTHETICPOINTERDEVICE, repeat tasks, slot compaction)
- Pass touch_port and flags through to libvirtualhid for keyboard, touch, and pen events
- Add pointer_viewport() and keyboard_event() helpers in virtualhid_input.cpp
- Differentiate LI_TOUCH_EVENT_UP, CANCEL, and HOVER_LEAVE handling for touch contacts
- Add PointerTransition support for pen events
- Update capability detection to use libvirtualhid runtime
- Update libvirtualhid submodule to c1cc7e0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment