Skip to content

drivers: fix CPS HID input/output voltage decoding for 0764:0601#3425

Draft
jeje232 wants to merge 2 commits intonetworkupstools:masterfrom
jeje232:fix-cps-usbhid-voltage-0764-0601
Draft

drivers: fix CPS HID input/output voltage decoding for 0764:0601#3425
jeje232 wants to merge 2 commits intonetworkupstools:masterfrom
jeje232:fix-cps-usbhid-voltage-0764-0601

Conversation

@jeje232
Copy link
Copy Markdown

@jeje232 jeje232 commented Apr 29, 2026

Summary

This patch fixes incorrect CPS HID voltage decoding for devices with:

  • vendor ID: 0764
  • product ID: 0601

In my case, the UPS LCD showed about 229V input/output, while NUT reported values around 22-26V.

Problem

The raw HID reports already contain the correct voltage information in the payload bytes.

Examples observed during debugging:

  • 0f e5 08 -> little-endian payload 0x08e5 -> 2277 -> 227.7V
  • 0f f6 08 -> little-endian payload 0x08f6 -> 2294 -> 229.4V
  • 12 0c 09 -> little-endian payload 0x090c -> 2316 -> 231.6V

At the same time, the UPS front panel displayed about 229V.

So the device appears to send the correct raw voltage, but NUT decodes it incorrectly for CPS voltage report IDs.

Fix

The patch corrects the raw value reconstruction for CPS HID voltage report IDs:

  • 0x0F (UPS.Input.Voltage)
  • 0x12 (UPS.Output.Voltage)

This allows the final decoded values to match the actual mains voltage shown by the UPS.

Validation

Tested on a real CyberPower/PowerWalker-family UPS with:

  • vendorid = 0764
  • productid = 0601

After the fix:

  • input.voltage is reported around 230V
  • output.voltage is reported around 230V
  • values match the UPS LCD

Notes

While debugging this, I also found that the current cps_fix_report_desc() logic assumes the presence of HVT(0x10), but this object was not present on my device. The decisive issue for this case was the voltage raw-value decoding path.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 29, 2026

A ZIP file with standard source tarball and another tarball with pre-built docs for commit b1707d9 is temporarily available: NUT-tarballs-PR-3425.zip.

@AppVeyorBot
Copy link
Copy Markdown

@AppVeyorBot
Copy link
Copy Markdown

@jimklimov
Copy link
Copy Markdown
Member

Why were existing comments, debug printouts and blank lines removed, and other blanks added? Was this coded by yourself, or by an AI assistant (the removals look like a misconfiguration of the latter)?

Also, libhid.c is (or aims to be) generic, with minimal awareness about specific devices. If it is possible to wedge the debug_maybe_fix_cps_voltage_raw_value() fix into cps_fix_report_desc() so it only ever impacts these devices, please do so.

@jimklimov jimklimov marked this pull request as draft April 29, 2026 19:33
@AppVeyorBot
Copy link
Copy Markdown

Build nut 2.8.5.4658-master completed (commit b8c97a1f6c by @jeje232)

@AppVeyorBot
Copy link
Copy Markdown

@jimklimov jimklimov added CyberPower (CPS) USB Incorrect or missing readings On some devices driver-reported values are systemically off (e.g. x10, x0.1, const+Value, etc.) impacts-release-2.8.5 Issues reported against NUT release 2.8.5 (maybe vanilla or with minor packaging tweaks) labels Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CyberPower (CPS) impacts-release-2.8.5 Issues reported against NUT release 2.8.5 (maybe vanilla or with minor packaging tweaks) Incorrect or missing readings On some devices driver-reported values are systemically off (e.g. x10, x0.1, const+Value, etc.) USB

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants