View Single Post
  #6  
Old February 24th 19, 01:53 AM posted to alt.windows7.general
Paul[_32_]
external usenet poster
 
Posts: 11,873
Default Can I make battery-dropout cause a "sleep"?

J. P. Gilliver (John) wrote:
If that's the right name.

At present, if the battery runs down when I'm not looking, on restarting
the machine (by pressing the power button) after connecting the supply,
it does a restart similar to if I'd shut it down, other than that it
gives the "Windows did not shut down properly", and some app.s say
_they_ did not shut down properly.

Is it possible to set something so that the system does a "sleep",
"hibernate", or whatever, so that when I apply power and restart, it
wakes itself up how it was? If it is, what settings do I have to change
where?

I'm not talking about shutdowns instigated by an action, such as closing
the lid or pressing the power button. Is it even _possible_ to trap the
"battery is too low" situation?

W7 HP SP1 32-bit.


A laptop has detection of "0% charge" and
the laptop is expected to make a response to
that condition.

The computer could be doing a number of things at
the time.

1) In run state, battery enters 0%

2) In Sleep State (S3) at the time (session in RAM)
3) In Hybrid Sleep State (S3) at the time (session in RAM, session in hiberfil.sys)
4) In Hibernate (S4) state ( session in hiberfil.sys)
5) System in S5 shutdown ( )

In case (1), you can select S4 or S5 as responses.
S3 is inappropriate by itself, because S3 still
uses power (about 1 watt per DIMM for autorefresh).
Being at 0% battery and enabling S3 sleep (RAM running)
would be dumb, as you're driving the battery into the
danger zone on purpose.

In case (2), the machine could wake long enough to
transfer RAM contents to hiberfil.sys and enter S4.

In case (3), machine can enter S5 without consequences,
because the session is "dually stored" and the hiberfil
has you covered.

In case (4), there is no need to do anything, as in
S4 the platform is already in a low power state (RAM is off).
But, they could wake temporarily and enter S5.

In case (5), it would be nice to do something, but the
machine might not have any useful action available to it
as it is in S5. (In fact, PME options in that state might
be limited to the Power Button.) If the battery drops
too low below 0%, the battery charger may refuse to recharge
the battery because of safety reasons (plating under
reverse bias on a multi-cell lithium pack).

*******

So the answer is "Yes, the machine has some detections"

1) Lid close switch on laptop - typically set to trigger S3 Sleep
or S3 Hybrid Sleep. When (2) happens, machine will transition
to a lower power state like S4 or S5.

2) Low battery indicator - should cause a transition from
the current state, say S0 or S3, to S4 or S5.

A number of criteria are covered in a Power Schema. ACPI
has Power Schema, convenient "containers" of state machine
info as to what to do and when.

Before heading off on a "mission" such as this one, you
inspect the shutdown menu, to see if the shutdown menu
is "full" or is "missing some stuff". For example, on a
virtual machine, there's no sleep or hibernate, on purpose.
But similar things happen on real machines, due to bugs,
or due to user settings.

So the first thing you have to do, is make sure your
shutdown menu is full.

An example of dumb things that can happen. It would be
dumb to be using GPEDIT to mess up these settings. Life
is hard enough, without puzzles.

https://www.tenforums.com/tutorials/...dows-10-a.html

The normal foulup can be found here, in the Power control panel.

https://www.tenforums.com/tutorials/...dows-10-a.html

https://www.tenforums.com/attachment...ton_does-2.png

Notice there are both Sleep and Hibernate radio buttons there.

In an administrator Command Prompt, you would want to do

powercfg /h on

to indicate you want a hiberfile. Note that the hiberfile has
a "percentage size". On an early Win10, a 64GB machine "wanted"
a 48GB hiberfil.sys file. Some compression is involved, and
some heuristics. If a person goes to a great deal of trouble,
they can run a single program that uses all 64GB of memory,
yet fills the memory with "incompressible data". This will
cause a hibernation failure, unless the person doing the
test has set the hiberfil.sys to "100%". The hiberfil.sys
can be reduced to at least 50% of system RAM. Maybe even
lower when you install the OS, and the installer "makes do"
with the too-little storage you offered. A Windows installer
attempts to leave 3GB of space free on C: at the end of installation,
and any "slack" above that amount, can be assigned to the
giant hiberfil.sys.

The hiberfil.sys file is "reserved space". A hard reservation.
The hibernation operation, on the other hand, only writes out
data for the "used" portion of RAM. If you're sitting idle in
the desktop, maybe a little less than 1GB needs to be recorded.
Even though you have 64GB of RAM. A machine with only 2GB of
RAM, might write slightly less than the giant machine, but it
still writes out on hibernation.

So once my hibernation file is present, and I did

dir /ah C:

and verified a hiberfil.sys of sufficient size is present,
then I go to the Power control panel for a look. And see if
my "buttons" are enabled.

After I've ticked my radio buttons, I want to verify
all is well. I go look at the Shutdown menu. Is the menu
full of sleep, hibernate, shutdown items ?

If hibernate is enabled, then you can do hybrid sleep instead
of sleep. This will "slow down" ordinary sleep requests. You
will see extensive LED activity when entering sleep. When
you close the lid (and lid closure is set to sleep), you
would then have LED activity for (potentially, pathologically)
minutes and minutes. On more mundane situations, the writeout
takes ten seconds. Vanilla sleep, without hibernation combined
with it, could reduce that time further, but the OS still
putters around when sleeping, such as "parking" processes
that have left the disk in a "dangerous" state. Maybe if
you're defragging the disk, time is needed to finish the
current defrag API calls properly. This could take minutes,
if it has half a mind.

"Why is hybrid sleep off by default on laptops? (and how do I turn it on?)"

https://blogs.msdn.microsoft.com/old...10-00/?p=10703

"Hybrid sleep is a type of sleep state that combines
sleep and hibernate. When you put the computer into a
hybrid sleep state, it writes out all its RAM to the
hard drive (just like a hibernate), and then goes into
a low power state that keeps RAM refreshed (just like
a sleep). The idea is that you can resume the computer
quickly from sleep, but if there is a power failure or
some other catastrophe, you can still restore the computer
from hibernation.

If you're a command line sort of person, you can use this (uses aliases
instead of GUIDs).

powercfg -setacvalueindex SCHEME_BALANCED SUB_SLEEP HYBRIDSLEEP 1

powercfg -q # query settings of current schema
# like "Balanced" or "High Performance"
"

And what that tells you is, there is a "progression" of controls.
Some controls are common enough, that GUI radio buttons
exist for enabling them. Other controls are "low-runners",
so we make the user "bob for apples" if we need the function.
Rest assured, there is a rats nest of GUIDs at the bottom
of that mess. Someone once reported there could be 200
registry values associated with ACPI, and I suspect that
estimate is on the low side.

It took me a total of *six* screen shots, to collect all the nuances
of the Power control panel. This is for the Win10 in the Test Machine
right now. Hibernate was off on the machine I just
upgraded to 1809. These are the precursor steps before GUI-land.
In Administrator command prompt. This approach works on WIn7 too
(I tried it).

powercfg /hibernate /size 100 # implicit ON
powercfg /h on # but switch it ON anyway
dir /ah C: # then check for a hiberfil.sys

This picture is of Windows 10. Windows 7 shares many
of these same "features". But the deck chairs have been
moved around on Windows 10.

https://i.postimg.cc/zv4TZYGr/Win10-...l-Settings.gif

Here is a picture for Win7. I would really need a laptop
to do this properly, which means changing drives and so on.
(The wrong drive is in the laptop at the moment.)

https://i.postimg.cc/ZqMyGhR5/Win7-Power-Control.gif

Anyway, the toughest part is finding the controls. Between
sevenforums.com and tenforums.com, you should be able
to find enough "tutorials" for any of these controls.

Paul
Ads