Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalware-current.git;a=commitdiff;h=2a2ae76b8229c2c304eb6de29c10fd011492563f

commit 2a2ae76b8229c2c304eb6de29c10fd011492563f
Author: Krisztian VASAS <[email protected]>
Date:   Fri May 14 10:14:24 2010 +0200

pmud-0.10.1-1-ppc
- new package (ppc-only, currently nobuild)

diff --git a/source/xapps-extra/pmud/FrugalBuild 
b/source/xapps-extra/pmud/FrugalBuild
new file mode 100644
index 0000000..a288abc
--- /dev/null
+++ b/source/xapps-extra/pmud/FrugalBuild
@@ -0,0 +1,29 @@
+# Compiling Time: 0.01 SBU
+# Maintainer: Krisztian VASAS <[email protected]>
+
+pkgname=pmud
+pkgver=0.10.1
+pkgrel=1
+pkgdesc="A small daemon to help suspend/hibernate on PPC notebooks."
+url="http://ftp.frugalware.org/pub/other/sources/pmud";
+depends=('glibc' 'libx11')
+rodepends=('tk' 'xmessage')
+groups=('xapps-extra')
+backup=(etc/sysconfig/pmud)
+archs=('!i686' '!x86_64' 'ppc')
+up2date="lynx -dump $url |Flasttar"
+options=('nobuild')
+source=($url/$pkgname-$pkgver.tar.gz \
+       $pkgname \
+       pmud_frugalize.patch)
+sha1sums=('068c06d735311d7223edeef3f1ba199b339c1174' \
+          '34e055bcd9a6fff381fb7fc31a2295837883e930' \
+          '2da24bff488440d42fea7b75e620dcc19cc12424')
+
+build()
+{
+       Fbuild
+       Ffile /etc/sysconfig/pmud
+}
+
+# optimization OK
diff --git a/source/xapps-extra/pmud/pmud b/source/xapps-extra/pmud/pmud
new file mode 100644
index 0000000..476c04d
--- /dev/null
+++ b/source/xapps-extra/pmud/pmud
@@ -0,0 +1 @@
+PMUD_FLAGS=""
diff --git a/source/xapps-extra/pmud/pmud_frugalize.patch 
b/source/xapps-extra/pmud/pmud_frugalize.patch
new file mode 100644
index 0000000..3052948
--- /dev/null
+++ b/source/xapps-extra/pmud/pmud_frugalize.patch
@@ -0,0 +1,851 @@
+diff -Naur pmud-0.10.1.orig/contrib/trackpad.c pmud-0.10.1/contrib/trackpad.c
+--- pmud-0.10.1.orig/contrib/trackpad.c        2001-12-07 12:31:54.000000000 
+0100
++++ pmud-0.10.1/contrib/trackpad.c     2010-05-14 09:43:13.000000000 +0200
+@@ -7,6 +7,8 @@
+  *
+  * 3/17/99 - Minor Fix: usage display used to leave /dev/adb open
+  *
++ * 10/12/99 - addition of 'show' option to aid in pmud debugging
++ *
+  * Pieces from mousehack, from numerous contributors...
+  *
+  */
+@@ -102,7 +104,8 @@
+       mode_notap,
+       mode_tap,
+       mode_drag,
+-      mode_lock
++      mode_lock,
++      mode_show
+ };
+
+
+@@ -117,33 +120,66 @@
+       printf("setting mode: %d\n", mode);
+ #endif
+
+-      buf[0] = ADB_PACKET;
+-      buf[1] = ADB_WRITEREG(id, 2);
+-      buf[2] = (mode < mode_tap) ? 0x19 : 0x99;
+-      buf[3] = (mode < mode_drag) ? 0x14 : 0x94;
+-      buf[4] = 0x19;
+-      buf[5] = (mode < mode_lock) ? 0xb2 : 0xff;
+-      buf[6] = 0xb2;
+-      buf[7] = 0x8a;
+-      buf[8] = 0x1b;
+-      buf[9] = 0x50;
+-      send(buf, 10);
+-      listen(buf);
++      if (mode == mode_show) {
++              int n;
+
+-      set_program_mode(id, 0);
+-
+-      {
+-      int i, n;
+-
+-      for(i=0; i<4; i++)
+-      {
+-              printf("READREG(%d, %d) ", id, i);
++              printf("READREG(%d, %d) ", id, 2);
+               buf[0] = ADB_PACKET;
+-              buf[1] = ADB_READREG(id, i);
++              buf[1] = ADB_READREG(id, 2);
+               send(buf, 2);
+-              n = listen(buf+1);
+-      }
++              n = listen(buf);
++#ifdef DEBUG
++              printf("(reply %d bytes): ",n);
++              if (n >= 0) {
++                      int ii;
++                      for (ii=0; ii < n; ii++)
++                              printf("0x%02x ",buf[ii]);
++              }
++              printf("\n");
++#endif
++              printf("trackpad settings %stap %sdrag %slock\n",
++                      buf[1] == 0x99 ? "" : "no",
++                      buf[2] == 0x94 ? "" : "no",
++                      buf[4] == 0xff ? "" : "no"
++              );
++      } else {
++              buf[0] = ADB_PACKET;
++              buf[1] = ADB_WRITEREG(id, 2);
++              buf[2] = (mode < mode_tap) ? 0x19 : 0x99;
++              buf[3] = (mode < mode_drag) ? 0x14 : 0x94;
++              buf[4] = 0x19;
++              buf[5] = (mode < mode_lock) ? 0xb2 : 0xff;
++              buf[6] = 0xb2;
++              buf[7] = 0x8a;
++              buf[8] = 0x1b;
++              buf[9] = 0x50;
++              send(buf, 10);
++              listen(buf);
++
++#ifdef DEBUG
++              {
++              int i, n;
++
++              for(i=0; i<4; i++)
++              {
++                      printf("READREG(%d, %d) ", id, i);
++                      buf[0] = ADB_PACKET;
++                      buf[1] = ADB_READREG(id, i);
++                      send(buf, 2);
++                      n = listen(buf+1);
++                      printf("(reply %d bytes): ",n);
++                      if (n >= 0) {
++                              int ii;
++                              for (ii=1; ii <= n; ii++)
++                                      printf("0x%02x ",buf[ii]);
++                      }
++                      printf("\n");
++              }
++              }
++#endif
+       }
++      set_program_mode(id, 0);
++
+ }
+
+ int
+@@ -189,6 +225,8 @@
+                       mode = mode_drag;
+               else if (strcmp(argv[1], "lock") == 0)
+                       mode = mode_lock;
++              else if (strcmp(argv[1], "show") == 0)
++                      mode = mode_show;
+       }
+       if (mode == mode_invalid)
+       {
+diff -Naur pmud-0.10.1.orig/Makefile pmud-0.10.1/Makefile
+--- pmud-0.10.1.orig/Makefile  2001-12-15 22:57:47.000000000 +0100
++++ pmud-0.10.1/Makefile       2010-05-14 09:59:40.000000000 +0200
+@@ -23,6 +23,7 @@
+
+ CFLAGS = -Wall -O2
+ PROGS= pmud snooze wakebay fblevel xmouse
++DESTDIR=
+
+ all:  $(PROGS)
+
+@@ -45,16 +46,19 @@
+       $(CC) $(CFLAGS) -c tcp.c
+
+ install:
+-      install -c pmud /sbin
+-      install -c snooze /sbin
+-      install -c wakebay /sbin
+-      install -c fblevel /sbin
+-      install -c xmouse /usr/X11R6/bin
+-      install -c Batmon /usr/bin
+-      install -c -D pwrctl /etc/power/pwrctl
+-      cp pmud.rc /etc/rc.d/init.d/pmud
+-      ln -s /sbin/snooze /usr/bin/apm
+-      chkconfig --add pmud
++      install -d ${DESTDIR}/sbin
++      install -c pmud ${DESTDIR}/sbin
++      install -c snooze ${DESTDIR}/sbin
++      install -c wakebay ${DESTDIR}/sbin
++      install -c fblevel ${DESTDIR}/sbin
++      install -d ${DESTDIR}/usr/bin
++      install -c xmouse ${DESTDIR}/usr/bin
++      install -c Batmon ${DESTDIR}/usr/bin
++      install -d ${DESTDIR}/etc/power
++      install -c -D pwrctl ${DESTDIR}/etc/power/pwrctl
++      install -d ${DESTDIR}/etc/rc.d
++      cp pmud.rc ${DESTDIR}/etc/rc.d/rc.pmud
++      ln -s /sbin/snooze ${DESTDIR}/usr/bin/apm
+
+ clean:
+       rm -f $(PROGS) *.o
+diff -Naur pmud-0.10.1.orig/pmud.8 pmud-0.10.1/pmud.8
+--- pmud-0.10.1.orig/pmud.8    2001-12-15 23:52:40.000000000 +0100
++++ pmud-0.10.1/pmud.8 2010-05-14 09:41:37.000000000 +0200
+@@ -36,7 +36,7 @@
+ left to continue.
+ .Sh SYNOPSIS
+ .Nm pmud
+-.Op Fl dhsvkK
++.Op Fl BdhsvkK
+ .Op Fl f Ar facility
+ .Op Fl l Ar seconds
+ .Op Fl m Ar seconds
+@@ -52,6 +52,8 @@
+ is closed, after which the machine is put to sleep.
+ The options are as follows:
+ .Bl -tag -width Ds
++.It Fl B
++Do not beep when going to sleep or waking up.
+ .It Fl d
+ Enable debugging; this disables pmud of backgrounding.
+ .It Fl f Ar facility
+@@ -82,6 +84,8 @@
+ signal. The default is 15 seconds.
+ .It Fl n
+ Do not detach. Whit this option the daemon will not become a background 
process.
++.It Fl o
++Do not save/restore backlight settings when sleeping (use for offb displays).
+ .It Fl p Ar port
+ Specifies the
+ .Ar port
+@@ -170,4 +174,4 @@
+ .Xr init(8),
+ .Xr hdparm(8),
+ .Xr snooze(8)
+-.Xr /usr/doc/pmud*/*
++.Xr /usr/share/doc/pmud*/*
+diff -Naur pmud-0.10.1.orig/pmud.c pmud-0.10.1/pmud.c
+--- pmud-0.10.1.orig/pmud.c    2001-12-16 10:50:41.000000000 +0100
++++ pmud-0.10.1/pmud.c 2010-05-14 09:41:50.000000000 +0200
+@@ -115,6 +115,9 @@
+ #define FLG_NOLID             (1<<7)
+ #define FLG_NOACLID           (1<<8)
+ #define FLG_NOTCP             (1<<9)
++#define FLG_NOBEEP            (1<<10)
++#define FLG_SUSPEND           (1<<11)
++#define FLG_NOLIDOPEN         (1<<12)
+
+ #define TPS_TAP                       (1<<0)
+ #define TPS_DRAG              (1<<1)
+@@ -156,6 +159,7 @@
+ int adb_fd;
+ int apm_fd;
+ int fb0_fd;
++int susp_fd;
+ int pmu_version;
+ int powermode;                                /* 0 for battery, 1 for AC */
+ int powerlevel = -1;                  /* current power level setting */
+@@ -214,7 +218,8 @@
+ {
+       struct timeval now, tleft;
+       unsigned tms;
+-      int s, len, fl;
++      int s, len, fl, err;
++      unsigned long can_sleep;
+       struct sockaddr *sa;
+       struct sockaddr_in sin;
+       struct sockaddr_un sun;
+@@ -229,11 +234,15 @@
+               {"critical-left", 1, 0, 'l'},
+               {"critical-margin", 1, 0, 'm'},
+               {"nolid", 0, 0, 'k'},
+-              {"noaclid", 0, 0, 'k'},
++              {"noaclid", 0, 0, 'K'},
++              {"nolidopen", 0, 0, 'L'},
+               {"nodetach", 0, 0, 'n'},
++              {"nooffb", 0, 0, 'o'},
++              {"nobeep", 0, 0, 'B'},
+               {"port", 1, 0, 'p'},
+               {"sigpower", 0, 0, 's'},
+               {"shutdown", 0, 0, 'S'},
++              {"suspend", 0, 0, 'D'},
+               {"af_unix", 0, 0, 'u'},
+               {"version", 0, 0, 'v'},
+               {0, 0, 0, 0}
+@@ -251,7 +260,7 @@
+
+       p = p ? p + 1 : *av;
+
+-      while((opt=getopt_long(ac,av, "a::df:hKkl:m:nop:sSuv", options,0))!=EOF)
++      while((opt=getopt_long(ac,av, "a::BdDf:hKkLl:m:nop:sSuv", 
options,0))!=EOF)
+               switch(opt)
+               {
+               case 'a':
+@@ -260,6 +269,9 @@
+                               apmfile = optarg;
+                       break;
+
++              case 'B':
++                      flags |= FLG_NOBEEP;
++                      break;
+               case 'd':
+                       flags |= (FLG_DEBUG|FLG_NODETACH);
+                       syslog_options |= LOG_PERROR;
+@@ -293,6 +305,9 @@
+               case 'k':
+                       flags |= FLG_NOLID;
+                       break;
++              case 'L':
++                      flags |= FLG_NOLIDOPEN;
++                      break;
+               case 'l':
+                       critical_left = atoi(optarg);
+                       break;
+@@ -314,6 +329,9 @@
+               case 'S':
+                       flags |= FLG_SHUTDOWN|FLG_SIGPWR;
+                       break;
++              case 'D':
++                      flags |= FLG_SUSPEND;
++                      break;
+               case 'u':
+                       flags |= FLG_NOTCP;
+                       break;
+@@ -360,16 +378,28 @@
+
+       chk(pmu_fd < 0, "Couldn't open " PMU_FILE " or " PMU_DEVFS_FILE);
+
+-      chk(fcntl(pmu_fd, F_GETFL, &fl) < 0, "fcntl(F_GETFL)");
++      chk((fl = fcntl(pmu_fd, F_GETFL)) < 0, "fcntl(F_GETFL)");
+
+       fl |= O_NONBLOCK;
+-      chk(fcntl(pmu_fd, F_SETFL, &fl) < 0, "fcntl(F_SETFL)");
++      chk(fcntl(pmu_fd, F_SETFL, fl) < 0, "fcntl(F_SETFL)");
+
+       add_fd(pmu_fd, POLLIN, pmu_intr, NULL);
+
+       fb0_fd = open(FB0_FILE, O_RDONLY);
+       chk(fb0_fd < 0, "Couldn't open " FB0_FILE);
+
++      /* preliminary suspend-to-disk support */
++      if(flags&FLG_SUSPEND)
++      {
++              susp_fd = open(SUSP_FILE, O_RDONLY);
++              if (susp_fd < 0)
++              {
++                      syslog(LOG_ERR, "No suspend-to-disk support, using 
shutdown as fallback!\n");
++                      flags |= FLG_SIGPWR;
++                      flags &= ~FLG_SUSPEND;
++              } else
++                      close(susp_fd);
++      }
+
+       if(!(flags&FLG_NOTCP))
+       {
+@@ -391,6 +421,8 @@
+               sun.sun_family = AF_UNIX;
+               strcpy(sun.sun_path, SOCKET_FILE);
+
++              unlink(SOCKET_FILE);
++
+               chk(fchmod(s, 0600) < 0, "Couldn't change socket mode");
+
+               len = sizeof(sun);
+@@ -408,6 +440,31 @@
+       if(!get_pmu_version())
+               bye(EXIT_FAILURE, "incorrect PMU version");
+
++      if(pmu_version >= PMU_VERSION_KEYLARGO) {
++              can_sleep = 0;
++              err = ioctl(pmu_fd, PMU_IOC_CAN_SLEEP, &can_sleep);
++              if (err) {
++                      syslog(LOG_DEBUG, "Could not query kernel for sleep 
support! Setting the system to sleep may fail or hang.");
++              } else {
++                      if (can_sleep == 0) {
++                              if (flags&FLG_SUSPEND) {
++                                      syslog(LOG_DEBUG, "No sleep support on 
this hardware, using suspend-to-disk as requested!");
++                                      // flags |= FLG_SUSPEND;
++                              } else {
++                                      syslog(LOG_DEBUG, "No sleep support on 
this hardware, exiting!");
++                                      close(adb_fd);
++                                      close(pmu_fd);
++                                      bye(EXIT_FAILURE, "missing sleep 
support");
++                              }
++                      }
++              }
++      }
++
++      if (flags&FLG_NOLIDOPEN) {
++              /* prevent lid open from waking the machine */
++              system ("echo lid_wakeup=0 > /proc/pmu/options");
++      }
++
+       if(flags&FLG_APM)
+       {
+ #if 0
+@@ -447,7 +504,7 @@
+                       syslog(LOG_DEBUG, "powerlevels from %s: %d %d",
+                               POWER_FILE,
+                               powerlevels[0],
+-                              powerlevels[0]
++                              powerlevels[1]
+                               );
+
+               if(powerlevels[0] < 1 || powerlevels[0] > 3)
+@@ -508,9 +565,9 @@
+                       if(!lid_closed)
+                       {
+                               fbon(1);
+-                               run_program(POWERLEVEL_SCRIPT,
++                              run_program(POWERLEVEL_SCRIPT,
+                                                "lid-opened",
+-                                              ac ? "ac" : "battery"
++                                              powermode ? "ac" : "battery"
+                                       );
+                       }
+               }
+@@ -621,8 +678,10 @@
+       printf("usage: %s [args]\n\n"
+               "\twhere [args] is:\n\n"
+               "\t-a [<fifo>]  : emulate an apm file in <fifo>\n"
++              "\t-B           : don't beep on sleep or wakeup.\n"
+               "\t-d           : enable debugging text; this flag implicitly\n"
+               "\t               sets the -n flag to prevent backgrounding.\n"
++              "\t-D           : use suspend-to-disk in place of sleep\n"
+               "\t-f <facility>: use <facility> for syslogd(8) messages.\n"
+               "\t-h           : this text.\n"
+               "\t-k           : do not detect lid close\n"
+@@ -634,6 +693,8 @@
+               "\t               order to enable sleeping|shutdown.\n"
+               "\t-n           : do not detach. With this option the daemon\n"
+               "\t               will not become a background process.\n"
++              "\t-o           : do not save/restore backlight settings \n"
++              "\t               (use with offb framebuffer driver).\n"
+               "\t-p <port>    : listen on <port> for requestes.\n"
+               "\t-s           : send SIGPWR to init(8) on low power level;\n"
+               "\t               this does not put the machine to sleep as\n"
+@@ -645,6 +706,7 @@
+               "\t-v           : print the version string of %s.\n\n"
+               "\tfor the following flags, you can also use long-flags\n\n"
+               "\t-a [<fifo>]  : --apm [<fifo>]\n"
++              "\t-B           : --nobeep\n"
+               "\t-d           : --debug\n"
+               "\t-f <facility>: --facility <facility>\n"
+               "\t-h           : --help\n"
+@@ -724,7 +786,7 @@
+               "G3 Wallstreet",                        // 10
+               "1999 G3 Lombard",                      // 11
+               "iBook/G3 Pismo/G4 Titanium",           // 12
+-              "Wow, later than an Titanium! ;-)"      // > 12
++              "Wow, later than a Titanium! ;-)"       // > 12
+       };
+ #define max_version (sizeof(version)/sizeof(char*))
+       static char env[16];
+@@ -1194,10 +1256,10 @@
+       struct sockstate *ss;
+
+       fe = accept(fd, NULL, 0);
+-      chk(fcntl(fe, F_GETFL, &fl) < 0, "fcntl(F_GETFL)");
++      chk((fl = fcntl(fe, F_GETFL)) < 0, "fcntl(F_GETFL)");
+
+       fl |= O_NONBLOCK;
+-      chk(fcntl(fe, F_SETFL, &fl) < 0, "fcntl(F_SETFL)");
++      chk(fcntl(fe, F_SETFL, fl) < 0, "fcntl(F_SETFL)");
+
+       ss = malloc(sizeof(*ss));
+       if (ss == 0)
+@@ -1385,7 +1447,8 @@
+       if(id >= 0)
+               ts = get_trackpad_settings(adb_fd, id);
+
+-      beep(BEEP_TIME, BEEP_OK);
++      if (!(flags & FLG_NOBEEP))
++              beep(BEEP_TIME, BEEP_OK);
+
+       if(flags&FLG_DEBUG)
+               syslog(LOG_DEBUG, "calling sync()");
+@@ -1395,12 +1458,18 @@
+
+       syslog(LOG_INFO, "going to sleep");
+
+-      if (ioctl(pmu_fd, PMU_IOC_SLEEP, 0) < 0)
+-              syslog(LOG_ALERT, "cannot put system to sleep! (%m)");
+-      else
+-              syslog(LOG_INFO, "system awake again");
++      if (flags&FLG_SUSPEND) {
++              /* suspend here */
++              system ("echo -n disk > /sys/power/state");
++      } else {
++              if (ioctl(pmu_fd, PMU_IOC_SLEEP, 0) < 0)
++                      syslog(LOG_ALERT, "cannot put system to sleep! (%m)");
++              else
++                      syslog(LOG_INFO, "system awake again");
++      }
+
+-      beep(BEEP_TIME, BEEP_OK);
++      if (!(flags & FLG_NOBEEP))
++              beep(BEEP_TIME, BEEP_OK);
+
+       if(id >= 0)
+               set_trackpad_settings(adb_fd, id, ts);
+@@ -1788,7 +1857,7 @@
+
+ static void fbon(int on)
+ {
+-      ioctl(fb0_fd, FBIOBLANK, !on);
++      // ioctl(fb0_fd, FBIOBLANK, !on);
+ }
+
+ static void beep(unsigned int ms, unsigned int freq)
+diff -Naur pmud-0.10.1.orig/pmud.h pmud-0.10.1/pmud.h
+--- pmud-0.10.1.orig/pmud.h    2001-12-16 09:38:11.000000000 +0100
++++ pmud-0.10.1/pmud.h 2010-05-14 09:41:59.000000000 +0200
+@@ -38,6 +38,7 @@
+ #define PMU_DEVFS_FILE                "/dev/misc/pmu"
+ #define ADB_FILE              "/dev/adb"
+ #define FB0_FILE              "/dev/fb0"
++#define SUSP_FILE             "/sys/power/disk"
+ #define POWERDIR              "/etc/power"
+ #define POWERLEVEL_SCRIPT     POWERDIR "/pwrctl"
+ #define POWER_FILE            POWERDIR "/levels"
+diff -Naur pmud-0.10.1.orig/pmud.rc pmud-0.10.1/pmud.rc
+--- pmud-0.10.1.orig/pmud.rc   2001-12-07 12:31:44.000000000 +0100
++++ pmud-0.10.1/pmud.rc        2010-05-13 21:54:22.000000000 +0200
+@@ -8,35 +8,47 @@
+ #              or disabling devices appropriately when the power source \
+ #              changes.
+ # processname: pmud
+-# config: /etc/powerlevels
++# config: /etc/sysconfig/pmud
+ # pidfile: /var/run/pmud.pid
+
+ # Source function library.
+-. /etc/rc.d/init.d/functions
++source /lib/initscripts/functions
++TEXTDOMAIN=pmud
++TEXTDOMAINDIR=/lib/initscripts/messages
++daemon=$"pmud"
++
++pid="cat /var/run/pmud.pid 2> /dev/null"
+
+ # Source power daemon options
+-[ -f /etc/sysconfig/power ] && . /etc/sysconfig/power
++[ -f /etc/sysconfig/pmud ] && . /etc/sysconfig/pmud
++
++actions=(restart start stop status)
++
++rc_start()
++{
++       start_msg
++       if [ -z "$(eval $pid)" ];
++       then
++               pmud $PMUD_FLAGS
++               touch /var/lock/subsys/pmud
++               pidof pmud > /var/run/pmud.pid
++               ok $?
++       else
++               ok 999
++       fi
++}
+
+-# See how we were called.
+-case "$1" in
+-  start)
+-      echo -n "Starting pmud daemon: "
+-      daemon pmud $PMUD_FLAGS
+-      echo
+-      touch /var/lock/subsys/pmud
+-      ;;
+-  stop)
+-      echo -n "Stopping pmud daemon: "
+-      killproc pmud
+-      echo
+-      rm -f /var/lock/subsys/pmud
+-      ;;
+-  status)
+-      status pmud
+-      ;;
+-  *)
+-      echo "Usage: pmud {start|stop|status}"
+-      exit 1
+-esac
++rc_stop()
++{
++       stop_msg
++       if [ -n "$(eval $pid)" ];
++       then
++               kill "$(eval $pid)"
++               rm -f /var/lock/subsys/pmud
++               ok $?
++       else
++               ok 999
++       fi
++}
+
+-exit 0
++rc_exec $1
+diff -Naur pmud-0.10.1.orig/pwrctl pmud-0.10.1/pwrctl
+--- pmud-0.10.1.orig/pwrctl    2001-12-16 10:43:30.000000000 +0100
++++ pmud-0.10.1/pwrctl 2010-05-14 09:53:42.000000000 +0200
+@@ -32,6 +32,29 @@
+ # You can edit this file, but it's better to edit /etc/power/pwrctl-local
+ # as that file will not be overwritten on upgrades.
+ # 
-----------------------------------------------------------------------------
++# Debian add-on: support (sort of) for Core99 machines (Pismo,...). The
++# Pismo can't sleep right now so it will wake again immediately. We spin
++# down the disk on sleep, turn off backlight power and ignore the wakeup.
++#
++# While things are stabilizing, these commands could be used to put the system
++# into absolute minimum power mode. You can use commands of this sort in
++# /etc/init.d/powerfail if needs be (sample powerfail script is in
++# /usr/share/doc/sysvinit/examples/).
++# fblevel 0
++# [ "`cat /proc/ide/hde/model`" != "(none)" ] && hdparm -f -S 1 -Y /dev/hde
++# hdparm -f -S 1 -Y /dev/hda
++# Use this to switch the display back on if the powerfail status is called
++# off:
++# fblevel 12
++#
++# 01/09/13: Recent 2.4 kernel versions support sleep properly, by all
++# accounts. So shut down only if kernel version is insufficient.
++# Sample code to deal with broken airport drivers moved to pwrctl-local
++# (courtesy Tom Rini).
++#
++# 04/02/12: moved fblevel tool to powerpc-utils. Recommend that package in
++# our dependencies.
++#
+ # $Log: pwrctl,v $
+ # Revision 1.1.1.1  2001/12/07 11:31:53  sleemburg
+ # Initial CVS import of the unreleased pmud-0.8 to apmud (new project name
+@@ -57,14 +80,15 @@
+ # 
-----------------------------------------------------------------------------
+ logger=/usr/bin/logger
+ localfun=/etc/power/pwrctl-local
++fundir=/etc/power/event.d
+
+ function do_warn()
+ {
+       local msg="Low battery, system will go down..."
+
+       (
+-      /usr/X11R6/bin/xmessage -center -timeout 15 "$msg" || \
+-      /usr/bin/wall "$msg"
++      /usr/bin/xmessage -center -timeout 15 "$msg" || \
++      echo "$msg" | /usr/bin/wall
+       ) &
+ }
+
+@@ -73,20 +97,21 @@
+       case "$1" in
+       minimum)
+               # min power, set disk to spin down after 1 minute
+-              hdparm -p -S 12 /dev/hda
++              [ -f /sbin/hdparm ] && hdparm -p -S 12 /dev/hda
+       ;;
+       medium)
+-              hdparm -p -S 12 /dev/hda
++              # medium power, set disk to spin down after 2.5 minutes
++              [ -f /sbin/hdparm ] && hdparm -p -S 30 /dev/hda
+       ;;
+       maximum)
+               case "$2" in
+               ac)
+                       # on mains, do not spin down
+-                      hdparm -p -S 0 /dev/hda
++                      [ -f /sbin/hdparm ] && hdparm -p -S 0 /dev/hda
+               ;;
+               *)
+-                      # on battery, set disk to spin down after 5 minute
+-                      hdparm -p -S 60 /dev/hda
++                      # on battery, set disk to spin down after 5 minutes
++                      [ -f /sbin/hdparm ] && hdparm -p -S 60 /dev/hda
+               ;;
+               esac
+       ;;
+@@ -122,6 +147,67 @@
+       esac
+ }
+
++#------------------------------------------------------------------------------
++# This is largely a no-op on iBook or Pismo, as we don't know how to handle
++# the sleep functions yet (with old kernel versions). Instead, we shut down
++# on the spot unless the kernel version is a known good one.
++#------------------------------------------------------------------------------
++
++function pwrctl_Core99()
++{
++      case "$1" in
++      minimum)
++              # min power, set disk to spin down after 1 minute
++              [ -f /sbin/hdparm ] && hdparm -p -S 12 /dev/hda
++      ;;
++      medium)
++              # medium power, set disk to spin down after 2.5 minutes
++              [ -f /sbin/hdparm ] && hdparm -p -S 30 /dev/hda
++      ;;
++      maximum)
++              case "$2" in
++              ac)
++                      # on mains, do not spin down
++                      [ -f /sbin/hdparm ] && hdparm -p -S 0 /dev/hda
++              ;;
++              *)
++                      # on battery, set disk to spin down after 5 minutes
++                      [ -f /sbin/hdparm ] && hdparm -p -S 60 /dev/hda
++              ;;
++              esac
++      ;;
++      warning)
++              do_warn
++      ;;
++      lid-closed)
++      ;;
++      lid-opened)
++      ;;
++      sleep)
++              # We may end up here if someone closed the lid ...
++              # SIGPWR can be sent to init anyway with -s option, do the only
++              # safe thing for now: shut the hell down on 2.2 kernels, or 
anything
++              # below a known safe 2.4 version.
++              KVER=`uname -r`
++              case "$KVER" in
++              2.2.*|2.3.*|2.4.[1-7]|2.4.[1-7]-*)
++                      $logger -p daemon.error -t pwrctl "$0: insufficient 
kernel verison - sleep function not implemented, shutting down!"
++                      echo "Kernel does not support sleep, shutting down!" | 
/usr/bin/wall
++                      /sbin/shutdown -h now
++                      ;;
++              *)
++                      ;;
++              esac
++      ;;
++      wakeup)
++              # maybe force wakeup of media bay devices?
++      ;;
++      *)
++              $logger -p daemon.error -t pwrctl "$0: invalid arg $1"
++      ;;
++      esac
++}
++
+ # 
-----------------------------------------------------------------------------
+ # On the 3400, for minimum power, we put the CPU into nap mode
+ # (rather than doze mode) when it is idle.  This reduces power
+@@ -135,14 +221,14 @@
+       case "$1" in
+       minimum)
+               ifconfig eth0 down
+-              hdparm -d0 -S 12 /dev/hda
+-              hdparm -d0 /dev/hdc
++              [ -f /sbin/hdparm ] && hdparm -d0 -S 12 /dev/hda
++              [ "`cat /proc/ide/hdc/model`" != "(none)" ] && [ -f 
/sbin/hdparm ] && hdparm -d0 /dev/hdc
+               echo 1 >/proc/sys/kernel/powersave-nap
+       ;;
+       medium)
+               echo 0 >/proc/sys/kernel/powersave-nap
+-              hdparm -d1 -p -S 12 /dev/hda
+-              hdparm -d1 /dev/hdc
++              [ -f /sbin/hdparm ] && hdparm -d1 -p -S 30 /dev/hda
++              [ "`cat /proc/ide/hdc/model`" != "(none)" ] && [ -f 
/sbin/hdparm ] && hdparm -d1 /dev/hdc
+               ifconfig eth0 up
+       ;;
+       maximum)
+@@ -150,14 +236,14 @@
+               case "$2" in
+               ac)
+                       # on mains, do not spin down
+-                      hdparm -d1 -p -S 0 /dev/hda
++                      [ -f /sbin/hdparm ] && hdparm -d1 -p -S 0 /dev/hda
+               ;;
+               *)
+-                      # on battery, set disk to spin down after 5 minute
+-                      hdparm -d1 -p -S 60 /dev/hda
++                      # on battery, set disk to spin down after 5 minutes
++                      [ -f /sbin/hdparm ] && hdparm -d1 -p -S 60 /dev/hda
+               ;;
+               esac
+-              hdparm -d1 /dev/hdc
++              [ "`cat /proc/ide/hdc/model`" != "(none)" ] && [ -f 
/sbin/hdparm ] && hdparm -d1 /dev/hdc
+               ifconfig eth0 up
+       ;;
+       warning)
+@@ -198,9 +284,37 @@
+       esac
+ }
+
++for fun in $fundir/* ; do
++      [ -x $fun ] && {
++              case $1 in
++                      sleep)
++                              $logger -p daemon.info -t pwrctl "calling $fun 
suspend $2"
++                              $fun suspend $2
++                      ;;
++                      wakeup)
++                              $logger -p daemon.info -t pwrctl "calling $fun 
resume $2"
++                              $fun resume $2
++                      ;;
++                      minimum)
++                              $logger -p daemon.info -t pwrctl "calling $fun 
powersave $2"
++                              $fun powersave $2
++                      ;;
++                      medium)
++                              $logger -p daemon.info -t pwrctl "calling $fun 
custom $2"
++                              $fun custom $2
++                      ;;
++                      maximum)
++                              $logger -p daemon.info -t pwrctl "calling $fun 
performance $2"
++                              $fun performance $2
++                      ;;
++              esac
++      }
++done
++
+ case "$PMUVERSION" in
+-9)    pwrctl_3400 $1 $2 ;;
+-1[012])       pwrctl_G3   $1 $2 ;;
++9)    pwrctl_3400   $1 $2 ;;
++10|11)        pwrctl_G3     $1 $2 ;;
++12)   pwrctl_Core99 $1 $2 ;;
+ *)
+       $logger -p daemon.error -t pwrctl "no function for PMU $PMUVERSION"
+ ;;
+diff -Naur pmud-0.10.1.orig/snooze.8 pmud-0.10.1/snooze.8
+--- pmud-0.10.1.orig/snooze.8  2001-12-07 12:31:47.000000000 +0100
++++ pmud-0.10.1/snooze.8       2010-05-14 09:42:33.000000000 +0200
+@@ -21,13 +21,17 @@
+ .Dt SNOOZE 8
+ .Os "LinuxPPC pmud"
+ .Sh NAME
+-.Nm snooze
++.Nm snooze,apm
+ .Nd will put an Apple Macintosh Powerbook into sleep.
+ .Sh SYNOPSIS
+ .Nm snooze
+ .Op Fl hv
+ .Op Fl f
+ .Op Fl p Ar port
++.Nm apm
++.Op Fl hv
++.Op Fl f
++.Op Fl p Ar port
+ .Sh DESCRIPTION
+ .Nm Snooze
+ is a program, which is usefull only for Apple Macintosh Powerbooks.
+@@ -49,6 +53,11 @@
+ you will not get the benefits of all the facilities that
+ .Nm pmud
+ has to offer.
++.Nm apm
++(/usr/bin/apm) is provided as a symbolic link to
++.Nm snooze
++for limited apmd compatibility to use by ia32 centric scripts from other
++packages.
+ .Sh BUGS AND CHANGE REQUESTS
+ Please email your bug reports or change requests to \fB<[email protected]>\fP.
+ .Sh FILES
+diff -Naur pmud-0.10.1.orig/wakebay.8 pmud-0.10.1/wakebay.8
+--- pmud-0.10.1.orig/wakebay.8 1970-01-01 01:00:00.000000000 +0100
++++ pmud-0.10.1/wakebay.8      2010-05-14 09:43:46.000000000 +0200
+@@ -0,0 +1,31 @@
++.\" Copyright (c) 2000 Stephan Leemburg
++.\"
++.Dd November 18, 2005
++.Dt WAKEBAY 8
++.Os "LinuxPPC pmud"
++.Sh NAME
++.Nm wakebay
++.Nd will wake up Apple PowerBook Mediabay devices
++.Sh SYNOPSIS
++.Nm wakebay
++.Op Ar /dev/<device>
++.Sh DESCRIPTION
++.Nm wakebay
++is a program, which is useful only for Apple Macintosh Powerbooks.
++On invocation, it will wake up the specified Mediabay device that was
++powered down by sleep.
++Waking up the device involves sending an IOCTL to the device to force it
++to check for a media change, thus revalidating the device info. Newer
++kernels do this internally so
++.Nm wakebay
++should only be needed on old kernel versions.
++.Sh BUGS AND CHANGE REQUESTS
++Please email your bug reports or change requests to \fB<[email protected]>\fP.
++.Sh FILES
++.nf
++/dev/<device>
++.fi
++.Sh AUTHORS
++Joseph Palani Garcia <[email protected]>
++.Sh SEE ALSO
++.Xr pmud(8)
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to