Skip to content

feat(razer): standard-matrix lighting for the Diamondback Chroma - #151

Draft
ydw1904 wants to merge 2 commits into
OpenMouse-Project:mainfrom
ydw1904:feat/razer-diamondback-lighting
Draft

ydw1904 wants to merge 2 commits into
OpenMouse-Project:mainfrom
ydw1904:feat/razer-diamondback-lighting

Conversation

@ydw1904

@ydw1904 ydw1904 commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds lighting to the generic RazerHidClient for Chroma-era mice that OpenRazer drives through its older standard-matrix commands (class 0x03). It is gated per product by a new standardMatrixLighting flag, which only the Diamondback Chroma (0x004c) has.

Stacked on #150: the first commit is that PR, so review the second one.

  • Codec (src/razer/codec.ts): razerSetStandardEffectCommand covers off, spectrum, wave, static, reactive and breathing random/single/dual on 0x03/0x0a. razerSetBacklightBrightnessCommand, RAZER_BACKLIGHT_BRIGHTNESS_READ and decodeBacklightBrightness cover 0x03/0x03 and 0x03/0x83 on the backlight led (0x05), with the 0-255 level shown as whole percent.
  • Driver: readStatus() returns one "Mouse" lighting zone with the brightness the mouse reports (25/50/75/100 offered). setLighting() writes the effect, then writes the brightness only when it changed and confirms it by reading it back. The effect has no read, so it is cached and the card is marked write-only, the same as on the Cobra and Viper Mini.
  • App: nothing to wire. The Lighting tab renders from status.lighting and calls setLighting generically. Checked against the app's main (0.22.0) with this branch linked: tsc and all 254 app tests pass, and a preview of this driver's status output renders the card with all eight effects and the brightness row. The app only needs the version bump after a release.

Evidence

OpenRazer driver/razermouse_driver.c (master), USB_DEVICE_ID_RAZER_DIAMONDBACK_CHROMA:

  • the probe creates backlight_matrix_effect_{none,static,wave,spectrum,reactive,breath}, backlight_led_brightness, matrix_effect_custom and matrix_custom_frame, with no button or macro attributes
  • effects use razer_chroma_standard_matrix_effect_* on transaction id 0xff, and brightness uses razer_chroma_standard_{get,set}_led_brightness(VARSTORE, BACKLIGHT_LED) on 0xff
  • payloads and declared data sizes come from razerchromacommon.c and are pinned in protocol.test.ts

Assumptions and unknowns

  • Untested on hardware. There is no Synapse capture; the bytes come from OpenRazer. The reporter has the mouse, and the lighting checklist is in docs/razer-testing.md.
  • Breathing goes out on 0xff, although OpenRazer lists this model's breathing on 0x3f. That entry sits in the same block as the Cobra, whose breathing answered on its usual id. If breathing alone fails, this is the line to change.
  • Wave always runs in direction 0x01, because the card has no direction control.
  • Not included: per-LED custom frames, a wave direction option, and the other Chroma-era mice OpenRazer drives the same way (Mamba wired/TE, Orochi Chroma) until someone tests one.
  • Whether the effect survives a replug is unknown (checklist step 5).

ydw1904 and others added 2 commits October 1, 2026 11:52
Firmware "Mouse 1.0" over the cable, through OpenMouse Bridge on Windows,
with RazerHidClient unmodified:

- Identity, firmware, DPI (1800) and polling (500 Hz) read back on the
  existing 0xff transaction id.
- 800 DPI and 1000 Hz each wrote, read back and were restored.
- Polling was read back but not measured (the sampler saw dropouts), and
  the DPI stage read gave nothing usable, so no stage editor is offered.

The app's hardware test export is in captures/razer-diamondback-chroma/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OpenRazer drives the Diamondback Chroma's LEDs through the older Chroma
command family (class 0x03), not the extended matrix the Cobra and Viper
Mini use. Adds that family to the generic RazerHidClient behind a new
per-product standardMatrixLighting flag, set only on 0x004c:

- codec: razerSetStandardEffectCommand (off, spectrum, wave, static,
  reactive, breathing random/single/dual on 0x03/0x0a) and the backlight
  brightness pair (0x03/0x03, 0x03/0x83, backlight led 0x05, 0-255 level
  as whole percent), byte for byte from razerchromacommon.c
- driver: readStatus reports one "Mouse" zone with the brightness read
  from the mouse; setLighting writes the effect, then the brightness only
  when it changed, confirmed by read-back. The effect has no read, so it
  is cached and marked write-only, as on the Cobra and Viper Mini.

Every command uses the product's 0xff transaction id, breathing included,
although OpenRazer lists this model's breathing on 0x3f: that entry sits
in the block where the Cobra's breathing turned out to answer on its usual
id. Untested on hardware; the checklist is in docs/razer-testing.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant