[PR #53] [CLOSED] Fix Steam battery always showing 100% #174

Closed
opened 2026-10-22 05:07:03 +00:00 by roman · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/safijari/openpuck/pull/53
Author: @Copilot
Created: 6/18/2026
Status: ❌ Closed

Base: main ← Head: copilot/fix-steam-battery-display-issue


📝 Commits (1)

  • 45380d5 Fix Steam battery always showing 100%: defer 0x43 send when HID endpoint busy

📊 Changes

1 file changed (+27 additions, -1 deletions)

View changed files

📝 OpenPuck/puck_hid.cpp (+27 -1)

📄 Description

The 0x43 battery report and 0x45 input report are co-embedded in the same RF frame every ~2 s. onReport45 fires first and calls sendReport(0x45), leaving the HID endpoint busy. onAuxReport runs immediately after but ready() is already false — the battery report is silently dropped every time, so Steam never receives it and defaults to 100%. WebUSB is unaffected because it reads g_battery directly from the raw RF byte.

Changes

  • onAuxReport — when ready() is false, queue the report into a static 3-field buffer (g_pendingAuxRid / g_pendingAuxData / g_pendingAuxLen) instead of dropping it silently

  • task() — drain the pending buffer on the next 4 ms cycle when the endpoint is free; slotted between the 0x79 connection-state send (highest priority) and the periodic 0x7B status send

// onAuxReport: queue instead of drop when endpoint is busy
if (hid[g_connSlot].ready()) {
  hid[g_connSlot].sendReport(rid, data, n);
} else {
  g_pendingAuxRid = rid;
  g_pendingAuxLen = n < sizeof(g_pendingAuxData) ? n : sizeof(g_pendingAuxData);
  memcpy(g_pendingAuxData, data, g_pendingAuxLen);
}

// task(): drain queued aux before 0x7B
} else if (g_pendingAuxRid && g_slot[g_connSlot].used) {
  hid[g_connSlot].sendReport(g_pendingAuxRid, g_pendingAuxData, g_pendingAuxLen);
  g_pendingAuxRid = 0;
} else if (conn && millis()-last7B >= 2000) {

A single-slot queue is sufficient: task() drains every 4 ms and aux reports arrive at most once per ~2 s.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/safijari/openpuck/pull/53 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 6/18/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `copilot/fix-steam-battery-display-issue` --- ### 📝 Commits (1) - [`45380d5`](https://github.com/safijari/openpuck/commit/45380d5ced930598e8862cf15b87c9185c6b568a) Fix Steam battery always showing 100%: defer 0x43 send when HID endpoint busy ### 📊 Changes **1 file changed** (+27 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `OpenPuck/puck_hid.cpp` (+27 -1) </details> ### 📄 Description The 0x43 battery report and 0x45 input report are co-embedded in the same RF frame every ~2 s. `onReport45` fires first and calls `sendReport(0x45)`, leaving the HID endpoint busy. `onAuxReport` runs immediately after but `ready()` is already `false` — the battery report is silently dropped every time, so Steam never receives it and defaults to 100%. WebUSB is unaffected because it reads `g_battery` directly from the raw RF byte. ## Changes - **`onAuxReport`** — when `ready()` is false, queue the report into a static 3-field buffer (`g_pendingAuxRid / g_pendingAuxData / g_pendingAuxLen`) instead of dropping it silently - **`task()`** — drain the pending buffer on the next 4 ms cycle when the endpoint is free; slotted between the 0x79 connection-state send (highest priority) and the periodic 0x7B status send ```cpp // onAuxReport: queue instead of drop when endpoint is busy if (hid[g_connSlot].ready()) { hid[g_connSlot].sendReport(rid, data, n); } else { g_pendingAuxRid = rid; g_pendingAuxLen = n < sizeof(g_pendingAuxData) ? n : sizeof(g_pendingAuxData); memcpy(g_pendingAuxData, data, g_pendingAuxLen); } // task(): drain queued aux before 0x7B } else if (g_pendingAuxRid && g_slot[g_connSlot].used) { hid[g_connSlot].sendReport(g_pendingAuxRid, g_pendingAuxData, g_pendingAuxLen); g_pendingAuxRid = 0; } else if (conn && millis()-last7B >= 2000) { ``` A single-slot queue is sufficient: `task()` drains every 4 ms and aux reports arrive at most once per ~2 s. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
roman 2026-10-22 05:07:03 +00:00
Sign in to join this conversation.
No labels
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
safijari/openpuck#174
No description provided.