Repository navigation
Description
Summary
On an APC Back-UPS RS 1300 LCD using usbhid-ups, writing
battery.mfr.date also changes the read-only battery.date to an
invalid value.
The behavior is reversible and reproducible.
Environment
- Unraid 7.3.4, x86_64
- NUT package:
nut-2.8.5-x86_64-1stable.ssl31 - Unraid NUT plugin:
nut-plugin-2026.10.15-x86_64-1 - UPS: APC Back-UPS RS 1300 LCD
- Firmware:
838.H10 .D - USB VID:PID:
051d:0002 - Driver:
usbhid-ups - Generic HID driver: 0.71
- APC HID: 0.101
- USB communication driver (libusb 1.0): 0.53
- libusb: 1.0.30
Reproduction
Initial values:
battery.date: 2011/00/50
battery.mfr.date: 2020/05/17
battery.mfr.date is writable according to upsrw.
battery.date is not listed as writable.
I changed battery.mfr.date:
upsrw -w -s battery.mfr.date=2026/10/22 -u admin ups@localhost
NUT returned:
SUCCESS
Result:
battery.date: 2056/00/63
battery.mfr.date: 2026/10/22
Writing 2020/05/17 back restores the original values:
battery.date: 2011/00/50
battery.mfr.date: 2020/05/17
Writing 2026/10/22 again reproduces:
battery.date: 2056/00/63
battery.mfr.date: 2026/10/22
I also repeatedly queried battery.date and received the same value
on every poll, so the displayed value is stable.
Source-code observation
My installed version reports APC HID 0.101. I also reviewed the current
master version of drivers/apc-hid.c, currently APC HID 0.102. I
have NOT tested master on this hardware.
Current master contains these mappings:
battery.mfr.date
<- UPS.Battery.ManufacturerDate
<- date_conversion
battery.date
<- UPS.Battery.APCBattReplaceDate
<- apc_date_conversion
Source:
https://github.com/networkupstools/nut/blob/master/drivers/apc-hid.c
There is an interesting exact numerical relationship between the
written dates and the invalid battery.date values.
The standard HID packed representation of 2026/10/22 is:
(2026 - 1980) * 512 + 10 * 32 + 22
= 23894
= 0x5D56
Applying the apc_date_conversion_fun() calculation from current
master to 0x5D56 yields:
year = 0x56 -> 56 -> 2056
month = 0x00 -> 00
day = 0x5D -> 63
giving exactly:
2056/00/63
Likewise, the HID packed representation of 2020/05/17 is:
0x50B1
Applying the same APC conversion yields exactly:
2011/00/50
These are the two values observed on the physical UPS.
This shows that the observed malformed values are consistent with the
standard packed date values being processed by the APC date conversion.
I have not determined why those values reach that conversion.
Expected behavior
NUT should not report impossible calendar values such as:
2011/00/50
2056/00/63
I searched existing issues and found examples of unusual battery.date
values in APC diagnostic output, but did not find an issue specifically
covering this reproducible behavior.
If this is already tracked, please mark this as a duplicate.
I can provide HID/debug output, test current master, or test a proposed
change on the physical UPS if useful.
Activity