OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/gamepad/gamepad_platform_data_fetcher_linux.h" | 5 #include "content/browser/gamepad/gamepad_platform_data_fetcher_linux.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <linux/joystick.h> | 8 #include <linux/joystick.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include <sys/stat.h> | 10 #include <sys/stat.h> |
11 #include <sys/types.h> | 11 #include <sys/types.h> |
12 #include <unistd.h> | 12 #include <unistd.h> |
13 | 13 |
14 #include "base/debug/trace_event.h" | |
15 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
16 #include "base/posix/eintr_wrapper.h" | 15 #include "base/posix/eintr_wrapper.h" |
17 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
18 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
19 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
20 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 20 #include "base/trace_event/trace_event.h" |
21 #include "content/browser/udev_linux.h" | 21 #include "content/browser/udev_linux.h" |
22 #include "device/udev_linux/scoped_udev.h" | 22 #include "device/udev_linux/scoped_udev.h" |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 const char kInputSubsystem[] = "input"; | 26 const char kInputSubsystem[] = "input"; |
27 const char kUsbSubsystem[] = "usb"; | 27 const char kUsbSubsystem[] = "usb"; |
28 const char kUsbDeviceType[] = "usb_device"; | 28 const char kUsbDeviceType[] = "usb_device"; |
29 const float kMaxLinuxAxisValue = 32767.0; | 29 const float kMaxLinuxAxisValue = 32767.0; |
30 | 30 |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 pad.buttons[item].pressed = event.value; | 260 pad.buttons[item].pressed = event.value; |
261 pad.buttons[item].value = event.value ? 1.0 : 0.0; | 261 pad.buttons[item].value = event.value ? 1.0 : 0.0; |
262 if (item >= pad.buttonsLength) | 262 if (item >= pad.buttonsLength) |
263 pad.buttonsLength = item + 1; | 263 pad.buttonsLength = item + 1; |
264 } | 264 } |
265 pad.timestamp = event.time; | 265 pad.timestamp = event.time; |
266 } | 266 } |
267 } | 267 } |
268 | 268 |
269 } // namespace content | 269 } // namespace content |
OLD | NEW |