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

Side by Side Diff: ui/events/ozone/evdev/device_manager_udev.cc

Issue 230883005: ozone: evdev: Filter devices by path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/events/ozone/evdev/device_manager_udev.h" 5 #include "ui/events/ozone/evdev/device_manager_udev.h"
6 6
7 #include <libudev.h> 7 #include <libudev.h>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop/message_pump_ozone.h" 12 #include "base/message_loop/message_pump_ozone.h"
13 #include "base/strings/string_util.h"
13 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
14 #include "ui/events/ozone/evdev/device_manager_evdev.h" 15 #include "ui/events/ozone/evdev/device_manager_evdev.h"
15 #include "ui/events/ozone/evdev/event_factory_evdev.h" 16 #include "ui/events/ozone/evdev/event_factory_evdev.h"
16 #include "ui/events/ozone/evdev/scoped_udev.h" 17 #include "ui/events/ozone/evdev/scoped_udev.h"
17 18
18 namespace ui { 19 namespace ui {
19 20
20 namespace { 21 namespace {
21 22
22 const char kSubsystemInput[] = "input"; 23 const char kSubsystemInput[] = "input";
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 const char* name = udev_list_entry_get_name(entry); 95 const char* name = udev_list_entry_get_name(entry);
95 96
96 scoped_udev_device device(udev_device_new_from_syspath(udev, name)); 97 scoped_udev_device device(udev_device_new_from_syspath(udev, name));
97 if (!device) 98 if (!device)
98 continue; 99 continue;
99 100
100 const char* path = udev_device_get_devnode(device.get()); 101 const char* path = udev_device_get_devnode(device.get());
101 if (!path) 102 if (!path)
102 continue; 103 continue;
103 104
105 // Filter non-evdev device notes.
106 if (!StartsWithASCII(path, "/dev/input/event", true))
107 continue;
108
104 // Found input device node; attach. 109 // Found input device node; attach.
105 device_callback.Run(base::FilePath(path)); 110 device_callback.Run(base::FilePath(path));
106 } 111 }
107 112
108 return true; 113 return true;
109 } 114 }
110 115
111 // Device enumerator & monitor using udev. 116 // Device enumerator & monitor using udev.
112 // 117 //
113 // This class enumerates input devices attached to the system using udev. 118 // This class enumerates input devices attached to the system using udev.
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 DISALLOW_COPY_AND_ASSIGN(DeviceManagerUdev); 209 DISALLOW_COPY_AND_ASSIGN(DeviceManagerUdev);
205 }; 210 };
206 211
207 } // namespace 212 } // namespace
208 213
209 scoped_ptr<DeviceManagerEvdev> CreateDeviceManagerUdev() { 214 scoped_ptr<DeviceManagerEvdev> CreateDeviceManagerUdev() {
210 return make_scoped_ptr<DeviceManagerEvdev>(new DeviceManagerUdev()); 215 return make_scoped_ptr<DeviceManagerEvdev>(new DeviceManagerUdev());
211 } 216 }
212 217
213 } // namespace ui 218 } // namespace ui
OLDNEW
« 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