[ltp] New PowerTOP utility for Linux 2.6.21+ from Intel

André Wyrwa linux-thinkpad@linux-thinkpad.org
Sat, 19 May 2007 19:29:38 +1000


--=-reBf71+QdsIuD3clvi8C
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hei,

On Mon, 2007-05-14 at 19:50 +0200, Martin Milata wrote:
> On Mon, May 14, 2007 at 12:10:41PM -0400, Shem Multinymous wrote:
> > On 5/14/07, Martin Milata <b42-ml@srck.net> wrote:
> > >What about checking accelerometer status only if hdd is actually
> > >spinning? Because when using laptop_mode, hdd is spun down most of the
> > >time, but hdapsd is doing it's work all the time. Is something like th=
at
> > >possible?

Firstly to say...the hdapsd implementation isn't very sofisticated. This
is me having virtually no clue about C coding whatsoever. ;-) However, i
had a look at the code and can understand the rough workings of it and
it looks more like a quick solution than a comprehensive implementation.
That said....

I think the problem here is for hdapsd to know when the drive is spun
down. Because this would probably mean it probably needs to poll another
file. The alternative would be to send it a message from whatever causes
the drive to spin down, which could be a lot of things.

> > - You'll also need to keep polling if the driver is accessed via the
> > input infrastructure (as a joystick).
> > - IIRC some drives stupidly spin up when you ask them about their power=
=20
> > mode.
>=20
> Ok, another stupid idea;)
>=20
> If I understand correctly there are two independent timers set: one for
> hdaps driver to periodicaly poll data from accelerometer and other for
> hdapsd to poll data from the driver.
>=20
> Wouldn't be possible for the driver to provide a file (sys or char dev),
> >from which hdapsd could read continuously and which would block until th=
ere
> are new data available instead of openning the sys file periodically and
> checking for values in it? This way only one timer would be needed ...

There are a couple of problems why it can't be done like this:

1. The hdapsd source has a comment explaining why it has to reopen the
sys file all the time, which is because you can't seek back to 0 in
sysfs files. Hence hdapsd can't just keep it open, but needs to close
and open it again to get the content.

2. There is no such case where there is "no new data in the file".
There's always new data in the file, because all the driver does is
expose the acceleratometer data to that file in a sensible format. And
this should not be changed because it would disable other uses of that
data. Hence the data in the sysfs file changes all the time and it is
hdapsd who applies a threshold to it on which to react.

Having said all that...
...i started looking at the source code because i got frustrated about
hdapsd a bit...majorly for the fact that it only supports a single
harddisk. Secondarily for the dullness of gnome-hdaps-applet, compared
to IBM/Lenovos solution for Windows.

I was meaning to rewrite the applet in python and add some
functionality, but this doesn't make sense with the current hdapsd
implementation. Hence i started thinking about that and decided, the
best solution would be to add dbus and hal awareness to hdapsd.

This would not only enable support for multiple harddrives, but would
also enable autodetection of the harddrives...even more, hdapsd could
park harddrives that are later on hotplugged into the system (i'm
thinking ultrabay here). Furthermore, besides these primary advantages,
it would enable userspace applications like gnome-hdaps-applet, to
communicate with hdapsd, temporarily disable it, adjust thresholds on
the fly, etc. etc. .

I can't see if that could lead to a solution for not polling while the
harddisk is parked...it might (maybe hal exposes info like that?).

However, i started working on it, but as said, it is basically my first
C project apart from really small patchworks. So it will take me a
while. (I contacted the authors about it, but didn't get any response.)

Andr=C3=A9.


--=-reBf71+QdsIuD3clvi8C
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQBGTsN6EOp8fsnyxsQRAqKyAKC3U3HmeielI+G0PMq6oKenbVPgeACeJNez
9e0pz7l+PF6rOW7dHunVUDk=
=zVwc
-----END PGP SIGNATURE-----

--=-reBf71+QdsIuD3clvi8C--