Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: ui/events/ozone/evdev/key_event_converter.cc

Issue 150633005: evdev: Support device hotplug with udev (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add TODOs Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/events/ozone/evdev/event_factory.cc ('k') | ui/events/ozone/evdev/scoped_udev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/event_factory.cc ('k') | ui/events/ozone/evdev/scoped_udev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698