This message generated a parse failure. Raw output follows here. Please use 'back' to navigate. From devnull@lkml.org Sat Apr 27 21:46:29 2024 Delivery-date: Wed, 27 Jun 2007 19:47:22 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1762651AbXF0Tnq (ORCPT ); Wed, 27 Jun 2007 15:43:46 -0400 Received: from wx-out-0506.google.com ([66.249.82.234]:63694 "EHLO wx-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759890AbXF0Tni (ORCPT ); Wed, 27 Jun 2007 15:43:38 -0400 Received: by wx-out-0506.google.com with SMTP id h31so276217wxd for ; Wed, 27 Jun 2007 12:43:36 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:subject:from:to:cc:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer; b=HvK8AUnAIygoDnFy+jn6iOK1DffDesr2RJZomNh4SYYaI DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:subject:from:to:cc:in-reply-to:references:content-type:date:message-id:mime-version:x-mailer; b=IW6z6wvIhzVbudpWKmQsXUrL/RnRRBp8WHdEHq81fjnbfeip7Gix3Rh25b6u2ocdOmi/RELH6jZP+9UgXjFP Received: by 10.90.69.8 with SMTP id r8mr1079734aga.1182973416402; Wed, 27 Jun 2007 12:43:36 -0700 (PDT) Received: from ?192.168.1.68? ( [86.141.43.76]) by mx.google.com with ESMTP id 11sm9652827wrl.2007.06.27.12.43.33 (version=SSLv3 cipher=RC4-MD5); Wed, 27 Jun 2007 12:43:34 -0700 (PDT) Subject: [patch] Reporting the lid status using INPUT From: Richard Hughes To: len.brown@intel.com Cc: Dmitry Torokhov , linux-acpi , Bastien Nocera , David Zeuthen , linux-kernel In-Reply-To: References: Content-Type: multipart/mixed; boundary="=-MGaK1muni/JoU2Ynb0ZR" Date: Wed, 27 Jun 2007 20:42:25 +0100 Message-Id: <1182973345.27453.9.camel@work> Mime-Version: 1.0 X-Mailer: Evolution 2.10.2 (2.10.2-2.fc7) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org --=-MGaK1muni/JoU2Ynb0ZR Content-Type: text/plain Content-Transfer-Encoding: 7bit Len, * user shuts lid, initiates suspend {lid is reported down} * user opens lid, resume completes But the lid INPUT up event is not sent. This works if you don't initiate suspend when you shut the lid (blank screen for instance) -- so I know my hardware is okay. I see: input_report_switch(input, SW_LID, !state); in response to an event, but in a resume hook we should probably do acpi_evaluate_integer(handle, "_LID", NULL, &state) and then send an event, just so userspace is aware of what the state of the panel is. If switch state matches to what input layer thinks it is the event will not be sent. Signed-off-by: Richard Hughes --=-MGaK1muni/JoU2Ynb0ZR Content-Disposition: attachment; filename=button-resume.patch Content-Type: message/rfc822; name=button-resume.patch From: Richard Hughes Date: Fri, 15 Jun 2007 15:53:11 +0100 Subject: No Subject Message-Id: <1181919191.2681.5.camel@work> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit On resume we need to refresh the lid status as we will not get an event if the lid opening was what triggered the suspend. This manifests itself in users never getting a "lid open" event when a suspend happens because of lid close on hardware that supports wake on lid open. This makes userspace gets very confused indeed. Patch attached forces a check of the lid status in the resume handler. Signed-off-by: Richard Hughes --- diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index cb4110b..fd3473b 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -68,6 +68,7 @@ MODULE_LICENSE("GPL"); static int acpi_button_add(struct acpi_device *device); static int acpi_button_remove(struct acpi_device *device, int type); +static int acpi_button_resume(struct acpi_device *device); static int acpi_button_info_open_fs(struct inode *inode, struct file *file); static int acpi_button_state_open_fs(struct inode *inode, struct file *file); @@ -77,6 +78,7 @@ static struct acpi_driver acpi_button_driver = { .ids = "button_power,button_sleep,PNP0C0D,PNP0C0C,PNP0C0E", .ops = { .add = acpi_button_add, + .resume = acpi_button_resume, .remove = acpi_button_remove, }, }; @@ -487,6 +489,29 @@ static int acpi_button_remove(struct acpi_device *device, int type) return 0; } +/* this is needed to learn about changes made in suspended state */ +static int acpi_button_resume(struct acpi_device *device) +{ + struct acpi_button *button; + struct acpi_handle *handle; + struct input_dev *input; + unsigned long state; + + button = device->driver_data; + handle = button->device->handle; + input = button->input; + + /* + * On resume we send the state; if it matches to what input layer + * thinks then the event will not even reach userspace. + */ + if (!ACPI_FAILURE(acpi_evaluate_integer(handle, "_LID", + NULL, &state))) + input_report_switch(input, SW_LID, !state); + + return 0; +} + static int __init acpi_button_init(void) { int result; --=-MGaK1muni/JoU2Ynb0ZR-- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/