Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(552)

Unified Diff: ui/events/platform/x11/x11_hotplug_event_handler.cc

Issue 798453002: events: x11: Use device path to detect internal keyboards (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/platform/x11/x11_hotplug_event_handler.cc
diff --git a/ui/events/platform/x11/x11_hotplug_event_handler.cc b/ui/events/platform/x11/x11_hotplug_event_handler.cc
index ccf8fa7c476865dbee97d1d9d4b47e2d075fa872..1fbdde3e3b61a6a9b9fdaece306a8c1f22099027 100644
--- a/ui/events/platform/x11/x11_hotplug_event_handler.cc
+++ b/ui/events/platform/x11/x11_hotplug_event_handler.cc
@@ -36,12 +36,6 @@ namespace ui {
namespace {
-// The name of the xinput device corresponding to the AT internal keyboard.
-const char kATKeyboardName[] = "AT Translated Set 2 keyboard";
-
-// The prefix of xinput devices corresponding to CrOS EC internal keyboards.
-const char kCrosEcKeyboardPrefix[] = "cros-ec";
-
// Names of all known internal devices that should not be considered as
// keyboards.
// TODO(rsadam@): Identify these devices using udev rules. (Crbug.com/420728.)
@@ -154,17 +148,6 @@ bool IsKnownInvalidKeyboardDevice(const std::string& name) {
return false;
}
-// Returns true if |name| is the name of a known internal keyboard device. Note,
-// this may return false negatives.
-bool IsInternalKeyboard(const std::string& name) {
- // TODO(rsadam@): Come up with a more generic way of identifying internal
- // keyboards. See crbug.com/420728.
- if (name == kATKeyboardName)
- return true;
- return name.compare(
- 0u, strlen(kCrosEcKeyboardPrefix), kCrosEcKeyboardPrefix) == 0;
-}
-
// Returns true if |name| is the name of a known XTEST device. Note, this may
// return false negatives.
bool IsTestKeyboard(const std::string& name) {
@@ -240,14 +223,9 @@ void HandleKeyboardDevicesInWorker(
base::TrimWhitespaceASCII(device_name, base::TRIM_TRAILING, &device_name);
if (IsTestKeyboard(device_name))
continue; // Skip test devices.
- InputDeviceType type;
- if (IsInternalKeyboard(device_name)) {
- type = InputDeviceType::INPUT_DEVICE_INTERNAL;
- } else if (IsKnownInvalidKeyboardDevice(device_name)) {
- type = InputDeviceType::INPUT_DEVICE_UNKNOWN;
- } else {
- type = InputDeviceType::INPUT_DEVICE_EXTERNAL;
- }
+ if (IsKnownInvalidKeyboardDevice(device_name))
+ continue; // Skip invalid devices.
+ InputDeviceType type = GetInputDeviceTypeFromPath(device_info.path);
devices.push_back(
KeyboardDevice(device_info.id, type, device_name));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698