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

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

Issue 2567253004: 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 "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file.h" 10 #include "base/files/file.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 } 241 }
242 } 242 }
243 243
244 void UsbServiceLinux::DeviceReady(scoped_refptr<UsbDeviceLinux> device, 244 void UsbServiceLinux::DeviceReady(scoped_refptr<UsbDeviceLinux> device,
245 bool success) { 245 bool success) {
246 DCHECK(CalledOnValidThread()); 246 DCHECK(CalledOnValidThread());
247 247
248 bool enumeration_became_ready = false; 248 bool enumeration_became_ready = false;
249 if (!enumeration_ready()) { 249 if (!enumeration_ready()) {
250 DCHECK_GT(first_enumeration_countdown_, 0u); 250 DCHECK_GT(first_enumeration_countdown_, 0u);
251 if (--first_enumeration_countdown_ == 0) 251 first_enumeration_countdown_--;
252 if (enumeration_ready())
252 enumeration_became_ready = true; 253 enumeration_became_ready = true;
253 } 254 }
254 255
255 // If |device| was disconnected while descriptors were being read then it 256 // If |device| was disconnected while descriptors were being read then it
256 // will have been removed from |devices_by_path_|. 257 // will have been removed from |devices_by_path_|.
257 auto it = devices_by_path_.find(device->device_path()); 258 auto it = devices_by_path_.find(device->device_path());
258 if (it == devices_by_path_.end()) { 259 if (it == devices_by_path_.end()) {
259 success = false; 260 success = false;
260 } else if (success) { 261 } else if (success) {
261 DCHECK(!base::ContainsKey(devices(), device->guid())); 262 DCHECK(!base::ContainsKey(devices(), device->guid()));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 result.reserve(devices().size()); 313 result.reserve(devices().size());
313 for (const auto& map_entry : devices()) 314 for (const auto& map_entry : devices())
314 result.push_back(map_entry.second); 315 result.push_back(map_entry.second);
315 for (const auto& callback : enumeration_callbacks_) 316 for (const auto& callback : enumeration_callbacks_)
316 callback.Run(result); 317 callback.Run(result);
317 enumeration_callbacks_.clear(); 318 enumeration_callbacks_.clear();
318 } 319 }
319 } 320 }
320 321
321 } // namespace device 322 } // 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