Re: [PATCH] Lenovo IdeaPAD ACPI driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2010-08-11 at 15:51 +0200, Corentin Chary wrote:
> And you should probably make it a platform driver (being the parent of
> acpi, wmi, input, backlight, rfkill, etc..).
> 
> Is there a lot of thing hidden in ACPI / WMI on these models (like
> hotkeys, backlight, light sensors)  ?

I hooked up something (below) to dump the AE or IO WMI blocks each time
we get a notification on the VPC2004 device. Although the notification
happens when we press a key, nothing ever changes in either of them.

I *did* notice that we're actually getting proper keycodes for the
hotkeys though, so for now I've lost what little interest I already had
in doing anything with WMI. If anyone (Florian?) wants to do more, I'd
be happy to do some testing.

As I said, my main reason for looking at this was to implement the
rkfill support, without which some people can't get the wireless working
on these devices at all (without booting to Windows to unblock it). And
that much is working in git://git.infradead.org/~dwmw2/ideapad-2.6.git

diff --git a/drivers/platform/x86/ideapad-wmi.c b/drivers/platform/x86/ideapad-wmi.c
index 53046d1..5bdbd9c 100644
--- a/drivers/platform/x86/ideapad-wmi.c
+++ b/drivers/platform/x86/ideapad-wmi.c
@@ -28,6 +28,10 @@
 #include <acpi/acpi_drivers.h>
 #include <linux/rfkill.h>
 
+#define IDEAPAD_EVENT_GUID	"ABBC0F20-8EA1-11D1-00A0-C90629100000"
+#define IDEAPAD_IO_GUID		"ABBC0F40-8EA1-11D1-00A0-C90629100000"
+#define IDEAPAD_AE_GUID		"05901221-D566-11D1-B2F0-00A0C9062910"
+
 #define IDEAPAD_DEV_CAMERA	0
 #define IDEAPAD_DEV_WLAN	1
 #define IDEAPAD_DEV_BLUETOOTH	2
@@ -268,9 +272,44 @@ static int ideapad_acpi_remove(struct acpi_device *adevice, int type)
 	return 0;
 }
 
+static int oldlen;
+static unsigned char oldresponse[4096];
+
 static void ideapad_acpi_notify(struct acpi_device *adevice, u32 event)
 {
+	struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
+	union acpi_object *obj;
+	acpi_status status;
+
 	ideapad_sync_rfk_state(adevice);
+
+	status = wmi_query_block(IDEAPAD_AE_GUID, 1, &response);
+	if (ACPI_FAILURE(status))
+		return;
+
+	obj = response.pointer;
+	if (obj && obj->type == ACPI_TYPE_BUFFER) {
+		int i;
+#if 1
+		for (i=0 ; i<obj->buffer.length; i++) {
+			if (!(i&0xf)) {
+				if (i)
+					printk("\n");
+				printk(KERN_INFO "%04x:", i);
+			}
+			printk(" %02x", ((unsigned char *)obj->buffer.pointer)[i]);
+		}
+		printk("\n");
+#endif
+		for (i=0 ; i < obj->buffer.length && i < oldlen; i++) {
+			if (oldresponse[i] != obj->buffer.pointer[i])
+				printk(KERN_INFO "Byte %04x: %02x->%02x\n",
+				       i, oldresponse[i], obj->buffer.pointer[i]);
+		}
+		oldlen = min(sizeof(oldresponse), obj->buffer.length);
+		memcpy(oldresponse, obj->buffer.pointer, oldlen);
+	}
+	kfree(obj);
 }
 
 static struct acpi_driver ideapad_acpi_driver = {


-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@xxxxxxxxx                              Intel Corporation

--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux