aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCristian Maglie <c.maglie@bug.st>2012-10-19 15:02:31 +0200
committerCristian Maglie <c.maglie@bug.st>2012-10-19 15:02:31 +0200
commit4fc3fc3d761b0795501005d297e4bc2b81394a1f (patch)
tree4ddacc2af4d3b51f757891cbdca45a758af8023f
parent0051c6e1636b0c111eb3865df1646bcd2d726789 (diff)
parented855244be1c69eefd8202de13d363d82bc770c0 (diff)
Merge branch 'master' of github.com:arduino/ARM
-rw-r--r--sam/cores/arduino/USB/USBCore.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/sam/cores/arduino/USB/USBCore.cpp b/sam/cores/arduino/USB/USBCore.cpp
index a6b3191..f4607d2 100644
--- a/sam/cores/arduino/USB/USBCore.cpp
+++ b/sam/cores/arduino/USB/USBCore.cpp
@@ -385,11 +385,14 @@ static bool USBD_SendDescriptor(Setup& setup)
if (USB_DEVICE_DESCRIPTOR_TYPE == t)
{
TRACE_CORE(puts("=> USBD_SendDescriptor : USB_DEVICE_DESCRIPTOR_TYPE\r\n");)
- if (setup.wLength == 8)
+ if (setup.wLength >= 8)
{
_cdcComposite = 1;
}
desc_addr = _cdcComposite ? (const uint8_t*)&USB_DeviceDescriptorA : (const uint8_t*)&USB_DeviceDescriptor;
+ if( *desc_addr > setup.wLength ) {
+ desc_length = setup.wLength;
+ }
}
else if (USB_STRING_DESCRIPTOR_TYPE == t)
{