summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface/evdev
diff options
context:
space:
mode:
authorScott Mansell <phiren@gmail.com>2020-01-07 12:46:24 +1300
committerGitHub <noreply@github.com>2020-01-07 12:46:24 +1300
commit21528c3e7280241cf8566b7602bb3dcd16f986d8 (patch)
tree6df8f7c7e90718210e49eb8276e1aa143288bd7e /Source/Core/InputCommon/ControllerInterface/evdev
parent99c0c8d4e874bc9cfb1f30fd9667ea5f4529b744 (diff)
Document the evdev "interesting" heuristic
Was checking over this old code, and saw a comment calling me out for a lack of documentation. It might be half a decade late, but better late then never.
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface/evdev')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp
index 824e5ef0c1..3f653f3d60 100644
--- a/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/evdev/evdev.cpp
@@ -410,8 +410,39 @@ evdevDevice::evdevDevice(const std::string& devnode) : m_devfile(devnode)
// TODO: Add leds as output devices
- // Was there some reasoning behind these numbers?
+ // Filter out interesting devices (see description below)
m_interesting = num_motion_axis != 0 || num_axis >= 2 || num_buttons >= 8;
+
+ // On modern linux systems, there are a lot of event devices that aren't controllers.
+ // For example, the PC Speaker is an event device. Webcams sometimes show up as
+ // event devices. The power button is an event device.
+
+ // We don't want these showing up in the list of controllers, so we use this
+ // heuristic to filter out anything that doesn't smell like a controller:
+ //
+ // More than two analog axis:
+ // Most controllers have at least one stick. This rule will catch all such
+ // controllers, while ignoring anything with a single axis (like the mouse
+ // scroll-wheel)
+ //
+ // --- OR ---
+ //
+ // More than 8 buttons:
+ // The user might be using a digital only pad such as a NES controller.
+ // This rule caches such controllers, while eliminating any device with
+ // only a few buttons, like the power button. Sometimes laptops have devices
+ // with 5 or 6 special buttons, which is why the threshold is set to 8 to
+ // match a NES controller.
+ //
+ // --- OR ---
+ //
+ // Any Motion Axis:
+ // This rule is to catch any theoretical motion controllers with only a few
+ // buttons that the user might want to use as a controller.
+ //
+ // This heuristic is quite loose. The user may still see weird devices showing up
+ // as controllers, but it hopefully shouldn't filter out anything they actually
+ // want to use.
}
evdevDevice::~evdevDevice()