| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "device/hid/hid_service_linux.h" | 5 #include "device/hid/hid_service_linux.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/strings/string_piece.h" | 16 #include "base/strings/string_piece.h" |
| 17 #include "base/strings/string_split.h" | 17 #include "base/strings/string_split.h" |
| 18 #include "base/thread_task_runner_handle.h" | 18 #include "base/thread_task_runner_handle.h" |
| 19 #include "base/threading/thread_restrictions.h" | 19 #include "base/threading/thread_restrictions.h" |
| 20 #include "device/hid/hid_connection_linux.h" | 20 #include "device/hid/hid_connection_linux.h" |
| 21 #include "device/hid/hid_device_info.h" | 21 #include "device/hid/hid_device_info.h" |
| 22 #include "device/hid/hid_report_descriptor.h" | 22 #include "device/hid/hid_report_descriptor.h" |
| 23 #include "device/udev_linux/udev.h" | 23 #include "device/udev_linux/scoped_udev.h" |
| 24 | 24 |
| 25 #if defined(OS_CHROMEOS) | 25 #if defined(OS_CHROMEOS) |
| 26 #include "base/sys_info.h" | 26 #include "base/sys_info.h" |
| 27 #include "chromeos/dbus/dbus_thread_manager.h" | 27 #include "chromeos/dbus/dbus_thread_manager.h" |
| 28 #include "chromeos/dbus/permission_broker_client.h" | 28 #include "chromeos/dbus/permission_broker_client.h" |
| 29 #endif // defined(OS_CHROMEOS) | 29 #endif // defined(OS_CHROMEOS) |
| 30 | 30 |
| 31 namespace device { | 31 namespace device { |
| 32 | 32 |
| 33 namespace { | 33 namespace { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 const char* subsystem = udev_device_get_subsystem(device); | 139 const char* subsystem = udev_device_get_subsystem(device); |
| 140 if (!subsystem || strcmp(subsystem, kHidrawSubsystem) != 0) | 140 if (!subsystem || strcmp(subsystem, kHidrawSubsystem) != 0) |
| 141 return; | 141 return; |
| 142 | 142 |
| 143 HidDeviceInfo device_info; | 143 HidDeviceInfo device_info; |
| 144 device_info.device_id = device_path; | 144 device_info.device_id = device_path; |
| 145 | 145 |
| 146 uint32_t int_property = 0; | 146 uint32_t int_property = 0; |
| 147 const char* str_property = NULL; | 147 const char* str_property = NULL; |
| 148 | 148 |
| 149 udev_device *parent = udev_device_get_parent(device); | 149 udev_device* parent = udev_device_get_parent(device); |
| 150 if (!parent) { | 150 if (!parent) { |
| 151 return; | 151 return; |
| 152 } | 152 } |
| 153 | 153 |
| 154 const char* hid_id = udev_device_get_property_value(parent, kHIDID); | 154 const char* hid_id = udev_device_get_property_value(parent, kHIDID); |
| 155 if (!hid_id) { | 155 if (!hid_id) { |
| 156 return; | 156 return; |
| 157 } | 157 } |
| 158 | 158 |
| 159 std::vector<std::string> parts; | 159 std::vector<std::string> parts; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 222 |
| 223 const auto& map_entry = devices().find(device_id); | 223 const auto& map_entry = devices().find(device_id); |
| 224 if (map_entry == devices().end()) { | 224 if (map_entry == devices().end()) { |
| 225 callback.Run(nullptr); | 225 callback.Run(nullptr); |
| 226 } | 226 } |
| 227 | 227 |
| 228 callback.Run(new HidConnectionLinux(map_entry->second, device_node)); | 228 callback.Run(new HidConnectionLinux(map_entry->second, device_node)); |
| 229 } | 229 } |
| 230 | 230 |
| 231 } // namespace device | 231 } // namespace device |
| OLD | NEW |