drivers: fix CPS HID input/output voltage decoding for 0764:0601#3425
drivers: fix CPS HID input/output voltage decoding for 0764:0601#3425jeje232 wants to merge 2 commits intonetworkupstools:masterfrom
Conversation
|
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. |
|
❌ Build nut 2.8.5.4657-master failed (commit 5c2ad8649b by @jeje232) |
|
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, |
|
✅ Build nut 2.8.5.4658-master completed (commit b8c97a1f6c by @jeje232)
|
|
✅ Build nut 2.8.5.4658-master completed (commit b8c97a1f6c by @jeje232) |
Summary
This patch fixes incorrect CPS HID voltage decoding for devices with:
07640601In 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 payload0x08e5->2277->227.7V0f f6 08-> little-endian payload0x08f6->2294->229.4V12 0c 09-> little-endian payload0x090c->2316->231.6VAt 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 = 0764productid = 0601After the fix:
input.voltageis reported around 230Voutput.voltageis reported around 230VNotes
While debugging this, I also found that the current
cps_fix_report_desc()logic assumes the presence ofHVT(0x10), but this object was not present on my device. The decisive issue for this case was the voltage raw-value decoding path.