Created attachment 15846 [details] Hal log Macbook brightness adjustment does not work because addon-macbook-backlight fails to mmap. I have tested this under Ubuntu Hardy and Fedora Rawhide. It worked in Hardy with hal 0.5.10+git20080301-1ubuntu3 and failed to work with hal 0.5.11~rc2-1ubuntu1. Fedora Rawhide (as of today) didn't work either so I think the bug is in hal itself. See https://bugs.launchpad.net/ubuntu/+source/hal/+bug/206921 for more info. hal.log created with: sudo /etc/init.d/hald stop sudo hald --verbose=yes --daemon=no 2>&1 | tee /tmp/hal.log [snippet] 21:13:46.595 [D] hald_dbus.c:3294: udi=/org/freedesktop/Hal/devices/macbook_backlight 21:13:46.595 [I] hald_dbus.c:3320: AddonIsReady on udi '/org/freedesktop/Hal/devices/macbook_backlight' 21:13:46.595 [D] hald_dbus.c:3589: singleton_addon_is_ready 21:13:46.595 [I] hald_dbus.c:3616: SingletonAddonIsReady recieved for 'hald-addon-input' 21:13:46.595 [D] hald_dbus.c:3629: Signalling device added for queued devices 21:13:46.595 [D] hald_dbus.c:3633: device added for '/org/freedesktop/Hal/devices/computer_logicaldev_input' 21:13:46.622 [D] hald_dbus.c:3429: singleton_signal_device_changed about to send message to connection 0x80b32e0 ** ERROR **: failed to mmap aborting... 21:13:46.622 [I] hald_runner.c:110: runner_server_message_handler: destination=(null) obj_path=/org/freedesktop/HalRunner interface=org.freedesktop.HalRunner method=StartedProcessExited 21:13:46.622 [I] hald_runner.c:125: Previously started process with pid 11401 exited 21:13:46.622 [I] hald.c:84: in addon_terminated for udi=/org/freedesktop/Hal/devices/macbook_backlight 21:13:46.622 [E] device.c:1705: In hal_device_inc_num_ready_addons for udi=/org/freedesktop/Hal/devices/macbook_backlight but all addons are already ready!
Created attachment 15847 [details] [review] This patch makes it work again If I revert the changes in hal 0.5.11~rc2-1ubuntu1 in addon-macbook-backlight.c it works again. Couldn't apply the same fix to -ubuntu5 thought. I think the introduction of policykit broke things. Don't know why this can make mmap fail.
Your patch can't work if you compile HAL without ConsoleKit/PolicyKit support. As soon as you compile it with the support the whole fail to compile. Btw. it does not happen on my testmachine, at least with x86_64, but we have a report on SUSE for a MacBook1,1 with ix86
Oh, I just tried the patch for that version. Seems that when you enable ConsoleKit/PolicyKit it needs a global LibHalContext *halctx and that somehow breaks mmap. Yep, Suse bug #380075 is definitely the same one. Should have added that my machine is also a Macbook1,1 i686. Why doesn't this happen on x86_64?
@Ryan: You wrote the code, do you have any idea what happens here?
Created attachment 15945 [details] [review] add better debug output Could you please try the patch and paste what error it prints?
Finally had time to check this (needed to #include <../../logger.h> though) Sadly this doesn't give me any more clues: 21:18:43.394 [E] addon-macbook-backlight.c:145: failed to mmap: errno: 'Success' ** ERROR **: failed to gain access to the video card aborting... Looks weird,register_page looks like it is still equal to MAP_FAILED. Could this be a compiler bug?
Here is a patch that works for me: https://bugs.launchpad.net/hal/+bug/206921/comments/27 Kudos to goodlygeek.
Okay, thanks for the info. The fix was also verified by the SUSE user. I've commited it to git master: commit 9f5219eaa6c7423870b031fdfa07de6a84f25d6e Author: Danny Kukawka <danny.kukawka@web.de> Date: Fri Apr 25 22:18:24 2008 +0200 fix macbook-backlight for ix86 Fixed macbook-backlight for ix86 with a patch contributed by user 'godlygeek' via: https://bugs.launchpad.net/hal/+bug/206921 from comment #27: > This patch should fix it. Problem is that we're doing bitwise > arithmetic on a signed long that happens to be negative. > Wackiness ensues, making the result an invalid offset for mmap(). > Changing the long to unsigned fixes it.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.