From patchwork Mon May 9 17:58:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anisse Astier X-Patchwork-Id: 770052 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p49HwC2W023710 for ; Mon, 9 May 2011 17:58:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751476Ab1EIR6L (ORCPT ); Mon, 9 May 2011 13:58:11 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:51699 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751400Ab1EIR6K (ORCPT ); Mon, 9 May 2011 13:58:10 -0400 Received: by wya21 with SMTP id 21so4081418wya.19 for ; Mon, 09 May 2011 10:58:09 -0700 (PDT) Received: by 10.216.168.67 with SMTP id j45mr2909033wel.101.1304963889337; Mon, 09 May 2011 10:58:09 -0700 (PDT) Received: from destiny.ordissimo (mar92-17-78-228-214-160.fbx.proxad.net [78.228.214.160]) by mx.google.com with ESMTPS id bi13sm998665wbb.25.2011.05.09.10.58.08 (version=SSLv3 cipher=OTHER); Mon, 09 May 2011 10:58:09 -0700 (PDT) Date: Mon, 9 May 2011 19:58:02 +0200 From: Anisse Astier To: Matthew Garrett Cc: Andy Ross , linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, Dmitry Torokhov , Corentin Chary Subject: Re: [RFC] Reporting "orientation changed" event Message-ID: <20110509195802.0389639d@destiny.ordissimo> In-Reply-To: <20110509164006.GA6570@srcf.ucam.org> References: <20110407181800.27b441b1@destiny.ordissimo> <20110509143828.GA2632@srcf.ucam.org> <4DC80A53.7050609@windriver.com> <20110509154729.GA5043@srcf.ucam.org> <4DC80F45.2040508@windriver.com> <20110509164006.GA6570@srcf.ucam.org> X-Mailer: Claws Mail 3.7.8 (GTK+ 2.20.1; i486-pc-linux-gnu) Mime-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 09 May 2011 17:58:13 +0000 (UTC) On Mon, 9 May 2011 17:40:06 +0100, Matthew Garrett wrote : > On Mon, May 09, 2011 at 08:59:01AM -0700, Andy Ross wrote: > > On 05/09/2011 08:47 AM, Matthew Garrett wrote: > > > Yes, so the accelerometer driver should (in-kernel) know that a coarse > > > orientation event has occured and then send an appropriate uevent to > > > userspace indiciating that it has new data. > > > > OK, so substituting udev for acpid, but otherwise leaving the > > input-polldev device alone. That certainly sounds nice to me, though > > I'm not sure where the "dreadful / don't do that" advice is directed > > as the handling in userspace will be virtual identical (moving the > > dbus-send from the acpid event file into a udev rule). > > It shouldn't even be a dbus send - something in userspace should just be > listening for event notifications on the accelerometer. Use udev > directly. > > > > I'm going to NAK anything that reports "Coarse orientation change" > > > to userspace without providing any context. > > > > Just to be clear: there's no kernel code to NAK here. The acpid hook > > is raw, and in userspace. It's not clean, but it's also a single-device > > fixup: seems to me to be pretty much exactly what apcid is for, no? > > acpid is for dealing with cases where the kernel doesn't provide > functionality that the kernel should provide. Arbitrary APCI events > shouldn't be being delivered to userspace - they should be handled > in-kernel and delivered through a meaningful mechanism in order to avoid > cases where userspace needs to know about a platform implementation. In > this case the right way for the event to hit userspace is as a generic > message from the accelerometer, not as a device-specific ACPI event > through a deprecated interface. > Implementation RFC : From: Anisse Astier Date: Mon, 9 May 2011 19:51:40 +0200 Subject: [PATCH RFC] asus-laptop: pega_accel - Report accelerometer orientation change through udev Signed-off-by: Anisse Astier --- drivers/platform/x86/asus-laptop.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c index 2105b42..e23d555 100644 --- a/drivers/platform/x86/asus-laptop.c +++ b/drivers/platform/x86/asus-laptop.c @@ -1337,6 +1337,13 @@ static void asus_acpi_notify(struct acpi_device *device, u32 event) } return ; } + + /* Accelerometer "coarse orientation change" event */ + if (asus->pega_accel && event == 0xEA) { + kobject_uevent(&asus->pega_accel->dev.kobj, KOBJ_CHANGE); + return ; + } + asus_input_notify(asus, event); }