Skip to content

Razer BlackShark V2 Pro (PlayStation): charging state and the headset's own battery level - #626

Merged
Sapd merged 3 commits into
Sapd:masterfrom
TheWeaklessOne:pr/blackshark-charging
Nov 13, 2026
Merged

Sapd merged 3 commits into
Sapd:masterfrom
TheWeaklessOne:pr/blackshark-charging

Conversation

@TheWeaklessOne

@TheWeaklessOne TheWeaklessOne commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Changes made

Follow-up to #620: the BlackShark V2 Pro for PlayStation now reports whether it is charging, and its battery level comes from the headset itself instead of only from the voltage.

On the charger the voltage reads high, so the old estimate was far off: at 4077 mV it said 90 % while the headset itself reported 54 %, and nothing said it was charging.

The headset keeps its own battery percentage and charge state and serves them as "customer" (type 0x08) frames. I found the handlers by reading the headset firmware that ships with Razer's updater (Andes NDS32) and checked them on the hardware:

  • request body <id> 00 00; reply 02 0e 50 49 08 .. .. .. .. 00 04 00 <id> 01 01 <value>, with no sequence number, only while the dongle is in remote mode
  • id 0x21: battery percent. A GET returns the raw figure the headset works out from the voltage; notifications carry its filtered figure, which only rises on the charger and only falls off it (max()/min() in the firmware)
  • id 0x2a: charge state, 0 none, 1 charging, 2 full on the charger, 3 meaning unknown
  • the headset also pushes both, unasked, with direction byte 02 instead of 01: on link-up, on every percent change, and when the charger is plugged in or out (notifications only carry 0 or 1 for the charge state)

What the driver does with that:

  • after the voltage, still in remote mode, it asks for the charge state and then for the percentage (500 ms timeout each; on failure the last known values or the voltage are used)
  • notifications are picked up from whatever arrives while a command waits for its reply, so a tray app sees a plugged-in charger on its next poll
  • GET percentages go through the same max()/min() filter as the firmware's, so the level does not jitter between reads; notifications are taken as they come. The level still jumps by a point or two when the charger is plugged in, as the headset's own figure does, because the voltage rises
  • only state 1 is reported as BATTERY_CHARGING; "full on the charger" is BATTERY_AVAILABLE, and state 3 forgets the last state rather than keep claiming one
  • the requests are skipped when the dongle was already in remote mode at the start of the read, which may be another tool's firmware update in progress
  • without any headset figure, the level comes from the voltage as before, now with the battery table from the headset firmware 1.0.7 (record 5 of its customer data); that table stops at 90 %, so the 100 % point is my estimate

The firmware's customer command space also holds actions (one of them deletes the pairing), so the driver only ever sends these two ids.

Unrelated fix in the same file: a dongle found in remote mode while no headset is linked is now put back in local mode. Before, only a linked headset triggered the restore, so a dongle left in remote mode by a crash stayed there. A failed attempt is not repeated within FAILURE_BACKOFF.

Testing

  • Windows 11, dongle firmware 1.0.8 (I did not read out the headset's version; Razer's current updater ships 1.0.7):
    • unplugging and replugging the charger produced the 2a 02 01 00 / 2a 02 01 01 notifications
    • a one-off -b on the charger: BATTERY_CHARGING, 61 %, about 0.95 s, dongle back in local mode
    • the percentage and charge state returned by the GETs matched the notifications
  • Unit tests: the captured session now includes the two GET replies captured on the hardware. New cases: GETs, notifications, out-of-range values, state 3, per-handle state, the dongle left in remote mode while unlinked (with backoff), no GETs when remote mode was set up by someone else.
  • Unit tests also pass on Linux (GCC 15 and Clang 21 with ASan/UBSan). Not tested on Linux or macOS with the device, and only on one unit and one firmware version.

Checklist

  • I adjusted the README (if needed) (n/a: battery was already listed)
  • For new features in HeadsetControl: I discussed it beforehand in Issues or Discussions and adhered to the wiki (n/a: device change only)

🤖 Generated with Claude Code

The headset keeps its own battery percentage (customer id 0x21) and
charge state (id 0x2a: none, charging, full on the charger, and a
fourth value of unknown meaning). Both are asked for with customer
(type 0x08) GETs right after the voltage, while the dongle is in remote
mode; the replies carry no sequence number and are matched by id. The
headset also pushes both as notifications on link-up, on each percent
change and when the charger is plugged in or out, which are picked up
while any command waits for its reply.

The headset's figure is preferred over the voltage estimate, which reads
high on the charger. Only "charging" is reported as charging; full on
the charger is available, and the unknown state forgets the last one.
The GETs are skipped when the dongle was already in remote mode, which
may be another tool's firmware update. Without them, the level still
comes from the voltage, now with the battery table from the headset
firmware 1.0.7.

Also put a dongle found in remote mode back to local when the headset is
not linked; until now only a linked headset triggered the restore. A
failed attempt is not repeated within FAILURE_BACKOFF.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-12T01:54:34.551046Z
We couldn’t complete this review. Comment @codex review to try again.
00401e6 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added the awaiting-maintainer The author replied or pushed - our move label Nov 11, 2026
A GET of id 0x21 returns the headset's raw percentage, which it works
out from the voltage, while its notifications carry a filtered figure
that only rises on the charger and only falls off it (the filter at
0x1ffb601a in the 1.0.7 firmware: max() while charging, min() while
not). Using the raw figure made the level jitter by a point between
reads.

Notifications are still taken as they come; GET results now go through
the same max()/min() filter, with "on the charger" meaning charging or
full. The jump of a point or two when the charger is plugged in stays:
the firmware's own figure makes it too, because the voltage rises.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 45096eca95

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

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