On my new 15" powerbook g4, pbbuttonsd fails to properly detect the correct i2c
device for the ambient light sensor and also the keyboard illumination
controls.
Both the unmasked 0.6.1 and masked 0.6.5 versions have the same problem. When
it goes to detect which device to use, it starts with dev 0 and works up.
/dev/i2c-0 looks valid but the ambient light sensor always reports a light
level of 0.
When I change the code so that it starts searching at dev 1, it discovers the
correct device at /dev/i2c-4. The ambient light sensor reports valid data and
the keyboard illumination works properly.
E.g.:
diff -rNu pbbuttonsd-0.6.5/src/module_pmac.c
pbbuttonsd-0.6.5-jrray/src/module_pmac.c
--- pbbuttonsd-0.6.5/src/module_pmac.c 2004-09-08 13:01:41.000000000 -0700
+++ pbbuttonsd-0.6.5-jrray/src/module_pmac.c 2004-09-18 21:26:35.431804672
-0700
@@ -979,7 +979,7 @@
char i2cdevice[20], buf[4];
int n, fd, rc = -E_NOCHAR;
- for(n=0; n < 256; n++) {
+ for(n=1; n < 256; n++) {
snprintf(i2cdevice, 19, "/dev/i2c-%d", n );
if ((fd = open (i2cdevice, O_RDWR)) >= 0 ) {
if (ioctl (fd, I2C_SLAVE, LMU_ADDR) >= 0 ) {
Based on this mailing list thread:
http://lists.debian.org/debian-powerpc/2004/01/msg00546.html
It seems that some powerbooks require /dev/i2c-4 and some require /dev/i2c-0.
The pbbuttonsd code should probably be modified to make this a
user-configurable option.
- Robert