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

Side by Side Diff: device/usb/usb_service_linux.cc

Issue 2523403002: Fix initial USB enumeration on Linux to return all devices. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <utility> 9 #include <utility>
10 10
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 } 246 }
247 } 247 }
248 248
249 void UsbServiceLinux::DeviceReady(scoped_refptr<UsbDeviceLinux> device, 249 void UsbServiceLinux::DeviceReady(scoped_refptr<UsbDeviceLinux> device,
250 bool success) { 250 bool success) {
251 DCHECK(CalledOnValidThread()); 251 DCHECK(CalledOnValidThread());
252 252
253 bool enumeration_became_ready = false; 253 bool enumeration_became_ready = false;
254 if (!enumeration_ready()) { 254 if (!enumeration_ready()) {
255 DCHECK_GT(first_enumeration_countdown_, 0u); 255 DCHECK_GT(first_enumeration_countdown_, 0u);
256 if (--first_enumeration_countdown_ == 0) 256 first_enumeration_countdown_--;
257 if (enumeration_ready())
257 enumeration_became_ready = true; 258 enumeration_became_ready = true;
258 } 259 }
259 260
260 // If |device| was disconnected while descriptors were being read then it 261 // If |device| was disconnected while descriptors were being read then it
261 // will have been removed from |devices_by_path_|. 262 // will have been removed from |devices_by_path_|.
262 auto it = devices_by_path_.find(device->device_path()); 263 auto it = devices_by_path_.find(device->device_path());
263 if (it == devices_by_path_.end()) { 264 if (it == devices_by_path_.end()) {
264 success = false; 265 success = false;
265 } else if (success) { 266 } else if (success) {
266 DCHECK(!base::ContainsKey(devices(), device->guid())); 267 DCHECK(!base::ContainsKey(devices(), device->guid()));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 result.reserve(devices().size()); 318 result.reserve(devices().size());
318 for (const auto& map_entry : devices()) 319 for (const auto& map_entry : devices())
319 result.push_back(map_entry.second); 320 result.push_back(map_entry.second);
320 for (const auto& callback : enumeration_callbacks_) 321 for (const auto& callback : enumeration_callbacks_)
321 callback.Run(result); 322 callback.Run(result);
322 enumeration_callbacks_.clear(); 323 enumeration_callbacks_.clear();
323 } 324 }
324 } 325 }
325 326
326 } // namespace device 327 } // namespace device
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698