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

Unified Diff: device/usb/usb_device_handle_impl.cc

Issue 601073002: Move string descriptor getters from UsbDeviceHandle to UsbDevice. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: device/usb/usb_device_handle_impl.cc
diff --git a/device/usb/usb_device_handle_impl.cc b/device/usb/usb_device_handle_impl.cc
index 2d8c69018474261eb4440ec55f6b7cfbd2a6c601..a65d38a71f8dbe0be26f0349be3034ae31a9798f 100644
--- a/device/usb/usb_device_handle_impl.cc
+++ b/device/usb/usb_device_handle_impl.cc
@@ -459,66 +459,6 @@ bool UsbDeviceHandleImpl::GetStringDescriptor(uint8 string_id,
return false;
}
-bool UsbDeviceHandleImpl::GetManufacturer(base::string16* manufacturer) {
- DCHECK(thread_checker_.CalledOnValidThread());
- PlatformUsbDevice device = libusb_get_device(handle_);
- libusb_device_descriptor desc;
-
- // This is a non-blocking call as libusb has the descriptor in memory.
- const int rv = libusb_get_device_descriptor(device, &desc);
- if (rv != LIBUSB_SUCCESS) {
- VLOG(1) << "Failed to read device descriptor: "
- << ConvertPlatformUsbErrorToString(rv);
- return false;
- }
-
- if (desc.iManufacturer == 0) {
- return false;
- }
-
- return GetStringDescriptor(desc.iManufacturer, manufacturer);
-}
-
-bool UsbDeviceHandleImpl::GetProduct(base::string16* product) {
- DCHECK(thread_checker_.CalledOnValidThread());
- PlatformUsbDevice device = libusb_get_device(handle_);
- libusb_device_descriptor desc;
-
- // This is a non-blocking call as libusb has the descriptor in memory.
- const int rv = libusb_get_device_descriptor(device, &desc);
- if (rv != LIBUSB_SUCCESS) {
- VLOG(1) << "Failed to read device descriptor: "
- << ConvertPlatformUsbErrorToString(rv);
- return false;
- }
-
- if (desc.iProduct == 0) {
- return false;
- }
-
- return GetStringDescriptor(desc.iProduct, product);
-}
-
-bool UsbDeviceHandleImpl::GetSerial(base::string16* serial) {
- DCHECK(thread_checker_.CalledOnValidThread());
- PlatformUsbDevice device = libusb_get_device(handle_);
- libusb_device_descriptor desc;
-
- // This is a non-blocking call as libusb has the descriptor in memory.
- const int rv = libusb_get_device_descriptor(device, &desc);
- if (rv != LIBUSB_SUCCESS) {
- VLOG(1) << "Failed to read device descriptor: "
- << ConvertPlatformUsbErrorToString(rv);
- return false;
- }
-
- if (desc.iSerialNumber == 0) {
- return false;
- }
-
- return GetStringDescriptor(desc.iSerialNumber, serial);
-}
-
void UsbDeviceHandleImpl::ControlTransfer(
const UsbEndpointDirection direction,
const TransferRequestType request_type,

Powered by Google App Engine
This is Rietveld 408576698