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

Unified Diff: device/usb/usb_descriptors.cc

Issue 2849893003: Shorten USB enumeration control transfer timeouts to 2 seconds (Closed)
Patch Set: Add units to the constant name Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | device/usb/webusb_descriptors.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/usb/usb_descriptors.cc
diff --git a/device/usb/usb_descriptors.cc b/device/usb/usb_descriptors.cc
index 645ee5631547d2b89ee0acdc7d75968532e8728d..ae25c1b79c68c2b26d026aad82c16f9267309467 100644
--- a/device/usb/usb_descriptors.cc
+++ b/device/usb/usb_descriptors.cc
@@ -41,7 +41,7 @@ const uint8_t kInterfaceDescriptorLength = 9;
const uint8_t kEndpointDescriptorLength = 7;
const uint8_t kInterfaceAssociationDescriptorLength = 8;
-const int kControlTransferTimeout = 60000; // 1 minute
+const int kControlTransferTimeoutMs = 2000; // 2 seconds
struct UsbInterfaceAssociationDescriptor {
UsbInterfaceAssociationDescriptor(uint8_t first_interface,
@@ -123,7 +123,7 @@ void OnReadConfigDescriptorHeader(scoped_refptr<UsbDeviceHandle> device_handle,
UsbTransferDirection::INBOUND, UsbControlTransferType::STANDARD,
UsbControlTransferRecipient::DEVICE, kGetDescriptorRequest,
kConfigurationDescriptorType << 8 | index, 0, buffer, total_length,
- kControlTransferTimeout,
+ kControlTransferTimeoutMs,
base::Bind(&OnReadConfigDescriptor, desc, closure));
} else {
LOG(ERROR) << "Failed to read length for configuration "
@@ -169,7 +169,7 @@ void OnReadDeviceDescriptor(
UsbTransferDirection::INBOUND, UsbControlTransferType::STANDARD,
UsbControlTransferRecipient::DEVICE, kGetDescriptorRequest,
kConfigurationDescriptorType << 8 | i, 0, header, header->size(),
- kControlTransferTimeout,
+ kControlTransferTimeoutMs,
base::Bind(&OnReadConfigDescriptorHeader, device_handle, desc_ptr, i,
closure));
}
@@ -208,7 +208,7 @@ void ReadStringDescriptor(
UsbTransferDirection::INBOUND, UsbControlTransferType::STANDARD,
UsbControlTransferRecipient::DEVICE, kGetDescriptorRequest,
kStringDescriptorType << 8 | index, language_id, buffer, buffer->size(),
- kControlTransferTimeout, base::Bind(&OnReadStringDescriptor, callback));
+ kControlTransferTimeoutMs, base::Bind(&OnReadStringDescriptor, callback));
}
void OnReadLanguageIds(scoped_refptr<UsbDeviceHandle> device_handle,
@@ -503,7 +503,7 @@ void ReadUsbDescriptors(scoped_refptr<UsbDeviceHandle> device_handle,
UsbTransferDirection::INBOUND, UsbControlTransferType::STANDARD,
UsbControlTransferRecipient::DEVICE, kGetDescriptorRequest,
kDeviceDescriptorType << 8, 0, buffer, buffer->size(),
- kControlTransferTimeout,
+ kControlTransferTimeoutMs,
base::Bind(&OnReadDeviceDescriptor, device_handle, callback));
}
« no previous file with comments | « no previous file | device/usb/webusb_descriptors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698