lkml.org 
[lkml]   [2010]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH] input: Introduce device information ioctl
On Tue, Dec 07, 2010 at 01:18:41PM -0600, Chris Bagwell wrote:
> On Tue, Dec 7, 2010 at 1:25 AM, Henrik Rydberg <rydberg@euromail.se> wrote:
> > Today, userspace sets up an input device based on the data it emits.
> > This is not always enough; a tablet and a touchscreen may emit exactly
> > the same data, for instance, but the former should be set up with a
> > pointer whereas the latter does not need to. Recently, a new type of
> > touchpad has emerged where the buttons are under the pad, which changes
> > handling logic without changing the emitted data. This patch introduces
> > a new ioctl, EVIOCGDEVINFO, which allows userspace to extract information
> > about the device resulting in proper setup.
> >
> > Suggested-by: Dmitry Torokhov <dtor@mail.ru>
> > Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
> > Cc: Ping Cheng <pingc@wacom.com>
> > Cc: Chris Bagwell <chris@cnpbagwell.com>
> > ---
> > Hi all,
> >
> > Here is a patch attempting to formulate Dmitry's device type idea. It
> > compiles, but further testing awaits a general consesus on the device
> > types and capabilities to start out with. Are the ones listed here apt
> > for the job?
> >
> > Cheers,
> > Henrik
> >
> >  drivers/input/evdev.c |    6 ++++++
> >  include/linux/input.h |   34 ++++++++++++++++++++++++++++++++++
> >  2 files changed, 40 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
> > index e3f7fc6..db78592 100644
> > --- a/drivers/input/evdev.c
> > +++ b/drivers/input/evdev.c
> > @@ -632,6 +632,12 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
> >                        return -EFAULT;
> >                return 0;
> >
> > +       case EVIOCGDEVINFO:
> > +               if (copy_to_user(p, &dev->devinfo,
> > +                                sizeof(struct input_devinfo)))
> > +                       return -EFAULT;
> > +               return 0;
> > +
> >        case EVIOCGREP:
> >                if (!test_bit(EV_REP, dev->evbit))
> >                        return -ENOSYS;
> > diff --git a/include/linux/input.h b/include/linux/input.h
> > index 6ef4446..8c58d2a 100644
> > --- a/include/linux/input.h
> > +++ b/include/linux/input.h
> > @@ -57,6 +57,21 @@ struct input_absinfo {
> >  };
> >
> >  /**
> > + * struct input_devinfo - device information via EVIOCGDEVINFO ioctl
> > + * @types: bitmask of types (DEVTYPE_*) matching this device
> > + * @capabilities: bitmask of capabilities (DEVCAPS_*) of this device
> > + *
> > + * This struct provides information about the device needed for
> > + * automatic setup in userspace, such as if the device is direct
> > + * (touchscreen) or indirect (touchpad), and if there are other
> > + * special considerations, such as the touchpad also being a button.
> > + */
> > +struct input_devinfo {
> > +       __u32 types;
> > +       __u32 capabilities;
> > +};
> > +
>
> "types" sounds like it can support being more then one thing at a time
> but I don't think that is intent from below names. Should rename to
> "type"?

I'd be wary of restricting device to be only one type. There are some
that are mutually exclusive (toucscreen/touchpad/tablet) but I'd leave
option of mixed-type devices open.

--
Dmitry
--
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/

\
 
 \ /
  Last update: 2010-12-07 20:47    [W:0.147 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site