You are not logged in.

#1 2004-10-08 17:16:57

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

[new] laptop-mode-tools

pkgname=laptop-mode-tools
pkgver=1.02
pkgrel=1
pkgdesc="Usermode tools for configuring the kernel's laptop-mode"
url="http://www.xs4all.nl/~bsamwel/laptop_mode/index.html"
source=(http://www.xs4all.nl/~bsamwel/laptop_mode/tools/downloads/${pkgname}_${p
kgver}.tar.gz
        laptop-mode.rcd)
md5sums=('2d6ff92d3e18845bea2f3cd18815ede0' 'dbf0407477967a2bb4724f574bd27d7d')

build()
{
  cd $startdir/src/$pkgname-$pkgver
  make || return 1


  mkdir -p $startdir/pkg/etc/rc.d
  install -m755 $startdir/laptop-mode.rcd $startdir/pkg/etc/rc.d/laptop-mode

  install -d etc/laptop-mode $startdir/pkg/etc
  install -d etc/acpi $startdir/pkg/etc
  install -d etc/apm $startdir/pkg/etc

  mkdir -p $startdir/pkg/usr/sbin
  install -m755 usr/sbin/laptop_mode $startdir/pkg/usr/sbin

  mkdir -p $startdir/pkg/usr/local/man/man8
  install -m644 man/laptop_mode.8 $startdir/pkg/usr/local/man/man8
  install -m644 man/laptop-mode.conf.8 $startdir/pkg/usr/local/man/man8
}

and laptop-mode.rcd

#!/bin/sh

. /etc/rc.conf
. /etc/rc.d/functions

case $1 in
start)
  stat_busy "Initializing Laptop Mode"
  touch /var/run/laptop-mode-enabled
  /usr/sbin/laptop_mode auto > /dev/null
  if [ $? -gt 0 ]; then
    stat_fail
  else
    stat_done
  fi
  ;;

stop)
  echo -n "Stopping laptop mode..."
  rm -f /var/run/laptop-mode-enabled
  /usr/sbin/laptop_mode stop > /dev/null
  if [ $? -gt 0 ]; then
   stat_fail
  else
    stat_done
  fi
  ;;

restart)
  $0 stop
  $0 start
  ;;

*) echo "usage: $0 {stop|start|restart}" >&2
  ;;
esac

package also in my repo

Offline

#2 2004-10-09 02:05:56

kill
Member
Registered: 2004-09-30
Posts: 126

Re: [new] laptop-mode-tools

How well is it working for you, what kind of difference are you seeing on battery life phrakture?

Offline

#3 2004-10-09 07:07:27

itlain
Member
Registered: 2004-08-22
Posts: 12

Re: [new] laptop-mode-tools

mkdir -p $startdir/pkg/usr/local/man/man8
  install -m644 man/laptop_mode.8 $startdir/pkg/usr/local/man/man8
  install -m644 man/laptop-mode.conf.8 $startdir/pkg/usr/local/man/man8

This is the only part in which I think there is a problem. My understanding that Arch didn't use /usr/local at all unless it was a locally installed program, ie not a package. I don't have any man pages under /usr/local/man. All of mine are under /usr/man. But it would be an easy enough fix. Now to see if the program makes a difference on my battery eating laptop.

Offline

#4 2004-10-09 07:11:02

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: [new] laptop-mode-tools

whoops... sorry - i used the install script for the package to make the pkgbuild and copied most verbatim.....

i apologize for the man page error

Offline

#5 2005-05-17 06:44:47

nightfrost
Member
From: Sweden
Registered: 2005-04-16
Posts: 647

Re: [new] laptop-mode-tools

Hi. Thanks for the PKGBUILD. Just wanted to say that the config files weren't installed, I had to move them manually from src/laptop-mode-tools-1.02/etc to /etc/laptop-mode. I might have done something wrong though, since I'm new to arch. But I was wondering what exatly laptop-mode does? I thought it as supposed to spin done the drive, but I'm not sure it does. Is there a way to find out if the drive is idle or not?

Offline

#6 2005-05-17 07:18:31

jerem
Member
From: France
Registered: 2005-01-15
Posts: 310

Re: [new] laptop-mode-tools

If the drivee is idle you will hear a noise when it "awakes".

Offline

#7 2005-05-17 07:29:07

nightfrost
Member
From: Sweden
Registered: 2005-04-16
Posts: 647

Re: [new] laptop-mode-tools

Thanks, but I was looking for something more black on white..

Offline

#8 2005-05-17 09:19:15

nightfrost
Member
From: Sweden
Registered: 2005-04-16
Posts: 647

Re: [new] laptop-mode-tools

I realized the config was merged in the script itself... so, nevermind my previous remark on the config-files. It seems to work great smile

Offline

#9 2005-05-17 11:51:06

nightfrost
Member
From: Sweden
Registered: 2005-04-16
Posts: 647

Re: [new] laptop-mode-tools

Something's continuously forcing my disk to spin up. I'd wager it's syslog-ng. How do I stop it from writing to disk. I have this in /etc/syslog-ng/syslog-ng.conf

#
# /etc/syslog-ng/syslog-ng.conf
#

options {
  sync (0);
  time_reopen (10);
  log_fifo_size (1000);
  long_hostnames(off); 
  use_dns (no);
  use_fqdn (no);
  create_dirs (no);
  keep_hostname (yes);
};

source src {
  unix-stream("/dev/log");
  internal();
  pipe("/proc/kmsg");
};

#destination authlog { file("/var/log/auth.log"); };
#destination syslog { file("/var/log/syslog.log"); };
#destination cron { file("/var/log/crond.log"); };
#destination daemon { file("/var/log/daemon.log"); };
#destination kernel { file("/var/log/kernel.log"); };
#destination lpr { file("/var/log/lpr.log"); };
#destination user { file("/var/log/user.log"); };
#destination uucp { file("/var/log/uucp.log"); };
#destination mail { file("/var/log/mail.log"); };
#destination news { file("/var/log/news.log"); };
##destination debug { file("/var/log/debug.log"); };
#destination messages { file("/var/log/messages.log"); };
#destination errors { file("/var/log/errors.log"); };
#destination everything { file("/var/log/everything.log"); };
#destination iptables { file("/var/log/iptables.log"); };
#destination console { usertty("root"); };

# Log everything to vc12
destination console_all { file("/dev/vc/12"); };

filter f_auth { facility(auth); };
filter f_authpriv { facility(auth, authpriv); };
filter f_syslog { program(syslog-ng); };
filter f_cron { facility(cron); };
filter f_daemon { facility(daemon); };
filter f_kernel { facility(kern); };
filter f_lpr { facility(lpr); };
filter f_mail { facility(mail); };
filter f_news { facility(news); };
filter f_user { facility(user); };
filter f_uucp { facility(cron); };
filter f_news { facility(news); };
#filter f_debug { not facility(auth, authpriv, news, mail); };
filter f_messages { level(info..warn) and not facility(auth, authpriv, mail, news) and not program(syslog-ng); };
filter f_everything { level(debug..emerg) and not facility(auth, authpriv); };
filter f_emergency { level(emerg); };
filter f_info { level(info); };
filter f_notice { level(notice); };
filter f_warn { level(warn); };
filter f_crit { level(crit); };
filter f_err { level(err); };
filter f_iptables { match("IN="); };

#log { source(src); filter(f_authpriv); destination(authlog); };
#log { source(src); filter(f_syslog); destination(syslog); };
#log { source(src); filter(f_cron); destination(cron); };
#log { source(src); filter(f_daemon); destination(daemon); };
#log { source(src); filter(f_kernel); destination(kernel); };
#log { source(src); filter(f_lpr); destination(lpr); };
#log { source(src); filter(f_mail); destination(mail); };
#log { source(src); filter(f_news); destination(news); };
#log { source(src); filter(f_user); destination(user); };
#log { source(src); filter(f_uucp); destination(uucp); };
##log { source(src); filter(f_debug); destination(debug); };
#log { source(src); filter(f_messages); destination(messages); };
#log { source(src); filter(f_err); destination(errors); };
#log { source(src); filter(f_emergency); destination(console); };
#log { source(src); filter(f_everything); destination(everything); };
#log { source(src); filter(f_iptables); destination(iptables); };

# Log everything to vc12
log { source(src); destination(console_all); };

...but that doesn't seem to help. Thanks in advance.

Offline

#10 2005-05-17 14:04:03

CyberTron
Member
From: Gotland ,Sweden
Registered: 2005-03-17
Posts: 645
Website

Re: [new] laptop-mode-tools

why does one wanna use laptop-mode-tools? what do they provide which the kernel and cpufreq don't? 

I do use a laptop as my primary computer, but never used laptopmodes....should I?


http://www.linuxportalen.com  -> Linux Help portal for Linux and ArchLinux (in swedish)

Dell Inspiron 8500
Kernel 2.6.14-archck1  (selfcompiled)
Enlightenment 17

Offline

#11 2005-05-17 15:11:27

nightfrost
Member
From: Sweden
Registered: 2005-04-16
Posts: 647

Re: [new] laptop-mode-tools

I only use it in order to get a drive spin down (which I guess you could do with hdparm)- it has some additional features, like caching a certain amount of writes to memory, and then flush everything at once when the drive spins up. You should check the script which starts with the configs in order to see the available features. I don't use it to manage cpu-frequencies though.

Offline

#12 2005-05-17 15:37:14

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: [new] laptop-mode-tools

all these tools really do is "echo 1 >> /proc/sys/..../laptop_mode"

I don't use this anymore, I just set laptop mode to 1 in rc.local

laptop_mode doesn't do disk spindown the same way hdparm does.  It tells the kernel to hold disk writes for a number of seconds in case there are more writes... so if I wrote 10b, 10b, 10b, 10b, 10b, the kernel would normally write 5 10b blocks... with laptop mode on, it would probably write a 30b block and a 20b block (just making it up as I don't know the "wait time")

Offline

#13 2005-05-17 15:51:23

nightfrost
Member
From: Sweden
Registered: 2005-04-16
Posts: 647

Re: [new] laptop-mode-tools

all these tools really do is "echo 1 >> /proc/sys/..../laptop_mode"

Yeah, that's smart. How about the config, then? Do you still have /etc/laptop-mode/laptop-mode.conf?

And, also, is it really no problem for the drive to spin up & down continuously?

Offline

#14 2005-05-17 15:54:42

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: [new] laptop-mode-tools

nightfrost wrote:

all these tools really do is "echo 1 >> /proc/sys/..../laptop_mode"

Yeah, that's smart. How about the config, then? Do you still have /etc/laptop-mode/laptop-mode.conf?

And, also, is it really no problem for the drive to spin up & down continuously?

laptop mode is part of the kernel (been around since 2.6.4 or something) - the laptop mode tools simply toggle around the kernel's laptop mode

disk spin up/down isn't an issue, really - it's just that a) this may prolong disk life by a tad and b) prevents extra noise/heat from the laptop

Offline

#15 2005-05-17 16:12:16

nightfrost
Member
From: Sweden
Registered: 2005-04-16
Posts: 647

Re: [new] laptop-mode-tools

laptop mode is part of the kernel (been around since 2.6.4 or something) - the laptop mode tools simply toggle around the kernel's laptop mode

but if you just "echo 1 > /proc/sys/vm/laptop-mode", what decides how long the disk will be idle before it spins down?

disk spin up/down isn't an issue, really - it's just that a) this may prolong disk life by a tad and b) prevents extra noise/heat from the laptop

Oh, that's a relief smile

Offline

#16 2005-05-17 16:36:05

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: [new] laptop-mode-tools

nightfrost wrote:

Something's continuously forcing my disk to spin up. I'd wager it's syslog-ng. How do I stop it from writing to disk. I have this in /etc/syslog-ng/syslog-ng.conf

be very careful with this... it gets crazy... do it for like 1min max

echo 1 >> /proc/sys/vm/block_dump

this will log to dmesg info about which process is causing the disk spin up

...

the write delay is set in the kernel, but laptop_mode... I have no clue what it's set at....

Offline

#17 2005-05-17 16:44:34

nightfrost
Member
From: Sweden
Registered: 2005-04-16
Posts: 647

Re: [new] laptop-mode-tools

Thanks alot! That's preciely what I've been looking for. I'm gonna try that out next time I'm on battery.

Offline

#18 2005-07-28 14:49:44

big_gie
Member
Registered: 2005-01-19
Posts: 637

Re: [new] laptop-mode-tools

Hi phrakture,

I've tryed the PKGBUILD, but I don't know why the "install -d" doesn't seem to work...

So I've adapted your PKGBUILD (and updated to lates program version) following the install.sh script.

The PKGBUILD now create explicitly the folders, then use install -mXXX with permissions taken from the install.sh. Its longer to create such a pkgbuild but its cleaner.

Here it is:

PKGBUILD

pkgname=laptop-mode-tools
pkgver=1.06
pkgrel=1
pkgdesc="Usermode tools for configuring the kernel's laptop-mode"
url="http://www.xs4all.nl/~bsamwel/laptop_mode/index.html"
backup=('/etc/laptop-mode/laptop-mode.conf')
source=(http://www.xs4all.nl/~bsamwel/laptop_mode/tools/downloads/${pkgname}_${pkgver}.tar.gz laptop-mode.rcd)
md5sums=('d8001d456ae2005a78a5fae8b96d34a1' '93c90238995f7b20bda1b0bf7cfe16b1')


build() {
  cd $startdir/src/$pkgname-$pkgver

  mkdir -p $startdir/pkg{/etc{/acpi{/actions,/events},/apm/event.d,/laptop-mode,/power{/event.d,/scripts.d},/rc.d},/usr{/sbin,/man/man8}}

  install -m600 etc/laptop-mode/laptop-mode.conf $startdir/pkg/etc/laptop-mode/laptop-mode.conf
  install -m700 usr/sbin/laptop_mode $startdir/pkg/usr/sbin
  install -m700 usr/sbin/lm-syslog-setup $startdir/pkg/usr/sbin
  install -m700 etc/acpi/actions/* $startdir/pkg/etc/acpi/actions
  install -m600 etc/acpi/events/* $startdir/pkg/etc/acpi/events
  install -m700 etc/apm/event.d/* $startdir/pkg/etc/apm/event.d
  # No pbbuttons support
  install -m755 $startdir/laptop-mode.rcd $startdir/pkg/etc/rc.d/laptop-mode

  install -m644 man/laptop_mode.8 $startdir/pkg/usr/man/man8
  install -m644 man/laptop-mode.conf.8 $startdir/pkg/usr/man/man8
}

laptop-mode.rcd (unchanged)

#!/bin/sh

. /etc/rc.conf
. /etc/rc.d/functions

case $1 in
start)
  stat_busy "Initializing Laptop Mode"
  touch /var/run/laptop-mode-enabled
  /usr/sbin/laptop_mode auto > /dev/null
  if [ $? -gt 0 ]; then
    stat_fail
  else
    stat_done
  fi
  ;;

stop)
  echo -n "Stopping laptop mode..."
  rm -f /var/run/laptop-mode-enabled
  /usr/sbin/laptop_mode stop > /dev/null
  if [ $? -gt 0 ]; then
   stat_fail
  else
    stat_done
  fi
  ;;

restart)
  $0 stop
  $0 start
  ;;

*) echo "usage: $0 {stop|start|restart}" >&2
  ;;
esac

Offline

#19 2005-07-28 17:18:37

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: [new] laptop-mode-tools

ummm this has been in the AUR for some time - please check there before posting PKGBUILDs to the forum - this is a very old thread too

Offline

#20 2005-10-03 12:15:14

kozaki
Member
From: London >. < Paris
Registered: 2005-06-13
Posts: 671
Website

Re: [new] laptop-mode-tools

Please correct it if I'm wrong,

but _laptop-mode.rcd_ has moved to _/etc/rc.d/laptop-mode_
I'm running _laptop-mode-tools 1.05-1_


Seeded last month: Arch 50 gig, derivatives 1 gig
Desktop @3.3GHz 8 gig RAM, linux-ck
laptop #1 Atom 2 gig RAM, Arch linux stock i686 (6H w/ 6yrs old battery smile) #2: ARM Tegra K1, 4 gig RAM, ChrOS
Atom Z520 2 gig RAM, OMV (Debian 7) kernel 3.16 bpo on SDHC | PGP Key: 0xFF0157D9

Offline

Board footer

Powered by FluxBB