OLD | NEW |
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 <linux/input.h> | 5 #include <linux/input.h> |
6 | 6 |
7 #include "ui/events/ozone/evdev/event_converter_evdev.h" | 7 #include "ui/events/ozone/evdev/event_converter_evdev.h" |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "ui/events/devices/input_device.h" | 12 #include "ui/events/devices/input_device.h" |
13 | 13 |
14 namespace ui { | 14 namespace ui { |
15 | 15 |
16 EventConverterEvdev::EventConverterEvdev(int fd, | 16 EventConverterEvdev::EventConverterEvdev(int fd, |
17 const base::FilePath& path, | 17 const base::FilePath& path, |
18 int id, | 18 int id, |
19 InputDeviceType type) | 19 InputDeviceType type, |
20 : fd_(fd), path_(path), id_(id), type_(type), ignore_events_(false) { | 20 const std::string& name, |
| 21 uint16_t vendor_id, |
| 22 uint16_t product_id) |
| 23 : fd_(fd), |
| 24 path_(path), |
| 25 input_device_(id, type, name, vendor_id, product_id), |
| 26 ignore_events_(false) { |
21 } | 27 } |
22 | 28 |
23 EventConverterEvdev::~EventConverterEvdev() { | 29 EventConverterEvdev::~EventConverterEvdev() { |
24 Stop(); | 30 Stop(); |
25 } | 31 } |
26 | 32 |
27 void EventConverterEvdev::Start() { | 33 void EventConverterEvdev::Start() { |
28 base::MessageLoopForUI::current()->WatchFileDescriptor( | 34 base::MessageLoopForUI::current()->WatchFileDescriptor( |
29 fd_, true, base::MessagePumpLibevent::WATCH_READ, &controller_, this); | 35 fd_, true, base::MessagePumpLibevent::WATCH_READ, &controller_, this); |
30 } | 36 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 Stop(); | 113 Stop(); |
108 } | 114 } |
109 } | 115 } |
110 | 116 |
111 base::TimeDelta EventConverterEvdev::TimeDeltaFromInputEvent( | 117 base::TimeDelta EventConverterEvdev::TimeDeltaFromInputEvent( |
112 const input_event& event) { | 118 const input_event& event) { |
113 return base::TimeDelta::FromMicroseconds(event.time.tv_sec * 1000000 + | 119 return base::TimeDelta::FromMicroseconds(event.time.tv_sec * 1000000 + |
114 event.time.tv_usec); | 120 event.time.tv_usec); |
115 } | 121 } |
116 } // namespace ui | 122 } // namespace ui |
OLD | NEW |