From 9fc7b041bcebf9ea1dd1937690e8d02ebff36ca2 Mon Sep 17 00:00:00 2001
From: spang <spang@chromium.org>
Date: Thu, 2 Apr 2015 10:40:51 -0700
Subject: events: devices: Mark all uhid virtual devices as external

This driver is currently used for Bluetooth LE, and should be marked
external. Since it's a virtual device it's organized a bit differently.
Terminate and return INPUT_DEVICE_EXTERNAL if we hit the "uhid" device
itself.

BUG=470888
TEST=Ran uhid-example on link to create such a device,
     & verified it is detected as external.

Review URL: https://codereview.chromium.org/1051093003

Cr-Commit-Position: refs/heads/master@{#323533}
---
 ui/events/devices/device_util_linux.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/ui/events/devices/device_util_linux.cc b/ui/events/devices/device_util_linux.cc
index 90fad3d..858ee84 100644
--- a/ui/events/devices/device_util_linux.cc
+++ b/ui/events/devices/device_util_linux.cc
@@ -33,6 +33,11 @@ InputDeviceType GetInputDeviceTypeFromPath(const base::FilePath& path) {
   // Check ancestor devices for a known bus attachment.
   for (base::FilePath path = sysfs_path; path != base::FilePath("/");
        path = path.DirName()) {
+    // Bluetooth LE devices are virtual "uhid" devices.
+    if (path ==
+        base::FilePath(FILE_PATH_LITERAL("/sys/devices/virtual/misc/uhid")))
+      return InputDeviceType::INPUT_DEVICE_EXTERNAL;
+
     std::string subsystem_path =
         base::MakeAbsoluteFilePath(path.Append(FILE_PATH_LITERAL("subsystem")))
             .value();
-- 
cgit v1.1