-
-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
USB HID UPS / APC HID UPS shutdown command attempted order #2670
Comments
Hello, thanks for the interesting question. First of all, please note that you seem to be running NUT v2.7.2 which is over 10 years old and would not be directly updated, at least by core project. You might build your own if required, though (e.g. to apply a custom patch). Current NUT codebase aims to be buildable wherever it worked before, so https://github.com/networkupstools/nut/wiki/Building-NUT-for-in%E2%80%90place-upgrades-or-non%E2%80%90disruptive-tests might help you follow that path. Looking at even current code, the command sequence in Lines 969 to 993 in d244d73
Note that normally NUT daemons (drivers, upsmon, upsd...) are killed as any other services in the system going down, before it gets to the part where it calls |
Tinkering about this... |
…er) [networkupstools#2670] Signed-off-by: Jim Klimov <[email protected]>
…er), by default chain the originally used sequence in upsdrv_shutdown() [networkupstools#2670] Signed-off-by: Jim Klimov <[email protected]>
…XIT_FAILURE and EF_EXIT_SUCCESS for set_exit_flag(int) methods [networkupstools#2670] Signed-off-by: Jim Klimov <[email protected]>
…s for set_exit_flag(int) methods [networkupstools#2670] Signed-off-by: Jim Klimov <[email protected]>
…rv_shutdown flag to exit or not after upsdrv_shutdown() and individual power-state related INSTCMDs [networkupstools#2670] Signed-off-by: Jim Klimov <[email protected]>
…ver [networkupstools#2670] Signed-off-by: Jim Klimov <[email protected]>
…tcmd() [networkupstools#2670] Signed-off-by: Jim Klimov <[email protected]>
…t and upsdrv_shutdown_default() shared method [networkupstools#2670] Signed-off-by: Jim Klimov <[email protected]>
… upsdrv_shutdown() in any driver [networkupstools#2670] Signed-off-by: Jim Klimov <[email protected]>
…efault" support [networkupstools#2670] Signed-off-by: Jim Klimov <[email protected]>
…wn_sdcommands_or_default() less ambiguously [networkupstools#2670] Signed-off-by: Jim Klimov <[email protected]>
…default upsdrv_shutdown() as the implementation of forceshutdown() and "driver.killpower" INSTCMD (e.g. via `drivername -k`) [networkupstools#2670] Signed-off-by: Jim Klimov <[email protected]>
…() so drivers might implement their own "shutdown.default" at will [networkupstools#2670] Signed-off-by: Jim Klimov <[email protected]>
…wn_commands() [networkupstools#2670] Signed-off-by: Jim Klimov <[email protected]>
Signed-off-by: Jim Klimov <[email protected]>
…lt" implementations again [networkupstools#2670] Signed-off-by: Jim Klimov <[email protected]>
…tinfo() where we register INSTCMD handlers [networkupstools#2670] Signed-off-by: Jim Klimov <[email protected]>
…fallback() so drivers might implement their own "shutdown.default" at will [networkupstools#2670]" This reverts commit 25250b0: too messy in logs where driver.instcmd() think they are last in stack. Signed-off-by: Jim Klimov <[email protected]>
…" as upsdrv_shutdown() in main loop too [networkupstools#2670] Signed-off-by: Jim Klimov <[email protected]>
@Dummy0815 : cheers, I've posted a PR with prospective change for this feature. Testing would be very welcome; see https://github.com/networkupstools/nut/wiki/Building-NUT-for-in%E2%80%90place-upgrades-or-non%E2%80%90disruptive-tests about making a custom build of NUT for experiments (can be run straight from build workspace). |
@Dummy0815 : gentle bump, do you intend to try this solution? |
@jimklimov: Hi sorry, I've just returned from sick leave and still have to catch up. |
Hi we are using an APC USB UPS with an Try Contact I/O card (AP9613) with an external key switch, to switch the UPS and therefor the connected systems with this key ON/OFF.
The APC is "simulating" an LOW BAT with key position OFF and triggers a UPS ON with the other position.
Everything works fine with the 'old' generation of APC (SUA750RMI1U, SUA750I, ..) but with the newer generation (SMT1500RMI2U) we have the issue, that if key OFF (low bat) triggers the system shut down, but the last command "upsdrvctl shutdown -> driver -k" sends an "shutdown.reboot" to the UPS. This causes the UPS to turn the outlets delayed off (which is what we want), but issuing a restart, which causes the UPS to turn on the outlets again (as main power is on the the whole time).
Reason seems to be that the 'old' APC's support the shutdown commands:
"shutdown.reboot", "shutdown.return", "shutdown.stayoff" (and load.off.delay)
While the newer ones only support:
"shutdown.reboot" (and load.off.delay)
So according the NUT documentation the driver -k tries to issue in a fixed order "shutdown.return", "shutdown.reboot", "load.off.delay".
So old APC is shutdown with "shutdown.return" which is Ok as the UPS stays down as the main power doesn't change.
While the newer, as they down support the first command, are doing an "shutdown.reboot" causing the issue we have.
So my question is there any parameter which influences the attempted command sequence? So that we could configure try: 'load.off.delay' first than, "shutdown.return", than "shutdown.reboot"?
As an workaround is there any chance to send a 'load.off.delay' in the final system shutdown stage instead of "upsdrvctl shutdown"?
For reference the output of an old vs an newer APC:
########################
upsc shups
..
device.mfr: American Power Conversion
device.model: Smart-UPS 750
driver.name: usbhid-ups
driver.version.data: APC HID 0.95
driver.version.internal: 0.38
upscmd -l shups
..
load.off.delay - Turn off the load with a delay (seconds)
shutdown.reboot - Shut down the load briefly while rebooting the UPS
shutdown.return - Turn off the load and return when power is back
shutdown.stayoff - Turn off the load and remain off
########################
upsc shups
..
device.mfr: American Power Conversion
device.model: Smart-UPS 1500
driver.name: usbhid-ups
driver.version: 2.7.2
driver.version.data: APC HID 0.95
upscmd -l shups
..
load.off.delay - Turn off the load with a delay (seconds)
shutdown.reboot - Shut down the load briefly while rebooting the UPS
The text was updated successfully, but these errors were encountered: