Skip to content

reinstate handling for STATUS(ONLINE) in usbhid-ups#1359

Merged
jimklimov merged 1 commit intonetworkupstools:masterfrom
sthen:patch-1
Apr 10, 2022
Merged

reinstate handling for STATUS(ONLINE) in usbhid-ups#1359
jimklimov merged 1 commit intonetworkupstools:masterfrom
sthen:patch-1

Conversation

@sthen
Copy link
Copy Markdown
Contributor

@sthen sthen commented Apr 9, 2022

I have a CyberPower CP1300EPFCLCD which in normal conditions reports ACPresent 1 / Charging 0 / Discharging 0 (presumably the battery condition is OK so it has no need to actively charge). This isn't handled by the change recently brought in for onlinedischarge (a8e3687 in usbhid-ups.c, PR #811).

Here's an excerpt from -DDDDDD showing the problem.

   0.135100     [D2] Path: UPS.Output.DelayBeforeShutdown, Type: Feature, ReportID: 0x15, Offset: 0, Size: 16, Value: -60
   0.135103     [D3] Report[buf]: (2 bytes) => 0b 11
   0.135104     [D5] PhyMax = 0, PhyMin = 0, LogMax = 1, LogMin = 0
   0.135106     [D5] Unit = 00000000, UnitExp = 0
   0.135107     [D5] Exponent = 0
   0.135109     [D2] Path: UPS.PowerSummary.PresentStatus.ACPresent, Type: Feature, ReportID: 0x0b, Offset: 0, Size: 1, Value: 1
   0.135110     [D5] hu_find_infoval: found online (value: 1)
   0.135112     [D5] process_boolean_info: online
   0.135114     [D3] Report[buf]: (2 bytes) => 0b 11
   0.135115     [D5] PhyMax = 0, PhyMin = 0, LogMax = 1, LogMin = 0
   0.135120     [D5] Unit = 00000000, UnitExp = 0
   0.135121     [D5] Exponent = 0
   0.135123     [D2] Path: UPS.PowerSummary.PresentStatus.Charging, Type: Feature, ReportID: 0x0b, Offset: 1, Size: 1, Value: 0
   0.135124     [D5] hu_find_infoval: found !chrg (value: 0)
   0.135126     [D5] process_boolean_info: !chrg
   0.135128     [D3] Report[buf]: (2 bytes) => 0b 11
   0.135129     [D5] PhyMax = 0, PhyMin = 0, LogMax = 1, LogMin = 0
   0.135131     [D5] Unit = 00000000, UnitExp = 0
   0.135133     [D5] Exponent = 0
   0.135135     [D2] Path: UPS.PowerSummary.PresentStatus.Discharging, Type: Feature, ReportID: 0x0b, Offset: 2, Size: 1, Value: 0
   0.135136     [D5] hu_find_infoval: found !dischrg (value: 0)
   0.135138     [D5] process_boolean_info: !dischrg
   0.135139     [D3] Report[buf]: (2 bytes) => 0b 11
   0.135141     [D5] PhyMax = 0, PhyMin = 0, LogMax = 1, LogMin = 0
   0.135142     [D5] Unit = 00000000, UnitExp = 0
   0.135143     [D5] Exponent = 0
   0.135145     [D2] Path: UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit, Type: Feature, ReportID: 0x0b, Offset: 3, Size: 1, Value: 0
   0.135147     [D5] hu_find_infoval: found !lowbatt (value: 0)
   0.135148     [D5] process_boolean_info: !lowbatt
   0.135152     [D5] send_to_all: SETINFO ups.status ""
   0.135169     [D5] send_to_all: DATAOK
   0.135363     [D2] dstate_init: sock /var/db/nut/usbhid-ups-office open on fd 5
   0.135371     [D5] send_to_all: SETINFO driver.parameter.pollinterval "2"
   0.135374     [D5] send_to_all: SETINFO driver.parameter.synchronous "auto"
   0.135376     [D5] send_to_all: SETINFO device.mfr "CPS"
   0.135379     [D5] send_to_all: SETINFO device.model "CP1300EPFCLCD"
   0.135382     [D5] send_to_all: SETINFO device.serial "CRWHY2000030"
   0.135383     [D1] upsdrv_updateinfo...
   0.135388     nut_libusb_get_interrupt: Operation not supported or unimplemented on this platform
   0.135392     [D1] Got 0 HID objects...
   0.135393     [D1] Quick update...

With usbhid-ups.c from before this commit, or with the patch in this PR, status is set as 'send_to_all: SETINFO ups.status "OL"'.

Hopefully this has everything you need, if not then please let me know what further information I can provide. Thanks!

The recent onlinedischarge changes removed support for some STATUS(ONLINE) cases, affecting at least CP1300EPFCLCD - this brings them back.
@jimklimov
Copy link
Copy Markdown
Member

jimklimov commented Apr 9, 2022

Hello, thanks for the heads-up, catch and fix!

I just updated the original description to link to PR that added the change, for the context:

...when the UPS loses mains power, it goes from OL into OL DISCHRG mode. Yes, it does not change it's input mode. However, it correctly shows input voltage to be 0.

@jimklimov jimklimov added the ready / gonna merge The PR is in final cycles leading to merge unless someone logs an objection before we hit the button label Apr 9, 2022
@jimklimov
Copy link
Copy Markdown
Member

CI is currently busy checking a few other PRs that I plan to merge as a single wad later in the weekend, to avoid spurious rebuilds.

@jimklimov jimklimov merged commit daffc2b into networkupstools:master Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug CyberPower (CPS) ready / gonna merge The PR is in final cycles leading to merge unless someone logs an objection before we hit the button USB

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants