[PATCH 2/2] generalize keyboard detection code
David Zeuthen
david at fubar.dk
Mon Apr 2 23:19:57 PDT 2007
On Tue, 2007-04-03 at 02:59 +0300, Guillem Jover wrote:
> Some devices do not have a proper keyboard, still they have keys, those
> should be handled by the input addon, but should not be considered a
> keyboard. This patch thus adds two new input capabilities, input.keys
> and input.keypad. A device with more than two keys will have the
> input.keys set and it might have input.keyboard, input.keypad or
> neither depending on the supported keys.
Sounds like a good idea.
> +static gboolean
> +input_test_keyboard (long *bitmask)
> +{
> + int i;
> +
> + for (i = KEY_Q; i <= KEY_P; i++) {
> + if (!test_bit (i, bitmask))
> + return FALSE;
So here you are testing for Q, W, E, R, T, Y, U, I, P and if these keys
are present we're a keyboard? I guess that heuristic may fit the bill...
I committed your patch and then this patch on top of it
http://gitweb.freedesktop.org/?p=hal.git;a=commitdiff;h=0391cb5e4e9a26d1c9494727999d38714cb3af18
to explain the various input.* capabilities. Thanks!
David
More information about the hal
mailing list