[Pommed-commits] [SCM] pommed - hotkeys handler for Apple laptops branch, master, updated. 1.29-4-g23a2c0c

Julien BLACHE jb at jblache.org
Thu Oct 22 18:24:09 UTC 2009


The following commit has been merged in the master branch:
commit 23a2c0c931d4c438245973643c42222efb2bb002
Author: Julien BLACHE <jb at jblache.org>
Date:   Thu Oct 22 20:23:44 2009 +0200

    Fix sysfs backlight driver to handle > 3-digit values

diff --git a/ChangeLog b/ChangeLog
index e4d1a93..eba74c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@ ChangeLog for pommed
 
 version 1.30:
 	- pommed: fix a crasher in the i2c probe routine on pmac.
+	- pommed: fix sysfs backlight driver to handle > 3-digit values.
 
 version 1.29:
 	- pommed: add support for newer nvidia backlight driver which
diff --git a/pommed/sysfs_backlight.c b/pommed/sysfs_backlight.c
index c1e8536..52d641a 100644
--- a/pommed/sysfs_backlight.c
+++ b/pommed/sysfs_backlight.c
@@ -101,7 +101,7 @@ sysfs_backlight_get(void)
 {
   int fd;
   int n;
-  char buffer[4];
+  char buffer[8];
 
   if (bck_driver == SYSFS_DRIVER_NONE)
     return 0;
@@ -114,7 +114,8 @@ sysfs_backlight_get(void)
       return 0;
     }
 
-  n = read(fd, buffer, sizeof(buffer) -1);
+  memset(buffer, 0, sizeof(buffer));
+  n = read(fd, buffer, sizeof(buffer) - 1);
   if (n < 1)
     {
       logmsg(LOG_WARNING, "Could not read sysfs actual_brightness node");
@@ -132,7 +133,7 @@ sysfs_backlight_get_max(void)
 {
   int fd;
   int n;
-  char buffer[4];
+  char buffer[8];
 
   if (bck_driver == SYSFS_DRIVER_NONE)
     return 0;
@@ -145,7 +146,8 @@ sysfs_backlight_get_max(void)
       return 0;
     }
 
-  n = read(fd, buffer, sizeof(buffer) -1);
+  memset(buffer, 0, sizeof(buffer));
+  n = read(fd, buffer, sizeof(buffer) - 1);
   if (n < 1)
     {
       logmsg(LOG_WARNING, "Could not read sysfs max_brightness node");

-- 
pommed - hotkeys handler for Apple laptops



More information about the Pommed-commits mailing list