| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/key_event_converter.h" | 5 #include "ui/events/ozone/evdev/key_event_converter.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <linux/input.h> | 8 #include <linux/input.h> |
| 9 | 9 |
| 10 #include "base/message_loop/message_pump_ozone.h" | 10 #include "base/message_loop/message_pump_ozone.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 void KeyEventConverterEvdev::Stop() { | 208 void KeyEventConverterEvdev::Stop() { |
| 209 controller_.StopWatchingFileDescriptor(); | 209 controller_.StopWatchingFileDescriptor(); |
| 210 } | 210 } |
| 211 | 211 |
| 212 void KeyEventConverterEvdev::OnFileCanReadWithoutBlocking(int fd) { | 212 void KeyEventConverterEvdev::OnFileCanReadWithoutBlocking(int fd) { |
| 213 input_event inputs[4]; | 213 input_event inputs[4]; |
| 214 ssize_t read_size = read(fd, inputs, sizeof(inputs)); | 214 ssize_t read_size = read(fd, inputs, sizeof(inputs)); |
| 215 if (read_size < 0) { | 215 if (read_size < 0) { |
| 216 if (errno == EINTR || errno == EAGAIN) | 216 if (errno == EINTR || errno == EAGAIN) |
| 217 return; | 217 return; |
| 218 PLOG(ERROR) << "error reading device " << path_.value(); | 218 if (errno != ENODEV) |
| 219 PLOG(ERROR) << "error reading device " << path_.value(); |
| 219 Stop(); | 220 Stop(); |
| 220 return; | 221 return; |
| 221 } | 222 } |
| 222 | 223 |
| 223 CHECK_EQ(read_size % sizeof(*inputs), 0u); | 224 CHECK_EQ(read_size % sizeof(*inputs), 0u); |
| 224 ProcessEvents(inputs, read_size / sizeof(*inputs)); | 225 ProcessEvents(inputs, read_size / sizeof(*inputs)); |
| 225 } | 226 } |
| 226 | 227 |
| 227 void KeyEventConverterEvdev::OnFileCanWriteWithoutBlocking(int fd) { | 228 void KeyEventConverterEvdev::OnFileCanWriteWithoutBlocking(int fd) { |
| 228 NOTREACHED(); | 229 NOTREACHED(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 257 } | 258 } |
| 258 | 259 |
| 259 int flags = modifiers_->GetModifierFlags(); | 260 int flags = modifiers_->GetModifierFlags(); |
| 260 | 261 |
| 261 scoped_ptr<KeyEvent> key_event( | 262 scoped_ptr<KeyEvent> key_event( |
| 262 new KeyEvent(down ? ET_KEY_PRESSED : ET_KEY_RELEASED, code, flags, true)); | 263 new KeyEvent(down ? ET_KEY_PRESSED : ET_KEY_RELEASED, code, flags, true)); |
| 263 DispatchEvent(key_event.PassAs<ui::Event>()); | 264 DispatchEvent(key_event.PassAs<ui::Event>()); |
| 264 } | 265 } |
| 265 | 266 |
| 266 } // namespace ui | 267 } // namespace ui |
| OLD | NEW |