OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/usb/usb_service_linux.h" | 5 #include "device/usb/usb_service_linux.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 DCHECK_GT(first_enumeration_countdown_, 0u); | 245 DCHECK_GT(first_enumeration_countdown_, 0u); |
246 if (--first_enumeration_countdown_ == 0) | 246 if (--first_enumeration_countdown_ == 0) |
247 enumeration_became_ready = true; | 247 enumeration_became_ready = true; |
248 } | 248 } |
249 | 249 |
250 // If |device| was disconnected while descriptors were being read then it | 250 // If |device| was disconnected while descriptors were being read then it |
251 // will have been removed from |devices_by_path_|. | 251 // will have been removed from |devices_by_path_|. |
252 auto it = devices_by_path_.find(device->device_path()); | 252 auto it = devices_by_path_.find(device->device_path()); |
253 if (it != devices_by_path_.end()) { | 253 if (it != devices_by_path_.end()) { |
254 if (success) { | 254 if (success) { |
255 DCHECK(!ContainsKey(devices(), device->guid())); | 255 DCHECK(!base::ContainsKey(devices(), device->guid())); |
256 devices()[device->guid()] = device; | 256 devices()[device->guid()] = device; |
257 | 257 |
258 USB_LOG(USER) << "USB device added: path=" << device->device_path() | 258 USB_LOG(USER) << "USB device added: path=" << device->device_path() |
259 << " vendor=" << device->vendor_id() << " \"" | 259 << " vendor=" << device->vendor_id() << " \"" |
260 << device->manufacturer_string() | 260 << device->manufacturer_string() |
261 << "\", product=" << device->product_id() << " \"" | 261 << "\", product=" << device->product_id() << " \"" |
262 << device->product_string() << "\", serial=\"" | 262 << device->product_string() << "\", serial=\"" |
263 << device->serial_number() << "\", guid=" << device->guid(); | 263 << device->serial_number() << "\", guid=" << device->guid(); |
264 } else { | 264 } else { |
265 devices_by_path_.erase(it); | 265 devices_by_path_.erase(it); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 result.reserve(devices().size()); | 307 result.reserve(devices().size()); |
308 for (const auto& map_entry : devices()) | 308 for (const auto& map_entry : devices()) |
309 result.push_back(map_entry.second); | 309 result.push_back(map_entry.second); |
310 for (const auto& callback : enumeration_callbacks_) | 310 for (const auto& callback : enumeration_callbacks_) |
311 callback.Run(result); | 311 callback.Run(result); |
312 enumeration_callbacks_.clear(); | 312 enumeration_callbacks_.clear(); |
313 } | 313 } |
314 } | 314 } |
315 | 315 |
316 } // namespace device | 316 } // namespace device |
OLD | NEW |