Comment 12 for bug 267141

Revision history for this message
pakraticus (pakraticus) wrote : Re: [Bug 267141] Re: suspend button disappears after pm-utils upgraded to 1.1.2.4-1ubuntu2

Looking at this more closely, yes my suggested patch disables
pm-utils use of uswsusp on ubuntu, unless someone installed
the debian uswsusp package.

However, the current behavior is to disable the use of suspend when
ubuntu uswsusp is installed.

The root of this problem appears to be duplication of the check_suspend
and check_hibernate functions between modules.d/*, pm-is-supported, and
pm-utils when our SLEEP_MODULE does not have to be the same
as our hibernate module.

My thoughts without code are.
1) the functions for each module should be uniquely named based on the
module.
module.d/uswsusp's check_suspend should be uswsusp_check_suspend
2) pm-utils should source all files in modules.d/*
3) pm-utils should have something like a checkit() and doit() functions
something like
checkit() {
    local rc=1
    for module in $modules; do
        ${module}_check_$1
        rc=$?
        [ "$rc" == 0 ] && break
    done
    return $rc
}
doit() {
    checkit $1; rc=$?
    [ "$rc" == 0 ] && ${module}_check_$1
}

But that needs to be floated upstream....

--
Chris Dukes
"In cynicism she's about 35" -- Terry Pratchett's "Hog Father"