diff options
author | Martin Pitt <martin.pitt@ubuntu.com> | 2009-12-03 13:15:50 +0100 |
---|---|---|
committer | Martin Pitt <martin.pitt@ubuntu.com> | 2009-12-03 13:15:50 +0100 |
commit | 01db50919ebdf1aa5a21ea839117f52938c33afe (patch) | |
tree | 0c9a512efef336586c0d772d773d5406f5292f7f | |
parent | 7c3db771115570a951e7878062aee58119ab9046 (diff) |
input_id: Check mouse button for ID_INPUT_MOUSE
Before we bless an input device as a mouse, verify that it has a left button
(BTN_MOUSE).
Thanks to Dmitry Torokhov <dtor@mail.ru> for pointing out!
-rw-r--r-- | extras/input_id/input_id.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/extras/input_id/input_id.c b/extras/input_id/input_id.c index 05bb085a03..95f78795c0 100644 --- a/extras/input_id/input_id.c +++ b/extras/input_id/input_id.c @@ -72,7 +72,10 @@ static void test_pointers (const unsigned long* bitmask_ev, int is_mouse = 0; int is_touchpad = 0; - if (test_bit (EV_ABS, bitmask_ev) && test_bit (EV_KEY, bitmask_ev) && + if (!test_bit (EV_KEY, bitmask_ev)) + return; + + if (test_bit (EV_ABS, bitmask_ev) && test_bit (ABS_X, bitmask_abs) && test_bit (ABS_Y, bitmask_abs)) { if (test_bit (BTN_STYLUS, bitmask_key) || test_bit (BTN_TOOL_PEN, bitmask_key)) puts("ID_INPUT_TABLET=1"); @@ -89,7 +92,8 @@ static void test_pointers (const unsigned long* bitmask_ev, } if (test_bit (EV_REL, bitmask_ev) && - test_bit (REL_X, bitmask_rel) && test_bit (REL_Y, bitmask_rel)) + test_bit (REL_X, bitmask_rel) && test_bit (REL_Y, bitmask_rel) && + test_bit (BTN_MOUSE, bitmask_key)) is_mouse = 1; if (is_mouse) |