| 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 | 
| new file mode 100644 | 
| index 0000000000000000000000000000000000000000..2454373f9b8409aec9c683c7d56d7b4368cde01a | 
| --- /dev/null | 
| +++ b/ui/events/ozone/evdev/event_converter.cc | 
| @@ -0,0 +1,42 @@ | 
| +// Copyright 2014 The Chromium Authors. All rights reserved. | 
| +// Use of this source code is governed by a BSD-style license that can be | 
| +// found in the LICENSE file. | 
| + | 
| +#include "ui/events/ozone/evdev/event_converter.h" | 
| + | 
| +#include <errno.h> | 
| +#include <linux/input.h> | 
| + | 
| +#include "ui/events/ozone/evdev/event_modifiers.h" | 
| + | 
| +namespace ui { | 
| + | 
| +// Number of events to read at a time. | 
| +const int kEvdevBufferSize = 64; | 
| + | 
| +EventConverterEvdev::EventConverterEvdev(int fd, | 
| +                                         base::FilePath path, | 
| +                                         EventModifiersEvdev* modifiers) | 
| +    : fd_(fd), path_(path), modifiers_(modifiers) {} | 
| + | 
| +EventConverterEvdev::~EventConverterEvdev() { close(fd_); } | 
| + | 
| +void EventConverterEvdev::OnFileCanReadWithoutBlocking(int fd) { | 
| +  input_event inputs[kEvdevBufferSize]; | 
| +  ssize_t read_size = read(fd, inputs, sizeof(inputs)); | 
| +  if (read_size <= 0) { | 
| +    if (errno == EINTR || errno == EAGAIN) | 
| +      return; | 
| +    PLOG(ERROR) << "error reading device " << path_.value(); | 
| +    return; | 
| +  } | 
| + | 
| +  CHECK_EQ(read_size % sizeof(*inputs), 0u); | 
| +  ProcessEvents(inputs, read_size / sizeof(*inputs)); | 
| +} | 
| + | 
| +void EventConverterEvdev::OnFileCanWriteWithoutBlocking(int fd) { | 
| +  NOTREACHED(); | 
| +} | 
| + | 
| +}  // namespace ui | 
|  |