Skip to content

feat(logitech): add G PRO X 3 LIGHTSPEED battery and auto-off support - #618

Merged
Sapd merged 3 commits into
Sapd:masterfrom
KarimTayie:feat/logitech-gpro-x3-lightspeed
Nov 8, 2026
Merged

Sapd merged 3 commits into
Sapd:masterfrom
KarimTayie:feat/logitech-gpro-x3-lightspeed

Conversation

@KarimTayie

@KarimTayie KarimTayie commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Adds Logitech G PRO X 3 LIGHTSPEED support through the LIGHTSPEED USB receiver (046d:0b45). Users can query battery level and charging status with -b and configure the auto-off timer with -i.

The driver uses the shared Centurion protocol, discovers feature indexes at runtime, and preserves the additional auto-sleep fields when updating the timer. Sidetone and EQ are not exposed. The device is registered and listed in the README for Linux, macOS, and Windows.

Validation:

  • Adds captured-traffic tests for battery queries, auto-off writes, malformed timer replies, and unsupported sidetone operations.
  • Git whitespace checks passed.
  • Local Linux build passed with CMake 3.28.3 and GCC 13.3.0.
  • cmake --build build --target check -j 2 passed: both CTest suites (integration_basic_run and unit_mock_devices), including the PRO X 3 captured-traffic tests.
  • Hardware observations cover Ubuntu with receiver USB revision 1.02; Windows/macOS, charging transitions, and timer expiry still need hardware verification.

@github-actions github-actions Bot added the awaiting-maintainer The author replied or pushed - our move label Nov 1, 2026
@Sapd

Sapd commented Nov 2, 2026

Copy link
Copy Markdown
Owner

Three things before this goes in. The frame-level assertions are the right shape - breaking the prefix, the one-byte write, the truncation guard and the sidetone gate each fail a named assertion.

1. setInactiveTime() and buildAutoSleepParams() are a verbatim copy of the G522's. Same body, same current.size() < 3 guard, same { minutes, current[1], current[2] }, same max_minutes = 90 - only the device name in the error string differs. Lift both into LogitechCenturionProtocol and have the G522 and the X3 use it, rather than landing a second copy. The G522's docblock also says why the trailing fields matter (the command carries two lighting inactivity timers and the headset rejects a write without them); yours doesn't, and that's the part a reader needs.

2. The preservation isn't tested. The captured auto-sleep reply is { 15, 0, 0 }, so both fields you preserve are zero - replace the body with { minutes, 0, 0 } and the suite still passes. Since buildAutoSleepParams is already public and you assert the truncation case on it directly, the cheapest fix is next to that:

auto preserved = LogitechGProX3Lightspeed::buildAutoSleepParams(15, std::array<uint8_t, 3> { 5, 1, 2 });
ASSERT_TRUE(preserved.hasValue(), "Sleep params should build from a full reply");
ASSERT_EQ(15, (*preserved)[0], "Minutes replaced");
ASSERT_EQ(1, (*preserved)[1], "Second timer field preserved");
ASSERT_EQ(2, (*preserved)[2], "Third timer field preserved");

Checked both ways: passes as written, fails on "Second timer field preserved" with the fields hardcoded. This moves if you take point 1.

3. The README row was typed, not generated. Empty cells have four spaces where --readme-helper emits three, so your row is the only one that doesn't match the generator. Cell contents are right. Regenerate the table and paste it whole - ./headsetcontrol --readme-helper.

CI hasn't run on this yet; it needs a maintainer to release the workflows for a first-time contributor, which I'll do. Everything above is from a local build.

@github-actions github-actions Bot added awaiting-author We replied - waiting on the author and removed awaiting-maintainer The author replied or pushed - our move labels Nov 2, 2026
@ChrisLauinger77

ChrisLauinger77 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

I just learned by reading this PR that a new X3 exists. I let chatgpt make a diff:

Logitech G PRO X 2 vs. G PRO X 3 LIGHTSPEED

Feature PRO X 2 PRO X 3
Release year 2023 2026
Drivers 50 mm graphene 50 mm graphene
Audio resolution 16-bit / 48 kHz 24-bit / 48 kHz
Microphone Unidirectional Omnidirectional
Microphone resolution 16-bit / 16 kHz 16-bit / 48 kHz
Equalizer 5-band graphic EQ 10-band parametric EQ
EQ presets Yes Yes
Battery life Up to 50 h Up to 70 h
LIGHTSPEED 2.4 GHz Yes Yes
Bluetooth Yes Yes
3.5 mm connection Yes Yes

headsetcontrol implementation

The PRO X 2 LIGHTSPEED supports a 5-band graphic equalizer with presets, which is already implemented and working correctly.

Parametric equalizer support was incorrectly added to the PRO X 2 implementation and must be removed. The existing 5-band EQ and presets must remain unchanged.

Seems I need to remove the parametric equ. from the X2 :( But in this PR its missing...
I will make a PR soon to fix X2 ... (#622)

@github-actions github-actions Bot added the needs-rebase Branch conflicts with master label Nov 6, 2026
@github-actions github-actions Bot added awaiting-maintainer The author replied or pushed - our move and removed awaiting-author We replied - waiting on the author needs-rebase Branch conflicts with master labels Nov 8, 2026
@KarimTayie

Copy link
Copy Markdown
Contributor Author

Three things before this goes in. The frame-level assertions are the right shape - breaking the prefix, the one-byte write, the truncation guard and the sidetone gate each fail a named assertion.

1. setInactiveTime() and buildAutoSleepParams() are a verbatim copy of the G522's. Same body, same current.size() < 3 guard, same { minutes, current[1], current[2] }, same max_minutes = 90 - only the device name in the error string differs. Lift both into LogitechCenturionProtocol and have the G522 and the X3 use it, rather than landing a second copy. The G522's docblock also says why the trailing fields matter (the command carries two lighting inactivity timers and the headset rejects a write without them); yours doesn't, and that's the part a reader needs.

2. The preservation isn't tested. The captured auto-sleep reply is { 15, 0, 0 }, so both fields you preserve are zero - replace the body with { minutes, 0, 0 } and the suite still passes. Since buildAutoSleepParams is already public and you assert the truncation case on it directly, the cheapest fix is next to that:

auto preserved = LogitechGProX3Lightspeed::buildAutoSleepParams(15, std::array<uint8_t, 3> { 5, 1, 2 });
ASSERT_TRUE(preserved.hasValue(), "Sleep params should build from a full reply");
ASSERT_EQ(15, (*preserved)[0], "Minutes replaced");
ASSERT_EQ(1, (*preserved)[1], "Second timer field preserved");
ASSERT_EQ(2, (*preserved)[2], "Third timer field preserved");

Checked both ways: passes as written, fails on "Second timer field preserved" with the fields hardcoded. This moves if you take point 1.

3. The README row was typed, not generated. Empty cells have four spaces where --readme-helper emits three, so your row is the only one that doesn't match the generator. Cell contents are right. Regenerate the table and paste it whole - ./headsetcontrol --readme-helper.

CI hasn't run on this yet; it needs a maintainer to release the workflows for a first-time contributor, which I'll do. Everything above is from a local build.

Thanks for the review! Moved both auto-sleep methods into LogitechCenturionProtocol, keeping the explanation about the lighting timers. Added the nonzero preservation assertions and confirmed hardcoding zeros fails the test. Regenerated the README table and resolved the conflict with master. Local build and tests pass. Pushed the updates for another look.

@Sapd
Sapd merged commit 0c8a76f into Sapd:master Nov 8, 2026
7 checks passed
@github-actions github-actions Bot removed the awaiting-maintainer The author replied or pushed - our move label Nov 8, 2026
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.

3 participants