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 "ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h" | 5 #include "ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <libevdev/libevdev.h> | 8 #include <libevdev/libevdev.h> |
9 #include <linux/input.h> | 9 #include <linux/input.h> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 EventReaderLibevdevCros::EventReaderLibevdevCros(int fd, | 28 EventReaderLibevdevCros::EventReaderLibevdevCros(int fd, |
29 const base::FilePath& path, | 29 const base::FilePath& path, |
30 int id, | 30 int id, |
31 InputDeviceType type, | 31 InputDeviceType type, |
32 const EventDeviceInfo& devinfo, | 32 const EventDeviceInfo& devinfo, |
33 scoped_ptr<Delegate> delegate) | 33 scoped_ptr<Delegate> delegate) |
34 : EventConverterEvdev(fd, path, id, type), | 34 : EventConverterEvdev(fd, path, id, type), |
35 has_keyboard_(devinfo.HasKeyboard()), | 35 has_keyboard_(devinfo.HasKeyboard()), |
36 has_mouse_(devinfo.HasMouse()), | 36 has_mouse_(devinfo.HasMouse()), |
37 has_touchpad_(devinfo.HasTouchpad()), | 37 has_touchpad_(devinfo.HasTouchpad()), |
| 38 has_caps_lock_led_(devinfo.HasLedEvent(LED_CAPSL)), |
38 delegate_(delegate.Pass()) { | 39 delegate_(delegate.Pass()) { |
39 memset(&evdev_, 0, sizeof(evdev_)); | 40 memset(&evdev_, 0, sizeof(evdev_)); |
40 evdev_.log = OnLogMessage; | 41 evdev_.log = OnLogMessage; |
41 evdev_.log_udata = this; | 42 evdev_.log_udata = this; |
42 evdev_.syn_report = OnSynReport; | 43 evdev_.syn_report = OnSynReport; |
43 evdev_.syn_report_udata = this; | 44 evdev_.syn_report_udata = this; |
44 evdev_.fd = fd; | 45 evdev_.fd = fd; |
45 | 46 |
46 memset(&evstate_, 0, sizeof(evstate_)); | 47 memset(&evstate_, 0, sizeof(evstate_)); |
47 evdev_.evstate = &evstate_; | 48 evdev_.evstate = &evstate_; |
(...skipping 27 matching lines...) Expand all Loading... |
75 } | 76 } |
76 | 77 |
77 bool EventReaderLibevdevCros::HasMouse() const { | 78 bool EventReaderLibevdevCros::HasMouse() const { |
78 return has_mouse_; | 79 return has_mouse_; |
79 } | 80 } |
80 | 81 |
81 bool EventReaderLibevdevCros::HasTouchpad() const { | 82 bool EventReaderLibevdevCros::HasTouchpad() const { |
82 return has_touchpad_; | 83 return has_touchpad_; |
83 } | 84 } |
84 | 85 |
| 86 bool EventReaderLibevdevCros::HasCapsLockLed() const { |
| 87 return has_caps_lock_led_; |
| 88 } |
| 89 |
85 void EventReaderLibevdevCros::SetAllowedKeys( | 90 void EventReaderLibevdevCros::SetAllowedKeys( |
86 scoped_ptr<std::set<DomCode>> allowed_keys) { | 91 scoped_ptr<std::set<DomCode>> allowed_keys) { |
87 DCHECK(HasKeyboard()); | 92 DCHECK(HasKeyboard()); |
88 delegate_->SetAllowedKeys(allowed_keys.Pass()); | 93 delegate_->SetAllowedKeys(allowed_keys.Pass()); |
89 } | 94 } |
90 | 95 |
91 void EventReaderLibevdevCros::AllowAllKeys() { | 96 void EventReaderLibevdevCros::AllowAllKeys() { |
92 DCHECK(HasKeyboard()); | 97 DCHECK(HasKeyboard()); |
93 delegate_->AllowAllKeys(); | 98 delegate_->AllowAllKeys(); |
94 } | 99 } |
(...skipping 19 matching lines...) Expand all Loading... |
114 if (level >= LOGLEVEL_ERROR) | 119 if (level >= LOGLEVEL_ERROR) |
115 LOG(ERROR) << "libevdev: " << FormatLog(fmt, args); | 120 LOG(ERROR) << "libevdev: " << FormatLog(fmt, args); |
116 else if (level >= LOGLEVEL_WARNING) | 121 else if (level >= LOGLEVEL_WARNING) |
117 LOG(WARNING) << "libevdev: " << FormatLog(fmt, args); | 122 LOG(WARNING) << "libevdev: " << FormatLog(fmt, args); |
118 else | 123 else |
119 VLOG(3) << "libevdev: " << FormatLog(fmt, args); | 124 VLOG(3) << "libevdev: " << FormatLog(fmt, args); |
120 va_end(args); | 125 va_end(args); |
121 } | 126 } |
122 | 127 |
123 } // namespace ui | 128 } // namespace ui |
OLD | NEW |