[Pm-utils] Question about hooks and suspend-hybrid.

Stefan Seyfried seife at suse.de
Tue Jul 1 08:10:53 PDT 2008


Hi,

Victor Lowther wrote:
> On Tue, 2008-07-01 at 13:59 +0200, Stefan Seyfried wrote:
>> Another solution would be to give a second parameter to the hooks, like
>>
>> ./$hook suspend hybrid
>> ...
>> ./$hook resume hybrid
>>
>> Old and non-hybrid-aware hooks would just ignore the second parameter, hooks
>> that need to know about hybrid can detect that it is there and act
>> accordingly. How does that sound?
> 
> How about just passing $METHOD as the second parameter?  Less parsing

Yes, that sounds good. Basically the same, just easier to implement ;-)

> needed that way, and it sets the stage for some more hook simplification
> in the future -- instead of this being our hook skeleton:
> 
> #!/bin/sh
> <stuff>
> 
> case $1 in
> 	suspend|hibernate) do_sleep_stuff ;;
> 	resume|thaw) do_wake_stuff ;;
> 	*) o_noes ;;
> esac
> 
> we can make this be out hook skeleton:
> 
> #!/bin/sh
> <stuff>
> 
> case $1 in
> 	suspend) do_sleep_stuff $2 ;;
> 	resume)  do_wake_stuff $2 ;;
> 	*) o_noes ;;
> esac
> 
> but that should be left for pm-utils 2.x or somewhere further down the
> line.

Ok. I need it now, since i am implementing hybrid suspend now, but as long as
we will have roughly compatible hooks in the future, we should be fine.
(I believe that you could add it now, since it will be backwards compatible -
the additional parameter would just be ignored by "old" hooks - actually, most
new hooks will still ignore it since they don't need to know).

>> Well, i can code this in s2both. I need to overhaul the exit codes anyway.
>> In-kernel suspend cannot do hybrid anyway AFAIK.
> 
> Depends on whether or not your in-kernel suspend is actually tuxonice in
> disguise. :)

Ok. With "in-kernel" i actually meant the one "in-tree", but actually it's
great to have this feature in tuxonice, too.

We'd still run hooks with (pseudo code):

-----
if [ $RESULT = $FROMRAM ]; then
	REVERSE=resume
else
	REVERSE=thaw
fi

run_hooks $REVERSE $METHOD
-----

i guess?

>> So what i will be doing right now in my pm-utils version is:
>>
>>  - call hooks with "suspend_hybrid" during suspend
>>  - call hooks with "resume", as if returning from s2ram. Some hooks will do
>>    just a bit more in this case, which should not hurt.
>>
>> If we agree that the above 2-parameter version is better, i can quickly adapt
>> to that, but i want to start testing real soon.
> 
> Does just passing $METHOD as the second parameter work for you?

Yes, it's even easier ;-)

Thanks,

	Stefan
-- 
Stefan Seyfried
R&D Team Mobile Devices            |              "Any ideas, John?"
SUSE LINUX Products GmbH, Nürnberg | "Well, surrounding them's out."

This footer brought to you by insane German lawmakers:
SUSE Linux Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)


More information about the Pm-utils mailing list