Added upstream patch from bug #64591 as long as it is not fixed upstream.
authorLars Weiler <pylon@gentoo.org>
Wed, 6 Oct 2004 02:25:05 +0000 (02:25 +0000)
committerLars Weiler <pylon@gentoo.org>
Wed, 6 Oct 2004 02:25:05 +0000 (02:25 +0000)
app-laptop/pbbuttonsd/ChangeLog
app-laptop/pbbuttonsd/Manifest
app-laptop/pbbuttonsd/files/pbbuttonsd-0.6.5-backlight.patch [new file with mode: 0644]
app-laptop/pbbuttonsd/pbbuttonsd-0.6.5.ebuild

index 5ec1bab8ad2b00a31edfb902f8a48468024ffa5b..315d14781d611bf38549f9873a86dc14eccfc700 100644 (file)
@@ -1,6 +1,10 @@
 # ChangeLog for app-laptop/pbbuttonsd
 # Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/app-laptop/pbbuttonsd/ChangeLog,v 1.13 2004/09/15 08:08:40 lu_zero Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-laptop/pbbuttonsd/ChangeLog,v 1.14 2004/10/06 02:25:05 pylon Exp $
+
+  06 Oct 2004; Lars Weiler,,, <lars@gentoo.org>
+  +files/pbbuttonsd-0.6.5-backlight.patch, pbbuttonsd-0.6.5.ebuild:
+  Added upstream patch from bug #64591 as long as it is not fixed upstream.
 
 *pbbuttonsd-0.6.5 (15 Sep 2004)
 
index 886ffb79a9a73a052bfec492e18f6822bcc3d0b0..664454d5a3820ecb6155fb9e0803a0bad0c93cdb 100644 (file)
@@ -1,30 +1,31 @@
-MD5 bfa4fb395018ad44b0cfdc20e0fffdc5 pbbuttonsd-0.4.10a.ebuild 866
-MD5 b9d9bc6dd71b1a0df7cb1f0afe84af03 pbbuttonsd-0.6.5.ebuild 1185
-MD5 239147b8ef438595df52d1efddd7c300 ChangeLog 5705
+MD5 4beca1f850450e8633d9ca947b6d504f ChangeLog 5896
 MD5 9a09f8d531c582e78977dbfd96edc1f2 metadata.xml 164
-MD5 49762f48c7947b0a1b275488167071e0 pbbuttonsd-0.6.1.ebuild 1184
-MD5 7a0083b40a70a94ab9a8c0b39c144d6f pbbuttonsd-0.5.2-r1.ebuild 1302
+MD5 bfa4fb395018ad44b0cfdc20e0fffdc5 pbbuttonsd-0.4.10a.ebuild 866
 MD5 b935813309acc6d3b80e0ab4d3a84bf3 pbbuttonsd-0.5.10-r1.ebuild 1623
-MD5 37cee7809f67cb7209f2992fbefbd8e9 pbbuttonsd-0.5.9.ebuild 1535
+MD5 beb12d1fa8d32d4b661af13b57504e7c pbbuttonsd-0.5.10.ebuild 1582
 MD5 01f5e8033e946275a5c81ec9675a593d pbbuttonsd-0.5.11.ebuild 1620
+MD5 7a0083b40a70a94ab9a8c0b39c144d6f pbbuttonsd-0.5.2-r1.ebuild 1302
 MD5 60ae49e07aaddf6ec0cebcc574f963cb pbbuttonsd-0.5.8.ebuild 1534
-MD5 beb12d1fa8d32d4b661af13b57504e7c pbbuttonsd-0.5.10.ebuild 1582
 MD5 f3484d90b145206f125851f47fc43a11 pbbuttonsd-0.5.9-r1.ebuild 1628
-MD5 09293f5559523b7e2e8a87e6b43af415 files/digest-pbbuttonsd-0.6.5 68
-MD5 888adb1c866daaa6c22e23d07c2367b0 files/digest-pbbuttonsd-0.5.9-r1 68
+MD5 37cee7809f67cb7209f2992fbefbd8e9 pbbuttonsd-0.5.9.ebuild 1535
+MD5 49762f48c7947b0a1b275488167071e0 pbbuttonsd-0.6.1.ebuild 1184
+MD5 92aab852b0baca6dc852f7f56e185673 pbbuttonsd-0.6.5.ebuild 1224
+MD5 c6901eb0354ffab93115cf7eb49935c8 files/digest-pbbuttonsd-0.4.10a 70
 MD5 a25484ee7150c343f693fb3b570f3403 files/digest-pbbuttonsd-0.5.10 69
+MD5 a25484ee7150c343f693fb3b570f3403 files/digest-pbbuttonsd-0.5.10-r1 69
 MD5 e3ce7dc625651b0249b338997267d288 files/digest-pbbuttonsd-0.5.11 69
-MD5 888adb1c866daaa6c22e23d07c2367b0 files/digest-pbbuttonsd-0.5.9 68
-MD5 b5980a206e08839a9e1303c95353a223 files/pbbuttonsd-0.5.10-compat.patch 1121
+MD5 459c829a59fb5afde8ec96244abbcd68 files/digest-pbbuttonsd-0.5.2-r1 68
 MD5 68d74820f8f82d459c92e4d79eb21e65 files/digest-pbbuttonsd-0.5.8 68
-MD5 e87049121a8371a7173cb9aa7c5b167d files/pbbuttonsd.rc6 444
+MD5 888adb1c866daaa6c22e23d07c2367b0 files/digest-pbbuttonsd-0.5.9 68
+MD5 888adb1c866daaa6c22e23d07c2367b0 files/digest-pbbuttonsd-0.5.9-r1 68
 MD5 a1afb13bbd6ccca4f348829ea9825df6 files/digest-pbbuttonsd-0.6.1 68
+MD5 09293f5559523b7e2e8a87e6b43af415 files/digest-pbbuttonsd-0.6.5 68
+MD5 b5980a206e08839a9e1303c95353a223 files/pbbuttonsd-0.5.10-compat.patch 1121
+MD5 1f7eb1378520b49ca348255b4c449224 files/pbbuttonsd-0.5.11-compat.patch 1123
 MD5 56622898666491660d75995555e987fa files/pbbuttonsd-0.5.2-replace_pmud.patch 715
+MD5 25e2467e31c724e2756a6a2e49877119 files/pbbuttonsd-0.6.1-compat.patch 752
 MD5 b11792be9a7da132df93b09825c07496 files/pbbuttonsd-0.6.5-compat.patch 843
-MD5 459c829a59fb5afde8ec96244abbcd68 files/digest-pbbuttonsd-0.5.2-r1 68
 MD5 831fe80c3eeb273f204b8a41f7ac2810 files/pbbuttonsd-compat.patch 1070
-MD5 a25484ee7150c343f693fb3b570f3403 files/digest-pbbuttonsd-0.5.10-r1 69
-MD5 25e2467e31c724e2756a6a2e49877119 files/pbbuttonsd-0.6.1-compat.patch 752
 MD5 5e0e595a5324de2768dffa2877b5935c files/pbbuttonsd.rc5 503
-MD5 c6901eb0354ffab93115cf7eb49935c8 files/digest-pbbuttonsd-0.4.10a 70
-MD5 1f7eb1378520b49ca348255b4c449224 files/pbbuttonsd-0.5.11-compat.patch 1123
+MD5 e87049121a8371a7173cb9aa7c5b167d files/pbbuttonsd.rc6 444
+MD5 3f1fa06cde822b9aaa0b6ce79147c65e files/pbbuttonsd-0.6.5-backlight.patch 8318
diff --git a/app-laptop/pbbuttonsd/files/pbbuttonsd-0.6.5-backlight.patch b/app-laptop/pbbuttonsd/files/pbbuttonsd-0.6.5-backlight.patch
new file mode 100644 (file)
index 0000000..6295f82
--- /dev/null
@@ -0,0 +1,240 @@
+diff -Naur pbbuttonsd-0.6.5/src/input_manager.c pbbuttonsd-0.6.5-fixed/src/input_manager.c
+--- pbbuttonsd-0.6.5/src/input_manager.c       Fri Jul 16 18:52:02 2004
++++ pbbuttonsd-0.6.5-fixed/src/input_manager.c Fri Sep 24 17:25:51 2004
+@@ -204,7 +204,7 @@
+               sprintf(filename, "/dev/input/event%d", n);
+               if ((fd = open(filename, O_RDONLY)) >= 0) {
+                       ioctl(fd, EVIOCGBIT(0, EV_MAX), bit);
+-                  if (test_bit(EV_KEY, bit) && test_bit(EV_REP, bit)) {
++                      if (test_bit(EV_KEY, bit) && test_bit(EV_REP, bit)) {
+                               ioctl(fd, EVIOCGID, id);
+                               if (id[ID_PRODUCT] != base->evdevs[m].product ||
+                                       id[ID_VENDOR]  != base->evdevs[m].vendor) {
+diff -Naur pbbuttonsd-0.6.5/src/module_pmac.c pbbuttonsd-0.6.5-fixed/src/module_pmac.c
+--- pbbuttonsd-0.6.5/src/module_pmac.c Wed Sep  8 22:01:41 2004
++++ pbbuttonsd-0.6.5-fixed/src/module_pmac.c   Fri Sep 24 16:40:41 2004
+@@ -50,6 +50,7 @@
+       int version;     /* PMU version */
+       char *identity;  /* Identity string of this laptop */
+       struct modflags_pmac flags;
++      int flagschanged;        /* PMU flags that have changed recently */
+       int oharevolbutton;      /* level of volume button on OHARE PBs scaled to 0..100 */
+       int oharebrightbutton;   /* level of brightness button on OHARE PBs scaled to 0..15 */
+ 
+@@ -144,8 +145,10 @@
+       base->identity = identitystring;
+       ioctl(base->fd_pmu, PMU_IOC_CAN_SLEEP, &val);
+       base->flags.sleepsupported = val == 1 ? 1 : 0; /* check if sleep is supported on this system */
+-      val = pmac_update_flags ();
+-      pmac_update_batteryinfo (val);
++
++      pmac_update_flags ();
++      pmac_update_batteryinfo ();
++      base->flagschanged = 0;
+ 
+       /* Every frame buffer driver could register a backlight controller,
+        * but only the right one is accepted. Verification is done by checking
+@@ -228,7 +231,6 @@
+ pmac_secure (struct tagitem *taglist)
+ {
+       struct moddata_pmac *base = &modbase_pmac;
+-      int cf;
+       
+       if (base->flags.set_tpmode == 1) {
+               base->flags.set_tpmode = 0;
+@@ -243,12 +245,12 @@
+                       process_queue_single (CONFIGQUEUE, TAG_PREPAREFORSLEEP, 0);
+ #ifdef WITH_PMUD
+                       activate_sleepmode ();
+-                      cf = pmac_update_flags ();
++                      base->flagschanged = pmac_update_flags ();
+ #else
+                       do {
+                           activate_sleepmode ();
+-                          cf = pmac_update_flags ();
+-                      } while (cf != -1 && base->flags.coveropen == 0);
++                          base->flagschanged = pmac_update_flags ();
++                      } while (base->flags.coveropen == 0);
+ #endif
+                       base->timeleft = 7200;       /* reset time value so that the */
+                               /* filter approximate the real value from top. Otherwise */
+@@ -257,7 +259,7 @@
+                               /* thresholds quick enough. This problem occours only  */
+                               /* after wakeup on battery after the battery had been */
+                               /* recharged during sleep.                           */
+-                      pmac_update_batteryinfo (cf);
++                      pmac_update_batteryinfo ();
+                       process_queue_single (CONFIGQUEUE, TAG_WAKEUPFROMSLEEP, 0);
+                       base->batlog_cycle = batlog_setup();
+               }
+@@ -441,15 +443,16 @@
+ {
+       struct moddata_pmac *base = &modbase_pmac;
+       struct tagitem args[6];
+-      int val, cf;
++      int val;
+ 
+       taglist_init (args);
+ 
+       val = base->timeleft;
+-      cf = pmac_update_flags ();      /* ac power and cover status */
+-      pmac_update_batteryinfo (cf);
++      if (base->flagschanged == 0)     /* check if anybody else has already read the flags */
++              base->flagschanged = pmac_update_flags (); /* if not, get ac power and cover status */
++      pmac_update_batteryinfo ();
+ 
+-      if (cf & PMU_ENV_AC_POWER) {
++      if (base->flagschanged & PMU_ENV_AC_POWER) {
+               taglist_add (args, TAG_POWERCHANGED, base->flags.ac_power);
+               if (!base->flags.ac_power)      /* running on Battery */
+                       base->batlog_cycle++;   /* then increase cycle */
+@@ -460,7 +463,7 @@
+       }
+ 
+ #ifndef WITH_PMUD
+-      if ((cf != -1) && (cf & PMU_ENV_LID_CLOSED))
++      if (base->flagschanged & PMU_ENV_LID_CLOSED)
+               taglist_add (args, TAG_COVERSTATUS, base->flags.coveropen);
+ #endif
+       if (base->version == OHARE_PMU) {         /* PowerBook 3400, etc */
+@@ -484,6 +487,7 @@
+ 
+       if (args[0].tag != TAG_END)
+               process_queue (CONFIGQUEUE, args);  /* distribute changes to other modules */
++      base->flagschanged = 0;
+ }
+ 
+ 
+@@ -544,7 +548,7 @@
+  * ac_power, bat_present and charging.
+  */
+ void
+-pmac_update_batteryinfo (int cf)
++pmac_update_batteryinfo ()
+ {
+       struct moddata_pmac *base = &modbase_pmac;
+       FILE *fd;
+@@ -552,26 +556,6 @@
+       int val, n, syscurrent, time_rem = 0;
+       int charge, chargemax, current, voltage, timeleft[MAX_BATTERIES];
+ 
+-      /* use /proc/pmu/info as fallback, if PMU_GET_COVER did't work
+-       * As I know this has not happend yet and it is doubtable that
+-       * /proc/pmu/info will work correctly in this case. So this
+-       * routine may be removed in future versions.
+-       */
+-      if (cf == -1) {
+-              print_error(_("WARNING: Couldn't get AC plug status from hardware, use /proc/pmu/info as fallback.\n"));
+-              print_error(_("         Please send a message to the author if this ever happens.\n"));
+-              if ((fd = fopen ("/proc/pmu/info","r"))) {
+-                      while (fgets (buffer, sizeof (buffer), fd))
+-                              if ((token = strtok (buffer,":\n"))) {
+-                                      if (!strncmp ("AC Power", token, 8))
+-                                              base->flags.ac_power = atoi (strtok(0,":\n"));
+-                                      else
+-                                              strtok (0,":\n");
+-                              }
+-                      fclose(fd);
+-              }
+-      }
+-
+       syscurrent = 0;
+       for (n=0; n < MAX_BATTERIES; n++) {
+               charge = chargemax = current = voltage = timeleft[n] = 0;
+@@ -637,6 +621,38 @@
+       }
+ }
+ 
++/* use /proc/pmu/info as fallback, if PMU_GET_COVER did't work
++ * As I know this has not happend yet and it is doubtable that
++ * /proc/pmu/info will work correctly in this case. So this
++ * routine may be removed in future versions.
++ */   
++int
++pmac_get_procac ()
++{
++      FILE *fd;
++      char buffer[100], *token;
++      int ac = 0;  /* return battery if anything fails */
++
++      print_error(_("WARNING: Couldn't get AC plug status from hardware, use /proc/pmu/info as fallback.\n"));
++      print_error(_("         Please send a message to the author if this ever happens.\n"));
++      if ((fd = fopen ("/proc/pmu/info","r"))) {
++              while (fgets (buffer, sizeof (buffer), fd))
++                      if ((token = strtok (buffer,":\n"))) {
++                              if (!strncmp ("AC Power", token, 8))
++                                      ac = atoi (strtok(0,":\n"));
++                              else
++                                      strtok (0,":\n");
++                      }
++              fclose(fd);
++      }
++      return ac;
++}
++
++/* This funtion gets some important flags from the PMU driver. If the
++ * driver doesn't support the ioctl or reports an error, power source
++ * will be read from /proc/pmu/info as fallback, so that power source
++ * should always be set correctly.
++ */
+ int
+ pmac_update_flags()
+ {
+@@ -654,7 +670,8 @@
+               envnew  = base->flags.ac_power ? PMU_ENV_AC_POWER : 0;
+               envnew |= base->flags.coveropen ? PMU_ENV_LID_CLOSED : 0;
+       } else
+-              return -1;
++              base->flags.ac_power = pmac_get_procac();
++      
+       return (envold ^ envnew);
+ }
+ 
+@@ -968,7 +985,11 @@
+ 
+ /* This function tries to find the I2C device that controls the keyboard
+  * illumination and the ambient light sensor used in alluminum PowerBooks
+- * It returns the device number on success, otherwise a negative error code
++ * It returns the device number on success, otherwise a negative error code.
++ * The loop starts with device 4 because that's the correct device on
++ * 17" alluminum PowerBooks. Device 0 could be errornous detected because
++ * the function uses only circumstantial evidence to detect the correct
++ * device.
+  */
+ int
+ lmu_find_bus ()
+@@ -979,8 +1000,8 @@
+       char i2cdevice[20], buf[4];
+       int n, fd, rc = -E_NOCHAR;
+ 
+-      for(n=0; n < 256; n++) {
+-              snprintf(i2cdevice, 19, "/dev/i2c-%d", n );
++      for(n=4; n < 260; n++) {
++              snprintf(i2cdevice, 19, "/dev/i2c-%d", (n & 255) );
+               if ((fd = open (i2cdevice, O_RDWR)) >= 0 ) {
+                       if (ioctl (fd, I2C_SLAVE, LMU_ADDR) >= 0 ) {
+                               if (read (fd, buf, 4) == 4 ) {
+@@ -988,8 +1009,8 @@
+                                       rc = n;
+                                       break;
+                               }
+-                      } else
+-                              close (fd);
++                      }
++                      close (fd);
+               } else if (errno == ENODEV) {
+                       rc = -E_NOCHAR;
+                       break;
+diff -Naur pbbuttonsd-0.6.5/src/module_pmac.h pbbuttonsd-0.6.5-fixed/src/module_pmac.h
+--- pbbuttonsd-0.6.5/src/module_pmac.h Fri Aug 27 08:49:31 2004
++++ pbbuttonsd-0.6.5-fixed/src/module_pmac.h   Thu Sep 23 16:18:26 2004
+@@ -86,7 +86,8 @@
+ void pmac_pmu_handler (int fd);
+ void pmac_timer (struct tagitem *taglist);
+ 
+-void pmac_update_batteryinfo (int cf);
++void pmac_update_batteryinfo ();
++int pmac_get_procac ();
+ int pmac_update_flags ();
+ void activate_sleepmode ();
+ int pmac_get_lcdbacklight();
index bef34de7739b57731d826d1edd120ed1d909d9bf..2e8d4d5dd0d98c33d04dcdd4b23a958de8a47acd 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/app-laptop/pbbuttonsd/pbbuttonsd-0.6.5.ebuild,v 1.1 2004/09/15 08:08:40 lu_zero Exp $
+# $Header: /var/cvsroot/gentoo-x86/app-laptop/pbbuttonsd/pbbuttonsd-0.6.5.ebuild,v 1.2 2004/10/06 02:25:05 pylon Exp $
 
 inherit eutils
 
@@ -20,6 +20,7 @@ RDEPEND=""
 src_unpack() {
        unpack ${A}
        epatch ${FILESDIR}/${P}-compat.patch
+       epatch ${FILESDIR}/${P}-backlight.patch
 }
 
 src_compile() {