Skip to content

--connected now reports a charging headset as connected - #609

Merged
Sapd merged 1 commit into
Sapd:masterfrom
gdevenyi:connected-charging
Oct 24, 2026
Merged

Sapd merged 1 commit into
Sapd:masterfrom
gdevenyi:connected-charging

Conversation

@gdevenyi

Copy link
Copy Markdown
Contributor

Summary

As agreed on #580: a headset on its charging cable now counts as connected.

 checkDeviceConnected()
   r = getBattery()
-  return ok(r) && r.status == BATTERY_AVAILABLE
+  return ok(r) && (r.status == BATTERY_AVAILABLE || r.status == BATTERY_CHARGING)

The other three statuses still mean disconnected, since each one means we couldn't talk to the headset: BATTERY_UNAVAILABLE (off or not paired), BATTERY_HIDERROR, BATTERY_TIMEOUT.

Evidence

Tested on a Virtuoso XT with the cable and the receiver both plugged in. This build includes #570's battery code, because master's Virtuoso code never reports charging.

  • Before: wired 0a62, BATTERY_CHARGING → --connected prints false
  • After: wired 0a62, BATTERY_CHARGING → true; receiver 0a64 (no headset paired) → still false

The unit suite passes and the file is clean under clang-format 18. checkDeviceConnected() short-circuits for the test device, so no unit test reaches this line.

Merge Danger

Door: two-way. It's a one-line revert.

Blast Radius: behavioural

This changes what --connected prints for all 18 device files that can report BATTERY_CHARGING. A script that used --connected as a "not charging" check will now get true while charging. It wants a line in the release notes, and the PR title is written to serve as that line.

Checklist

  • I adjusted the README (if needed). Not needed: --connected isn't documented beyond --help.
  • For new features in HeadsetControl: I discussed it beforehand in Issues or Discussions. Discussed on Add CAP_LIGHT_COLOR (--light-color RRGGBB) #580.

🤖 Generated with Claude Code

checkDeviceConnected() only treated BATTERY_AVAILABLE as connected, so
--connected printed false for any headset on its charging cable. That
has been the case since the C version, and applies to every device that
can report BATTERY_CHARGING. The other statuses (unavailable, HID error,
timeout) all mean the headset could not be talked to, so only those
count as disconnected now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the awaiting-maintainer The author replied or pushed - our move label Oct 23, 2026
@gdevenyi gdevenyi mentioned this pull request Oct 23, 2026
2 tasks done
@Sapd
Sapd merged commit b49ee5c into Sapd:master Oct 24, 2026
7 checks passed
@github-actions github-actions Bot removed the awaiting-maintainer The author replied or pushed - our move label Oct 24, 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.

2 participants