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

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

Issue 1857033002: Include USB device version in chrome.usb.Device fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 4 years, 8 months 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 | « device/usb/usb_device_impl.cc ('k') | extensions/browser/api/usb/usb_guid_map.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/usb/usb_service_impl.h" 5 #include "device/usb/usb_service_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <list> 8 #include <list>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 483
484 libusb_device_descriptor descriptor; 484 libusb_device_descriptor descriptor;
485 int rv = libusb_get_device_descriptor(platform_device, &descriptor); 485 int rv = libusb_get_device_descriptor(platform_device, &descriptor);
486 if (rv == LIBUSB_SUCCESS) { 486 if (rv == LIBUSB_SUCCESS) {
487 if (descriptor.bDeviceClass == LIBUSB_CLASS_HUB) { 487 if (descriptor.bDeviceClass == LIBUSB_CLASS_HUB) {
488 // Don't try to enumerate hubs. We never want to connect to a hub. 488 // Don't try to enumerate hubs. We never want to connect to a hub.
489 refresh_complete.Run(); 489 refresh_complete.Run();
490 return; 490 return;
491 } 491 }
492 492
493 scoped_refptr<UsbDeviceImpl> device( 493 scoped_refptr<UsbDeviceImpl> device(new UsbDeviceImpl(
494 new UsbDeviceImpl(context_, platform_device, descriptor.idVendor, 494 context_, platform_device, descriptor, blocking_task_runner_));
495 descriptor.idProduct, blocking_task_runner_));
496 base::Closure add_device = 495 base::Closure add_device =
497 base::Bind(&UsbServiceImpl::AddDevice, weak_factory_.GetWeakPtr(), 496 base::Bind(&UsbServiceImpl::AddDevice, weak_factory_.GetWeakPtr(),
498 refresh_complete, device); 497 refresh_complete, device);
499 bool read_bos_descriptors = descriptor.bcdUSB >= kUsbVersion2_1; 498 bool read_bos_descriptors = descriptor.bcdUSB >= kUsbVersion2_1;
500 499
501 #if defined(USE_UDEV) 500 #if defined(USE_UDEV)
502 blocking_task_runner_->PostTask( 501 blocking_task_runner_->PostTask(
503 FROM_HERE, 502 FROM_HERE,
504 base::Bind(&EnumerateUdevDevice, device, read_bos_descriptors, 503 base::Bind(&EnumerateUdevDevice, device, read_bos_descriptors,
505 task_runner_, add_device, refresh_complete)); 504 task_runner_, add_device, refresh_complete));
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 PlatformDeviceMap::iterator it = platform_devices_.find(platform_device); 608 PlatformDeviceMap::iterator it = platform_devices_.find(platform_device);
610 if (it != platform_devices_.end()) { 609 if (it != platform_devices_.end()) {
611 RemoveDevice(it->second); 610 RemoveDevice(it->second);
612 } else { 611 } else {
613 devices_being_enumerated_.erase(platform_device); 612 devices_being_enumerated_.erase(platform_device);
614 } 613 }
615 libusb_unref_device(platform_device); 614 libusb_unref_device(platform_device);
616 } 615 }
617 616
618 } // namespace device 617 } // namespace device
OLDNEW
« no previous file with comments | « device/usb/usb_device_impl.cc ('k') | extensions/browser/api/usb/usb_guid_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698