summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2017-08-31 15:42:41 +0200
committerBastien Nocera <hadess@hadess.net>2017-08-31 16:21:21 +0200
commit320cc87811de80715dfadee30bcdc6dab100f7fd (patch)
treed4fac8623feec2a3e5c7bc233be26c75e8625b4a
parent5ccd4fe959f0fdfcb82ee431cde369f9cebf2073 (diff)
downloadupower-320cc87811de80715dfadee30bcdc6dab100f7fd.tar.gz
linux: Detect joysticks as gaming input devices
https://bugs.freedesktop.org/show_bug.cgi?id=102493
-rwxr-xr-xsrc/linux/integration-test4
-rw-r--r--src/linux/up-device-supply.c2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/linux/integration-test b/src/linux/integration-test
index f35345f..a901edd 100755
--- a/src/linux/integration-test
+++ b/src/linux/integration-test
@@ -990,8 +990,8 @@ class Tests(dbusmock.DBusTestCase):
joypadbat0_up = devs[0]
self.assertEqual(self.get_dbus_dev_property(joypadbat0_up, 'PowerSupply'), False)
- # 6 == mouse FIXME
- self.assertEqual(self.get_dbus_dev_property(joypadbat0_up, 'Type'), 6)
+ # 12 == gaming input
+ self.assertEqual(self.get_dbus_dev_property(joypadbat0_up, 'Type'), 12)
self.assertEqual(self.get_dbus_property('OnBattery'), False)
self.assertEqual(self.get_dbus_display_property('WarningLevel'), UP_DEVICE_LEVEL_NONE)
diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c
index b024fa6..15987b8 100644
--- a/src/linux/up-device-supply.c
+++ b/src/linux/up-device-supply.c
@@ -1017,6 +1017,8 @@ up_device_supply_guess_type (GUdevDevice *native,
if (g_udev_device_get_property_as_boolean (sibling, "ID_INPUT_MOUSE") ||
g_udev_device_get_property_as_boolean (sibling, "ID_INPUT_TOUCHPAD")) {
type = UP_DEVICE_KIND_MOUSE;
+ } else if (g_udev_device_get_property_as_boolean (sibling, "ID_INPUT_JOYSTICK")) {
+ type = UP_DEVICE_KIND_GAMING_INPUT;
} else {
type = UP_DEVICE_KIND_KEYBOARD;
}