| Index: ui/events/ozone/evdev/event_converter.cc
|
| diff --git a/ui/events/ozone/evdev/event_converter.cc b/ui/events/ozone/evdev/event_converter.cc
|
| index 2454373f9b8409aec9c683c7d56d7b4368cde01a..eea392ded6e4c3770d6ee142a5132398f1616ef9 100644
|
| --- a/ui/events/ozone/evdev/event_converter.cc
|
| +++ b/ui/events/ozone/evdev/event_converter.cc
|
| @@ -19,7 +19,17 @@ EventConverterEvdev::EventConverterEvdev(int fd,
|
| EventModifiersEvdev* modifiers)
|
| : fd_(fd), path_(path), modifiers_(modifiers) {}
|
|
|
| -EventConverterEvdev::~EventConverterEvdev() { close(fd_); }
|
| +EventConverterEvdev::~EventConverterEvdev() {
|
| + Stop();
|
| + close(fd_);
|
| +}
|
| +
|
| +void EventConverterEvdev::Start() {
|
| + base::MessagePumpOzone::Current()->WatchFileDescriptor(
|
| + fd_, true, base::MessagePumpLibevent::WATCH_READ, &controller_, this);
|
| +}
|
| +
|
| +void EventConverterEvdev::Stop() { controller_.StopWatchingFileDescriptor(); }
|
|
|
| void EventConverterEvdev::OnFileCanReadWithoutBlocking(int fd) {
|
| input_event inputs[kEvdevBufferSize];
|
| @@ -28,6 +38,7 @@ void EventConverterEvdev::OnFileCanReadWithoutBlocking(int fd) {
|
| if (errno == EINTR || errno == EAGAIN)
|
| return;
|
| PLOG(ERROR) << "error reading device " << path_.value();
|
| + Stop();
|
| return;
|
| }
|
|
|
|
|