From: "Henrik Rydberg" <rydberg@euromail.se>
To: Jeff Brown <jeffbrown@android.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
Jeff Brown <jeffbrown@google.com>
Subject: Re: [PATCH 1/4] input: Set default events per packet.
Date: Fri, 25 Mar 2011 09:20:30 +0100 [thread overview]
Message-ID: <20110325082030.GB5664@polaris.bitmath.org> (raw)
In-Reply-To: <1300842244-42723-2-git-send-email-jeffbrown@android.com>
Hi Jeff,
> Calculate a default based on the number of ABS axes, REL axes,
> and MT slots for the device during input device registration.
>
> Signed-off-by: jeffbrown@android.com
> ---
> drivers/input/input.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 46 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/input/input.c b/drivers/input/input.c
> index d6e8bd8..c27292b 100644
> --- a/drivers/input/input.c
> +++ b/drivers/input/input.c
> @@ -1746,6 +1746,49 @@ void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int
> }
> EXPORT_SYMBOL(input_set_capability);
>
> +static inline bool is_mt_axis(int axis)
> +{
> + return axis == ABS_MT_SLOT ||
> + (axis >= ABS_MT_FIRST && axis <= ABS_MT_LAST);
> +}
It would be great to get this inline into input/mt.h instead.
> +static void input_set_default_events_per_packet(struct input_dev *dev)
> +{
> + int mt_slots;
> + int i;
> + int events;
> +
> + if (dev->hint_events_per_packet)
> + return;
> +
> + if (dev->mtsize)
> + mt_slots = dev->mtsize;
> + else if (test_bit(ABS_MT_TRACKING_ID, dev->absbit))
> + mt_slots = dev->absinfo[ABS_MT_TRACKING_ID].maximum -
> + dev->absinfo[ABS_MT_TRACKING_ID].minimum + 1;
This one is a bit iffy - the tracking id is not limited like this in
mainline, looks like android usage. A test againts some arbitrary max
should do it.
> + else if (test_bit(ABS_MT_POSITION_X, dev->absbit))
> + mt_slots = 2;
> + else
> + mt_slots = 0;
> +
> + events = mt_slots + 1; /* count SYN_MT_REPORT and SYN_REPORT */
> +
> + for (i = 0; i < ABS_CNT; i++) {
> + if (test_bit(i, dev->absbit)) {
> + if (is_mt_axis(i))
> + events += mt_slots;
> + else
> + events++;
> + }
> + }
> +
> + for (i = 0; i < REL_CNT; i++)
> + if (test_bit(i, dev->relbit))
> + events++;
> +
> + input_set_events_per_packet(dev, events);
> +}
> +
> #define INPUT_CLEANSE_BITMASK(dev, type, bits) \
> do { \
> if (!test_bit(EV_##type, dev->evbit)) \
> @@ -1784,6 +1827,9 @@ int input_register_device(struct input_dev *dev)
> const char *path;
> int error;
>
> + /* Use a larger default input buffer for MT devices */
> + input_set_default_events_per_packet(dev);
> +
> /* Every input device generates EV_SYN/SYN_REPORT events. */
> __set_bit(EV_SYN, dev->evbit);
>
> --
> 1.7.0.4
Thanks,
Henrik
next prev parent reply other threads:[~2011-03-25 8:17 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-23 1:04 [PATCH 0/4] input: Sizing the evdev ring buffer for MT devices and reporting overruns Jeff Brown
2011-03-23 1:04 ` [PATCH 1/4] input: Set default events per packet Jeff Brown
2011-03-25 8:20 ` Henrik Rydberg [this message]
2011-03-25 23:30 ` Jeffrey Brown
2011-03-28 7:10 ` Henrik Rydberg
2011-03-23 1:04 ` [PATCH 2/4] hid: hid-input: Remove obsolete default events per packet setting Jeff Brown
2011-03-23 1:04 ` [PATCH 3/4] input: evdev: Indicate buffer overrun with SYN_DROPPED Jeff Brown
2011-03-25 7:47 ` Dmitry Torokhov
2011-03-25 8:14 ` Henrik Rydberg
2011-03-25 9:02 ` Henrik Rydberg
[not found] ` <AANLkTike4c7SaeAm5JVWcLyZYt1K59OUEk94rnPeRkMy@mail.gmail.com>
2011-03-25 23:10 ` Jeffrey Brown
2011-03-25 23:12 ` Jeffrey Brown
2011-03-23 1:04 ` [PATCH 4/4] input: evdev: only wake poll on EV_SYN Jeff Brown
2011-03-25 7:49 ` Dmitry Torokhov
2011-03-25 23:03 ` Jeffrey Brown
2011-03-28 6:12 ` Dmitry Torokhov
2011-03-28 8:54 ` Jeffrey Brown
2011-03-25 8:34 ` Henrik Rydberg
2011-03-25 23:07 ` Jeffrey 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=20110325082030.GB5664@polaris.bitmath.org \
--to=rydberg@euromail.se \
--cc=jeffbrown@android.com \
--cc=jeffbrown@google.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®