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/usb/usb_service_impl.h" | 5 #include "device/usb/usb_service_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <list> | 8 #include <list> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 USB_PLOG(ERROR) << "Failed to get device service property"; | 120 USB_PLOG(ERROR) << "Failed to get device service property"; |
121 return false; | 121 return false; |
122 } | 122 } |
123 if (reg_data_type != REG_SZ) { | 123 if (reg_data_type != REG_SZ) { |
124 USB_LOG(ERROR) << "Unexpected data type for driver service: " | 124 USB_LOG(ERROR) << "Unexpected data type for driver service: " |
125 << reg_data_type; | 125 << reg_data_type; |
126 return false; | 126 return false; |
127 } | 127 } |
128 | 128 |
129 USB_LOG(DEBUG) << "Driver for " << device_path << " is " << buffer << "."; | 129 USB_LOG(DEBUG) << "Driver for " << device_path << " is " << buffer << "."; |
130 if (base::strncasecmp("WinUSB", (const char*)&buffer[0], sizeof "WinUSB") == | 130 if (base::StartsWith(reinterpret_cast<const char*>(buffer), "WinUSB", |
131 0) { | 131 base::CompareCase::INSENSITIVE_ASCII)) |
132 return true; | 132 return true; |
133 } | |
134 return false; | 133 return false; |
135 } | 134 } |
136 | 135 |
137 #endif // OS_WIN | 136 #endif // OS_WIN |
138 | 137 |
139 void GetDeviceListOnBlockingThread( | 138 void GetDeviceListOnBlockingThread( |
140 const std::string& new_device_path, | 139 const std::string& new_device_path, |
141 scoped_refptr<UsbContext> usb_context, | 140 scoped_refptr<UsbContext> usb_context, |
142 scoped_refptr<base::SequencedTaskRunner> task_runner, | 141 scoped_refptr<base::SequencedTaskRunner> task_runner, |
143 base::Callback<void(libusb_device**, size_t)> callback) { | 142 base::Callback<void(libusb_device**, size_t)> callback) { |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 if (it != platform_devices_.end()) { | 685 if (it != platform_devices_.end()) { |
687 RemoveDevice(it->second); | 686 RemoveDevice(it->second); |
688 } else { | 687 } else { |
689 DCHECK(ContainsKey(devices_being_enumerated_, platform_device)); | 688 DCHECK(ContainsKey(devices_being_enumerated_, platform_device)); |
690 devices_being_enumerated_.erase(platform_device); | 689 devices_being_enumerated_.erase(platform_device); |
691 } | 690 } |
692 libusb_unref_device(platform_device); | 691 libusb_unref_device(platform_device); |
693 } | 692 } |
694 | 693 |
695 } // namespace device | 694 } // namespace device |
OLD | NEW |