From: Greg KH <greg@kroah.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Daniel Drake <dsd@laptop.org>,
linux-input@vger.kernel.org, linux-hotplug@vger.kernel.org,
hadess@hadess.net, Carlos Garnacho <carlosg@gnome.org>
Subject: Re: Communicating tablet mode status to userspace
Date: Tue, 2 Oct 2012 19:58:00 -0700 [thread overview]
Message-ID: <20121003025800.GA13033@kroah.com> (raw)
In-Reply-To: <20121002233640.GB8542@core.coreip.homeip.net>
On Tue, Oct 02, 2012 at 04:36:41PM -0700, Dmitry Torokhov wrote:
> On Tue, Oct 02, 2012 at 04:27:07PM -0600, Daniel Drake wrote:
> > Hi,
> >
> > For the upcoming OLPC touchscreen laptop we're trying to solve the
> > following problem: we want the on-screen keyboard to only activate
> > itself when the laptop is "folded over" into tablet mode where the
> > keyboard is physically obscured.
> >
> > We already have an ebook mode switch which detects this, and the
> > driver is upstream. Its an input device that exposes this information
> > via the SW_TABLET_MODE switch.
> >
> > The on-screen keyboard runs in the user environment, which means that
> > its not root - it can't access /dev/input/event nodes directly. X
> > doesn't treat switches as input devices, so this info is not available
> > through X.
> >
> > I'm wondering if anyone has suggestions on the best way to solve this
> > problem. The most attractive option I have found would be to do
> > something similar to the accelerometer:
> > http://git.kernel.org/?p=linux/hotplug/udev.git;a=blob;f=src/accelerometer/accelerometer.c
> >
> > Modify the kernel input driver to generate a uevent (in addition to
> > the evdev event) every time the switch state is changed, then write a
> > udev program to expose this info in a udev property.
> >
> > The change event would (presumably) trigger libudev's udev_monitor,
> > which would be used by the on-screen keyboard software (maliit) to
> > change its behaviour according to the property value.
> >
> > Does this sound like a sensible plan, would these udev and kernel
> > changes be acceptable? Or is there a better option that I'm missing?
>
> Why can't you change event device ownership to the local user? Then you
> can read and act upon events.
Yes, that's the best way. Also, you might want to check out the extcon
driver interface, that might provide the api you want for userspace.
greg k-h
next prev parent reply other threads:[~2012-10-03 2:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-02 22:27 Communicating tablet mode status to userspace Daniel Drake
2012-10-02 22:39 ` Alan Cox
2012-10-02 23:36 ` Dmitry Torokhov
2012-10-03 2:58 ` Greg KH [this message]
2012-10-03 14:52 ` Daniel Drake
2012-10-03 15:05 ` Greg KH
2012-10-03 15:23 ` Kay Sievers
2012-10-03 16:04 ` Daniel Drake
2012-10-05 15:50 ` Bastien Nocera
2012-10-05 16:11 ` Daniel Drake
2012-10-05 16:40 ` Bastien Nocera
2012-10-04 13:35 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121003025800.GA13033@kroah.com \
--to=greg@kroah.com \
--cc=carlosg@gnome.org \
--cc=dmitry.torokhov@gmail.com \
--cc=dsd@laptop.org \
--cc=hadess@hadess.net \
--cc=linux-hotplug@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).