Re: [PATCH 02/19] Input: Improve the events-per-packet estimate

From
Ping Cheng <hidden>
Date
2012-08-14 21:06:49
Also in
lkml
Reply to
Henrik Rydberg, 2012-08-14
On Tue, Aug 14, 2012 at 1:01 PM, Henrik Rydberg [off-list ref] wrote:
Hi Ping,

Long time no see. :-)
quoted
quoted
+       /* Make room for KEY and MSC events */
+       events += 7;
It is nice to get rid of the redundant pieces and to incorporate
common functions. Thank you.

I have a question about the code above though.  Why do we use 7
instead of going through the keys like:

      for (i = 0; i < KEY_MAX; i++)
              if (test_bit(i, dev->keybit))
                      events++;
Keyboards register a large amount of different keys, but seldom send
more than one or two at a time. The value 7 is ad hoc, admittedly, but
it makes the default buffer 8 bytes, which happens to precisely match
the default buffer in evdev.
That can be a valid reason until we need to report more keys
simultaneously. Please update the comments so we know why we end up
with 7.

Thank you.

Ping
Thread (45 messages) 45 messages, 8 authors, last reply 2012-08-29
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help