You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently testing out the library to see if it can do everything I need for an upcoming project but so far I've been unable to trigger a shutdown so I was hoping for some advice on what I might be doing wrong?
I'm currently testing in windows and the battery percentage, time remaining etc is all working nicely. I have been able to trigger a shutdown by artificially setting the battery percentage below the shutdown threshold but that is relying on the settings being correct in the OS so I would rather use the inbuilt method if possible.
I've tried setting iDelayBe4ShutDown to something greater than 0. This appears to trigger the program to set the SHUTDOWNREQ and SHUTDOWNIMNT bits but then nothing happens after that. I've also tried setting the charging and AC present status to false incase that is preventing the shutdown from working so I'm not sure what else I could be missing.
The PC I'm testing on is a windows 11 desktop, so there are no other batteries present to confuse it.
The text was updated successfully, but these errors were encountered:
Hi, I'm glad it worked for you, this was the intent )
These flags (Shutdown Imminent and Shutdown Requested) are part of the PresentStatus report, that delivers the information to the OS about the state of the Power Device. I suspect these flags are only for informing the host and not for initiating the shutdown sequence. This is what is written on the USB.org specs regarding the DelayBe4Shutdown:
Writing this value shuts down (i.e., turns off) either the output after the indicated number of seconds, or sooner if the batteries become depleted. Sending this command with 0 causes the shutdown to occur immediately. Sending this command with –1 aborts the countdown. If the system is already in the desired state at the time the countdown reaches 0, there is no additional action (i.e. there is no additional action if the output is already off). On some systems, if the USB driver on the device side is restarted while a shutdown countdown is in effect, the countdown may be aborted. Writing this value overrides any DelayBeforeShutdown countdown already in effect.
When read, DelayBeforeShutdown will return the number of seconds remaining until shutdown, or –1 if no shutdown countdown is in effect.
So, if I understood this correctly, the scenario is the following: the host is planning to shut down (let's say, requested by the admin) and is willing to switch off the UPS as well. So it sets the DelayBeforeShutdown and this initiates the sequence of the UPS shutdown. The UPS reports back to the host that the shutdown is in progress. So the OS doesn't have to do anything with these flags unless the system wants to abort the shutdown of the UPS. In this case, the host needs to check these flags and set the DelayBeforeShutdown to -1.
Hi, thanks for the fantastic work so far!
I'm currently testing out the library to see if it can do everything I need for an upcoming project but so far I've been unable to trigger a shutdown so I was hoping for some advice on what I might be doing wrong?
I'm currently testing in windows and the battery percentage, time remaining etc is all working nicely. I have been able to trigger a shutdown by artificially setting the battery percentage below the shutdown threshold but that is relying on the settings being correct in the OS so I would rather use the inbuilt method if possible.
I've tried setting iDelayBe4ShutDown to something greater than 0. This appears to trigger the program to set the SHUTDOWNREQ and SHUTDOWNIMNT bits but then nothing happens after that. I've also tried setting the charging and AC present status to false incase that is preventing the shutdown from working so I'm not sure what else I could be missing.
The PC I'm testing on is a windows 11 desktop, so there are no other batteries present to confuse it.
The text was updated successfully, but these errors were encountered: