Skip to content

fix(gamepad): correct battery reporting and Xbox Series support - #118

Merged
ReenigneArcher merged 5 commits into
masterfrom
fix/battery-state
Aug 31, 2026
Merged

fix(gamepad): correct battery reporting and Xbox Series support#118
ReenigneArcher merged 5 commits into
masterfrom
fix/battery-state

Conversation

@ReenigneArcher

@ReenigneArcher ReenigneArcher commented Aug 30, 2026

Copy link
Copy Markdown
Member

Description

  • Exposes submitted battery state through Windows HID reports; Steam, XInput, and Game Bar may not display it for wired VHF devices.
  • Fixes battery report issues for Xbox One/Series on Linux.

Screenshot

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

See our AI usage policy.

  • 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

@codecov

codecov Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.78788% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.34%. Comparing base (8572f3f) to head (360e51d).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/platform/linux/uhid_backend.cpp 78.78% 3 Missing and 4 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #118      +/-   ##
==========================================
- Coverage   73.36%   73.34%   -0.02%     
==========================================
  Files          34       34              
  Lines        9208     9235      +27     
  Branches     3429     3439      +10     
==========================================
+ Hits         6755     6773      +18     
- Misses       1823     1826       +3     
- Partials      630      636       +6     
Flag Coverage Δ
FreeBSD 52.57% <ø> (ø)
Linux-Clang 54.96% <63.63%> (+0.03%) ⬆️
Linux-GCC 65.77% <80.64%> (+0.04%) ⬆️
Windows-MSVC 88.22% <ø> (-0.07%) ⬇️
Windows-MinGW-UCRT64 62.96% <ø> (+0.05%) ⬆️
macOS 48.66% <ø> (-0.02%) ⬇️

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

Files with missing lines Coverage Δ
src/core/profiles.cpp 94.87% <ø> (-0.02%) ⬇️
src/platform/linux/uhid_backend.cpp 81.48% <78.78%> (-0.10%) ⬇️

... and 1 file 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 8572f3f...360e51d. Read the comment docs.

@ReenigneArcher
ReenigneArcher force-pushed the fix/battery-state branch 2 times, most recently from f2f2d7a to 57a76cb Compare August 30, 2026 22:39
@ReenigneArcher
ReenigneArcher marked this pull request as ready for review August 31, 2026 01:03
Expand platform docs and windows-driver docs to explain that XInput returns BATTERY_TYPE_DISCONNECTED for VHF Xbox devices and that Steam hides battery indicators for wired virtual transports. Update compatibility-note numbering in the end-user gamepad guide, fix battery state cells to reference note 4 consistently, and mark Xbox Series Share button support correctly for Linux and Android. Add two integration tests: one asserting SDL exposes submitted battery for non-Xbox profiles, and one asserting XInput does not expose submitted Xbox battery.
@ReenigneArcher ReenigneArcher changed the title fix: battery reporting improvements fix: Xbox share button and battery reporting improvements Aug 31, 2026
@ReenigneArcher ReenigneArcher changed the title fix: Xbox share button and battery reporting improvements fix(gamepad): correct battery reporting and Xbox Series support Aug 31, 2026
Omit the Linux UHID Xbox battery descriptor and reports when the client declares no battery support (`has_battery = false`). This prevents phantom Linux power devices and false charge readings for clients like Moonlight Xbox that never send battery data.

Also narrows the battery HID field to a two-bit categorical value matching the native Xbox Bluetooth level, updates related docs and compatibility matrix footnotes, and skips the XInput battery test when the VHF device is not enumerated in headless CI.
Adjust the Linux UHID Xbox battery descriptor to use a byte-sized Battery Strength field with the native wireless charge values (4-7) instead of a packed two-bit field. This keeps SDL/Linux descriptor consumers compatible, preserves HIDAPI's expected layout, avoids the false 2% battery reading for clients without battery support, and updates the fixture and docs to match the new descriptor size and behavior.
Update the end-user gamepad guide with revised compatibility statuses across clients and backends, including new 🟡 “dev/future release” semantics. The matrix now reflects current findings for Xbox battery/share support, PlayStation touchpad/adaptive-trigger behavior, and Switch Pro LED/capture paths, with a fully reorganized and expanded note table (1–23) to clarify ownership, limitations, and tracking links.
@sonarqubecloud

Copy link
Copy Markdown

@ReenigneArcher
ReenigneArcher merged commit 2658471 into master Aug 31, 2026
32 checks passed
@ReenigneArcher
ReenigneArcher deleted the fix/battery-state branch August 31, 2026 22:04
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.

Linux: Xbox Series Share button appears but does not respond Xbox One profile incorrectly rejects battery state updates

1 participant