From 09f0d9d957b82c5503763fb064608ad878667167 Mon Sep 17 00:00:00 2001 From: Thomas Renninger Date: Fri, 21 May 2010 16:41:43 +0200 Subject: [PATCH] --- yaml --- r: 202435 b: refs/heads/master c: 8dda6b0410cfc64642b2ed5b37987292f6321d0f h: refs/heads/master i: 202433: 8630e3818b1898bd72b60850341600075c20cb98 202431: ac3e125a0b2699f6e19c60e1bfb62d1d46206e39 v: v3 --- [refs] | 2 +- trunk/drivers/platform/x86/hp-wmi.c | 34 +++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/[refs] b/[refs] index 4bab51c62505..249c8348449d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 1bbdfd5961e83a1e3037d9362094bd09e0b066ab +refs/heads/master: 8dda6b0410cfc64642b2ed5b37987292f6321d0f diff --git a/trunk/drivers/platform/x86/hp-wmi.c b/trunk/drivers/platform/x86/hp-wmi.c index cd445019a6b7..7ebe46fe396e 100644 --- a/trunk/drivers/platform/x86/hp-wmi.c +++ b/trunk/drivers/platform/x86/hp-wmi.c @@ -352,7 +352,9 @@ static void hp_wmi_notify(u32 value, void *context) struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL }; static struct key_entry *key; union acpi_object *obj; - int eventcode, key_code; + u32 event_id, event_data; + int key_code; + u32 *location; acpi_status status; status = wmi_get_event_data(value, &response); @@ -363,15 +365,33 @@ static void hp_wmi_notify(u32 value, void *context) obj = (union acpi_object *)response.pointer; - if (!obj || obj->type != ACPI_TYPE_BUFFER || obj->buffer.length != 8) { - printk(KERN_INFO PREFIX "Unknown response received\n"); + if (obj || obj->type != ACPI_TYPE_BUFFER) { + printk(KERN_INFO "hp-wmi: Unknown response received %d\n", + obj->type); kfree(obj); return; } - eventcode = *((u8 *) obj->buffer.pointer); + /* + * Depending on ACPI version the concatenation of id and event data + * inside _WED function will result in a 8 or 16 byte buffer. + */ + location = (u32 *)obj->buffer.pointer; + if (obj->buffer.length == 8) { + event_id = *location; + event_data = *(location + 1); + } else if (obj->buffer.length == 16) { + event_id = *location; + event_data = *(location + 2); + } else { + printk(KERN_INFO "hp-wmi: Unknown buffer length %d\n", + obj->buffer.length); + kfree(obj); + return; + } kfree(obj); - switch (eventcode) { + + switch (event_id) { case HPWMI_DOCK_EVENT: input_report_switch(hp_wmi_input_dev, SW_DOCK, hp_wmi_dock_state()); @@ -423,8 +443,8 @@ static void hp_wmi_notify(u32 value, void *context) case HPWMI_LOCK_SWITCH: break; default: - printk(KERN_INFO PREFIX "Unknown eventcode - %d\n", - eventcode); + printk(KERN_INFO PREFIX "Unknown event_id - %d - 0x%x\n", + event_id, event_data); break; } }