| 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/event_factory.h" | 5 #include "ui/events/ozone/evdev/event_factory.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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 58     return; | 58     return; | 
| 59   } | 59   } | 
| 60 | 60 | 
| 61   if (IsTouchPad(devinfo)) { | 61   if (IsTouchPad(devinfo)) { | 
| 62     LOG(WARNING) << "touchpad device not supported: " << path.value(); | 62     LOG(WARNING) << "touchpad device not supported: " << path.value(); | 
| 63     close(fd); | 63     close(fd); | 
| 64     return; | 64     return; | 
| 65   } | 65   } | 
| 66 | 66 | 
| 67   // TODO(spang) Add more device types. Support hot-plugging. | 67   // TODO(spang) Add more device types. Support hot-plugging. | 
| 68   scoped_ptr<EventConverterOzone> converter; | 68   scoped_ptr<EventConverterEvdev> converter; | 
| 69   if (IsTouchScreen(devinfo)) | 69   if (IsTouchScreen(devinfo)) | 
| 70     converter.reset(new TouchEventConverterEvdev(fd, path)); | 70     converter.reset(new TouchEventConverterEvdev(fd, path)); | 
| 71   else if (devinfo.HasEventType(EV_KEY)) | 71   else if (devinfo.HasEventType(EV_KEY)) | 
| 72     converter.reset(new KeyEventConverterEvdev(fd, path, &modifiers_)); | 72     converter.reset(new KeyEventConverterEvdev(fd, path, &modifiers_)); | 
| 73 | 73 | 
| 74   if (converter) { | 74   if (converter) { | 
| 75     converters_[path] = converter.release(); | 75     converters_[path] = converter.release(); | 
| 76   } else { | 76   } else { | 
| 77     close(fd); | 77     close(fd); | 
| 78   } | 78   } | 
| 79 } | 79 } | 
| 80 | 80 | 
| 81 void EventFactoryEvdev::StartProcessingEvents() { | 81 void EventFactoryEvdev::StartProcessingEvents() { | 
| 82   base::ThreadRestrictions::AssertIOAllowed(); | 82   base::ThreadRestrictions::AssertIOAllowed(); | 
| 83 | 83 | 
| 84   base::FileEnumerator file_enum( | 84   base::FileEnumerator file_enum( | 
| 85       base::FilePath("/dev/input"), false, base::FileEnumerator::FILES); | 85       base::FilePath("/dev/input"), false, base::FileEnumerator::FILES); | 
| 86   for (base::FilePath path = file_enum.Next(); !path.empty(); | 86   for (base::FilePath path = file_enum.Next(); !path.empty(); | 
| 87        path = file_enum.Next()) | 87        path = file_enum.Next()) | 
| 88     AttachInputDevice(path); | 88     AttachInputDevice(path); | 
| 89 } | 89 } | 
| 90 | 90 | 
| 91 }  // namespace ui | 91 }  // namespace ui | 
| OLD | NEW | 
|---|