| 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/touch_event_converter.h" | 5 #include "ui/events/ozone/evdev/touch_event_converter.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <linux/input.h> | 9 #include <linux/input.h> |
| 10 #include <poll.h> | 10 #include <poll.h> |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // Read-only file-descriptors. | 114 // Read-only file-descriptors. |
| 115 NOTREACHED(); | 115 NOTREACHED(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void TouchEventConverterEvdev::OnFileCanReadWithoutBlocking(int fd) { | 118 void TouchEventConverterEvdev::OnFileCanReadWithoutBlocking(int fd) { |
| 119 input_event inputs[MAX_FINGERS * 6 + 1]; | 119 input_event inputs[MAX_FINGERS * 6 + 1]; |
| 120 ssize_t read_size = read(fd, inputs, sizeof(inputs)); | 120 ssize_t read_size = read(fd, inputs, sizeof(inputs)); |
| 121 if (read_size < 0) { | 121 if (read_size < 0) { |
| 122 if (errno == EINTR || errno == EAGAIN) | 122 if (errno == EINTR || errno == EAGAIN) |
| 123 return; | 123 return; |
| 124 PLOG(ERROR) << "error reading device " << path_.value(); | 124 if (errno != ENODEV) |
| 125 PLOG(ERROR) << "error reading device " << path_.value(); |
| 125 Stop(); | 126 Stop(); |
| 126 return; | 127 return; |
| 127 } | 128 } |
| 128 | 129 |
| 129 for (unsigned i = 0; i < read_size / sizeof(*inputs); i++) { | 130 for (unsigned i = 0; i < read_size / sizeof(*inputs); i++) { |
| 130 const input_event& input = inputs[i]; | 131 const input_event& input = inputs[i]; |
| 131 if (input.type == EV_ABS) { | 132 if (input.type == EV_ABS) { |
| 132 switch (input.code) { | 133 switch (input.code) { |
| 133 case ABS_MT_TOUCH_MAJOR: | 134 case ABS_MT_TOUCH_MAJOR: |
| 134 altered_slots_.set(current_slot_); | 135 altered_slots_.set(current_slot_); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 default: | 207 default: |
| 207 NOTREACHED() << "invalid code for EV_KEY: " << input.code; | 208 NOTREACHED() << "invalid code for EV_KEY: " << input.code; |
| 208 } | 209 } |
| 209 } else { | 210 } else { |
| 210 NOTREACHED() << "invalid type: " << input.type; | 211 NOTREACHED() << "invalid type: " << input.type; |
| 211 } | 212 } |
| 212 } | 213 } |
| 213 } | 214 } |
| 214 | 215 |
| 215 } // namespace ui | 216 } // namespace ui |
| OLD | NEW |