Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 64591 - pbbuttonsd ambient light sensor fix
Summary: pbbuttonsd ambient light sensor fix
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: PPC Linux
: High normal (vote)
Assignee: PPC Porters
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-18 22:21 UTC by J Robert Ray
Modified: 2004-10-05 19:29 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
upstream patch (pbbuttonsd.patch,8.12 KB, patch)
2004-09-25 04:17 UTC, Pieter Van den Abeele (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description J Robert Ray 2004-09-18 22:21:26 UTC
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
Comment 1 Douglas Russell (RETIRED) gentoo-dev 2004-09-20 05:02:42 UTC
This should be reported upstream.
Comment 2 Pieter Van den Abeele (RETIRED) gentoo-dev 2004-09-22 14:40:11 UTC
Puggy, can you apply this one-line patch in cvs and report upstream?
Comment 3 J Robert Ray 2004-09-23 00:13:55 UTC
I'm fairly certain that applying my patch will break pbbuttonsd for some people while fixing it for others.  The upstream developer will probably know better how to fix it for everyone.
Comment 4 Pieter Van den Abeele (RETIRED) gentoo-dev 2004-09-24 15:25:51 UTC
I've pointed the upstream developer to this bug & patch. Thnxs for the feedback.
Comment 5 Pieter Van den Abeele (RETIRED) gentoo-dev 2004-09-25 04:17:32 UTC
Created attachment 40364 [details, diff]
upstream patch

Upstream test request
Comment 6 Lars Weiler (RETIRED) gentoo-dev 2004-10-05 19:29:57 UTC
I added the patch as long as it is not resolved upstream.