diff options
| author | Alex Murray <murray.alex@gmail.com> | 2009-01-12 22:52:02 +0100 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2009-01-12 22:52:02 +0100 |
| commit | aa7da346bd6e4388e186fc40b8dcb9ef90127302 (patch) | |
| tree | d50f1ce94dfeca5692cffd7f34c0b60cbe7da1b5 | |
| parent | dc4adff09d3dd32b048645008b67d53887047c00 (diff) | |
Fix light sensor readings on newer MacBooks
The light sensors ALV0 and ALV1 on newer MacBooks (early 2008 and
later) changed to report 10 bytes instead the earlier 6, and the
sensor encoding subsequently changed. As a result, the reported light
sensors readings are much too low.
From experiments leading up to this patch, it seems only the ALV0 is
reporting data, and the most useful value therein is a 10-bit
big-endian value at offset 6. This suggests that a new protocol was
added as a backward-compatible replacement on top of the old one.
This patch makes applesmc report the improved light sensor reading for
the new machines, on a scale in conformance with earlier ones.
This patch has also been sent to kernel.org
Signed-off-by: Alex Murray <murray.alex@gmail.com>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | debian/changelog | 6 | ||||
| -rw-r--r-- | debian/postinst | 2 | ||||
| -rw-r--r-- | debian/postrm | 2 | ||||
| -rw-r--r-- | debian/prerm | 2 | ||||
| -rwxr-xr-x | debian/rules | 2 | ||||
| -rw-r--r-- | usr/src/dkms_source_tree/applesmc.c | 5 | ||||
| -rw-r--r-- | usr/src/dkms_source_tree/dkms.conf | 2 |
8 files changed, 17 insertions, 6 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | NAME = applesmc | 1 | NAME = applesmc |
| 2 | VERSION = 0.14.1 | 2 | VERSION = 0.14.2 |
| 3 | SRC = usr/src | 3 | SRC = usr/src |
| 4 | 4 | ||
| 5 | TARBALL = $(NAME)-$(VERSION).dkms.tar.gz | 5 | TARBALL = $(NAME)-$(VERSION).dkms.tar.gz |
diff --git a/debian/changelog b/debian/changelog index f3c0464..680ced9 100644 --- a/debian/changelog +++ b/debian/changelog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | applesmc-dkms (0.14.2) unstable; urgency=low | ||
| 2 | |||
| 3 | * Fix light sensor readings on newer MacBooks | ||
| 4 | |||
| 5 | -- Alex Murray <murray.alex@gmail.com> Sun, 11 Jan 2009 20:42:03 +1030 | ||
| 6 | |||
| 1 | applesmc-dkms (0.14.1) unstable; urgency=low | 7 | applesmc-dkms (0.14.1) unstable; urgency=low |
| 2 | 8 | ||
| 3 | * Add support for MacBook Air 2 | 9 | * Add support for MacBook Air 2 |
diff --git a/debian/postinst b/debian/postinst index 6351864..89c94eb 100644 --- a/debian/postinst +++ b/debian/postinst | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | set -e | 3 | set -e |
| 4 | 4 | ||
| 5 | NAME=applesmc | 5 | NAME=applesmc |
| 6 | VERSION=0.14.1 | 6 | VERSION=0.14.2 |
| 7 | 7 | ||
| 8 | case "$1" in | 8 | case "$1" in |
| 9 | configure) | 9 | configure) |
diff --git a/debian/postrm b/debian/postrm index 454faea..7f94688 100644 --- a/debian/postrm +++ b/debian/postrm | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | NAME=applesmc | 3 | NAME=applesmc |
| 4 | VERSION=0.14.1 | 4 | VERSION=0.14.2 |
| 5 | 5 | ||
| 6 | set -e | 6 | set -e |
| 7 | 7 | ||
diff --git a/debian/prerm b/debian/prerm index 05315a4..a6cf719 100644 --- a/debian/prerm +++ b/debian/prerm | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | NAME=applesmc | 3 | NAME=applesmc |
| 4 | VERSION=0.14.1 | 4 | VERSION=0.14.2 |
| 5 | 5 | ||
| 6 | set -e | 6 | set -e |
| 7 | 7 | ||
diff --git a/debian/rules b/debian/rules index c829ec6..9fdb303 100755 --- a/debian/rules +++ b/debian/rules | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | #export DH_VERBOSE=1 | 5 | #export DH_VERBOSE=1 |
| 6 | 6 | ||
| 7 | NAME=applesmc | 7 | NAME=applesmc |
| 8 | VERSION=0.14.1 | 8 | VERSION=0.14.2 |
| 9 | 9 | ||
| 10 | configure: configure-stamp | 10 | configure: configure-stamp |
| 11 | configure-stamp: | 11 | configure-stamp: |
diff --git a/usr/src/dkms_source_tree/applesmc.c b/usr/src/dkms_source_tree/applesmc.c index acd818f..ebf4c03 100644 --- a/usr/src/dkms_source_tree/applesmc.c +++ b/usr/src/dkms_source_tree/applesmc.c | |||
| @@ -590,6 +590,11 @@ static ssize_t applesmc_light_show(struct device *dev, | |||
| 590 | } | 590 | } |
| 591 | 591 | ||
| 592 | ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, buffer, data_length); | 592 | ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, buffer, data_length); |
| 593 | /* newer macbooks report a single 10-bit bigendian value */ | ||
| 594 | if (data_length == 10) { | ||
| 595 | left = be16_to_cpu(*(__be16 *)(buffer + 6)) >> 2; | ||
| 596 | goto out; | ||
| 597 | } | ||
| 593 | left = buffer[2]; | 598 | left = buffer[2]; |
| 594 | if (ret) | 599 | if (ret) |
| 595 | goto out; | 600 | goto out; |
diff --git a/usr/src/dkms_source_tree/dkms.conf b/usr/src/dkms_source_tree/dkms.conf index 06934cf..a94c408 100644 --- a/usr/src/dkms_source_tree/dkms.conf +++ b/usr/src/dkms_source_tree/dkms.conf | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | NAME=applesmc | 1 | NAME=applesmc |
| 2 | VERSION=0.14.1 | 2 | VERSION=0.14.2 |
| 3 | PACKAGE_NAME="$NAME" | 3 | PACKAGE_NAME="$NAME" |
| 4 | PACKAGE_VERSION="$VERSION" | 4 | PACKAGE_VERSION="$VERSION" |
| 5 | MAKE[0]="make -C ${kernel_source_dir} | 5 | MAKE[0]="make -C ${kernel_source_dir} |
