Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 177509
b: refs/heads/master
c: bf9598b
h: refs/heads/master
i:
  177507: 48e0a2c
v: v3
  • Loading branch information
Alan Jenkins authored and Len Brown committed Dec 9, 2009
1 parent fced2dc commit 6c0eeb3
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 33 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 463b4e474ed0905ffc27ee347648739dbfb03acc
refs/heads/master: bf9598bcd5a73385ced7880ea09998a545e03dd8
71 changes: 39 additions & 32 deletions trunk/drivers/platform/x86/eeepc-laptop.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,9 +655,8 @@ static int eeepc_hotk_init(void)
return 0;
}

static int notify_brn(void)
static int eeepc_backlight_notify(void)
{
/* returns the *previous* brightness, or -1 */
struct backlight_device *bd = eeepc_backlight_device;
int old = bd->props.brightness;

Expand Down Expand Up @@ -731,50 +730,58 @@ static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
eeepc_rfkill_hotplug();
}

static void eeepc_hotk_notify(struct acpi_device *device, u32 event)
static void eeepc_input_notify(int event)
{
static struct key_entry *key;

key = eepc_get_entry_by_scancode(event);
if (key) {
switch (key->type) {
case KE_KEY:
input_report_key(ehotk->inputdev, key->keycode,
1);
input_sync(ehotk->inputdev);
input_report_key(ehotk->inputdev, key->keycode,
0);
input_sync(ehotk->inputdev);
break;
}
}
}

static void eeepc_hotk_notify(struct acpi_device *device, u32 event)
{
u16 count;
int brn = -ENODEV;

if (event > ACPI_MAX_SYS_NOTIFY)
return;
if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX)
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) {
/* brightness-change events need special
* handling for conversion to key events
*/
if (brn < 0)
brn = event;
else
brn += NOTIFY_BRN_MIN;
if (event < brn)

if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX) {
int old_brightness, new_brightness;

/* Update backlight device. */
old_brightness = eeepc_backlight_notify();

/* Convert brightness event to keypress (obsolescent hack). */
new_brightness = event - NOTIFY_BRN_MIN;

if (new_brightness < old_brightness) {
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) {
case KE_KEY:
input_report_key(ehotk->inputdev, key->keycode,
1);
input_sync(ehotk->inputdev);
input_report_key(ehotk->inputdev, key->keycode,
0);
input_sync(ehotk->inputdev);
break;
}
} else if (new_brightness > old_brightness) {
event = NOTIFY_BRN_MAX; /* brightness up */
} else {
/*
* no change in brightness - already at min/max,
* event will be desired value (or else ignored).
*/
}
}
eeepc_input_notify(event);
}

static int eeepc_register_rfkill_notifier(char *node)
Expand Down

0 comments on commit 6c0eeb3

Please sign in to comment.