Skip to content

Instantly share code, notes, and snippets.

@jeffgriffin
Created March 15, 2013 03:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffgriffin/5167200 to your computer and use it in GitHub Desktop.
Save jeffgriffin/5167200 to your computer and use it in GitHub Desktop.
for (i = BTN_MOUSE; i < BTN_JOYSTICK; i++)
if (test_bit( i, keybit ))
num_buttons++;
//...then some other stuff
//then this...
/* Mouse, Touchscreen or Smartpad ? */
if ((test_bit( EV_KEY, evbit ) && (test_bit( BTN_TOUCH, keybit )
|| test_bit( BTN_TOOL_FINGER, keybit ))) || ((num_rels >= 2
&& num_buttons) || (num_abs == 2 && (num_buttons == 1))))
m_deviceType |= LI_DEVICE_MOUSE;
else if (num_abs && num_buttons) /* Or a Joystick? */
m_deviceType |= LI_DEVICE_JOYSTICK;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment