[Pm-utils] pm-utils hook to restore harddisk APM settings

Dan Nicholson dbn.lists at gmail.com
Wed Feb 24 10:48:36 PST 2010


On Wed, Feb 24, 2010 at 10:37 AM, Till Maas <opensource at till.name> wrote:
> On Wed, Feb 24, 2010 at 10:25:30AM -0800, Dan Nicholson wrote:
>> On Wed, Feb 24, 2010 at 9:41 AM, Till Maas <opensource at till.name> wrote:
>> > Hi,
>> >
>> > today I realised that a hook in Fedora that was not meant to exist that
>> > long is already there for two years. It restores the harddisk APM
>> > settings on thaw/resume:
>> >
>> > http://cvs.fedoraproject.org/viewvc/rpms/pm-utils/devel/pm-utils-99hd-apm-restore?revision=1.7&view=markup
>> > http://cvs.fedoraproject.org/viewvc/rpms/pm-utils/devel/pm-utils-hd-apm-restore.conf?revision=1.2&view=markup
>>
>> A couple comments about this feature.
>>
>> 1. One thing I never liked about this is that there's no way to
>> disable it without blacklisting it outright. I don't change my hd apm
>> settings, so I don't need hal and hdparm to figure out what my current
>> settings are, etc. What I want to do is set HD_APM_DEVICES="" in the
>> conf file and have the hook just exit in that case.
>
> Do other hooks nowadays have such a way to disable them?

Yeah, I guess blacklist isn't so bad.

>> 2. HD_APM_DEVICES in the conf file is completely ignored. No matter
>> the value, the hook then goes and asks hal for all the devices.
>
> Uh, yes, it should probably be initiated before sourcing the config
> file. E.g. it should be a failback in case hal does not work. I will
> look into this.

The other way around would be better.

source config_file
if [ -z "$HD_APM_DEVICES" ]; then
    check_with_hal
fi

Then you avoid all the hal calls that you would then throw away. Not
to mention that we should probably from hal to udev, although it
doesn't look that straightforward without writing a little program to
do it.

>> 3. The conf file should probably live in /etc/pm/ with the rest of the
>> pm-utils configuration.
>
> The problem with this is, that then after a package update, there might
> be two versions of the config file, that would all be sourced by
> pm-utils iirc. E.g. a normal one and one with a .rpmnew suffix.

That would be a problem on fedora, but not pm-utils upstream. Probably
not a big deal, but it seems out of place in /etc.

>> Finally, I think it needs to be asked why we're doing this in
>> userspace at all. Shouldn't the kernel be restoring the settings for
>> us like it does for every other device type?
>
> I do not know how to write a patch for this in the kernel and I am not
> motivated enough to learn it currently. This issue is the reason why the
> hook was never submitted here. A bug report for the kernel in Fedora is
> available here: https://bugzilla.redhat.com/show_bug.cgi?id=382061

Has anyone asked upstream?

--
Dan


More information about the Pm-utils mailing list