[Debian-eeepc-devel] Beta 1 of eeepc-acpi-scripts 1.1.0 available for testing

Darren Salt linux at youmustbejoking.demon.co.uk
Fri Apr 3 13:40:55 UTC 2009


I demand that Damyan Ivanov may or may not have written...

> -=| Sven Arvidsson, Fri, Apr 03, 2009 at 12:44:30AM +0200 |=-
>> I'm using it with 2.6.29 on a 701. Seems to work very well, haven't
>> noticed any real problems.

> Thanks for checking.

>> I'm not getting any OSD popups from gnome-power-manager when the
>> brightness is adjusted. But I guess that's because those buttons haven't
>> been converted to use the input layer yet?

> Maybe. Or gnome-power-manager doesn't recognize the birghtess change
> events. These would indeed be nice. The current notifications look "out of
> band" with the rest of the GNOME.

This should help:

--- a/drivers/platform/x86/eeepc-laptop.c	2009-03-24 17:32:56.000000000 +0000
+++ b/drivers/platform/x86/eeepc-laptop.c	2009-04-03 13:24:59.000000000 +0100
@@ -166,6 +166,8 @@
 	{KE_KEY, 0x1b, KEY_ZOOM },
 	{KE_KEY, 0x1c, KEY_PROG2 },
 	{KE_KEY, 0x1d, KEY_PROG3 },
+	{KE_KEY, NOTIFY_BRN_MIN,     KEY_BRIGHTNESSDOWN },
+	{KE_KEY, NOTIFY_BRN_MIN + 2, KEY_BRIGHTNESSUP },
 	{KE_KEY, 0x30, KEY_SWITCHVIDEOMODE },
 	{KE_KEY, 0x31, KEY_SWITCHVIDEOMODE },
 	{KE_KEY, 0x32, KEY_SWITCHVIDEOMODE },
@@ -512,11 +514,17 @@
 	return 0;
 }
 
-static void notify_brn(void)
+static int notify_brn(void)
 {
+	/* returns the *previous* brightness, or -1 */
 	struct backlight_device *bd = eeepc_backlight_device;
 	if (bd)
+	{
+		int old = bd->props.brightness;
 		bd->props.brightness = read_brightness(bd);
+		return old;
+	}
+	return -1;
 }
 
 static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
@@ -558,17 +566,34 @@
 {
 	static struct key_entry *key;
 	u16 count;
+	int brn = -2;
 
 	if (!ehotk)
 		return;
 	if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX)
-		notify_brn();
+		brn = notify_brn();
 	count = ehotk->event_count[event % 128]++;
 	acpi_bus_generate_proc_event(ehotk->device, event, count);
 	acpi_bus_generate_netlink_event(ehotk->device->pnp.device_class,
 					dev_name(&ehotk->device->dev), event,
 					count);
 	if (ehotk->inputdev) {
+		if (brn != -2)
+		{
+			/* brightness-change events need special
+			 * handling for conversion to key events
+			 */
+			if (brn == -1)
+				brn = event;
+			else
+				brn += NOTIFY_BRN_MIN;
+			if (event < brn)
+				event = NOTIFY_BRN_MIN; /* brightness down */
+			else if (event > brn)
+				event = NOTIFY_BRN_MIN + 2; /* ... up */
+			else
+				event = NOTIFY_BRN_MIN + 1; /* ... unchanged */
+		}
 		key = eepc_get_entry_by_scancode(event);
 		if (key) {
 			switch (key->type) {

-- 
| Darren Salt    | linux or ds at              | nr. Ashington, | Toon
| RISC OS, Linux | youmustbejoking,demon,co,uk | Northumberland | Army
| + Burn less waste. Use less packaging. Waste less.     USE FEWER RESOURCES.

You are in a maze of twisty little programs, all alike.



More information about the Debian-eeepc-devel mailing list