|
@@ -58,6 +58,22 @@ SDL_EVDEV_GuessDeviceClass(const unsigned long bitmask_props[NBITS(INPUT_PROP_MA
|
|
|
int devclass = 0;
|
|
|
unsigned long keyboard_mask;
|
|
|
|
|
|
+ /* If the kernel specifically says it's an accelerometer, believe it */
|
|
|
+ if (test_bit(INPUT_PROP_ACCELEROMETER, bitmask_props)) {
|
|
|
+ return SDL_UDEV_DEVICE_ACCELEROMETER;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* We treat pointing sticks as indistinguishable from mice */
|
|
|
+ if (test_bit(INPUT_PROP_POINTING_STICK, bitmask_props)) {
|
|
|
+ return SDL_UDEV_DEVICE_MOUSE;
|
|
|
+ }
|
|
|
+
|
|
|
+ /* We treat buttonpads as equivalent to touchpads */
|
|
|
+ if (test_bit(INPUT_PROP_TOPBUTTONPAD, bitmask_props) ||
|
|
|
+ test_bit(INPUT_PROP_BUTTONPAD, bitmask_props)) {
|
|
|
+ return SDL_UDEV_DEVICE_TOUCHPAD;
|
|
|
+ }
|
|
|
+
|
|
|
/* X, Y, Z axes but no buttons probably means an accelerometer */
|
|
|
if (test_bit(EV_ABS, bitmask_ev) &&
|
|
|
test_bit(ABS_X, bitmask_abs) &&
|
|
@@ -67,7 +83,8 @@ SDL_EVDEV_GuessDeviceClass(const unsigned long bitmask_props[NBITS(INPUT_PROP_MA
|
|
|
return SDL_UDEV_DEVICE_ACCELEROMETER;
|
|
|
}
|
|
|
|
|
|
- /* RX, RY, RZ axes but no buttons also probably means an accelerometer */
|
|
|
+ /* RX, RY, RZ axes but no buttons probably means a gyro or
|
|
|
+ * accelerometer (we don't distinguish) */
|
|
|
if (test_bit(EV_ABS, bitmask_ev) &&
|
|
|
test_bit(ABS_RX, bitmask_abs) &&
|
|
|
test_bit(ABS_RY, bitmask_abs) &&
|