diff options
author | Zach Eveland <zeveland@blacklabel-development.com> | 2012-01-10 14:25:40 -0500 |
---|---|---|
committer | Zach Eveland <zeveland@blacklabel-development.com> | 2012-01-10 14:25:40 -0500 |
commit | 59ef51d752db28757184565c452640d323440480 (patch) | |
tree | dd557baf343b2c83e149f71ab9aa126d6e90b1b8 /bootloaders/diskloader/src | |
parent | 989f672d345c71478102d9778d551c4637e88ab5 (diff) |
fix bug in handling of long descriptors for bootloader USB (thank you, Todd Krein, Limor Fried, and Phillip Torrone)
descriptors longer than 255 bytes were being shortened, causing problems with enumeration under Windows
Diffstat (limited to 'bootloaders/diskloader/src')
-rw-r--r-- | bootloaders/diskloader/src/USBCore.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bootloaders/diskloader/src/USBCore.cpp b/bootloaders/diskloader/src/USBCore.cpp index 0467e46..a234596 100644 --- a/bootloaders/diskloader/src/USBCore.cpp +++ b/bootloaders/diskloader/src/USBCore.cpp @@ -351,7 +351,7 @@ u8 _cdcComposite = 0; bool SendDescriptor() { Setup& setup = _setup; - u8 desc_length = 0; + u16 desc_length = 0; const u8* desc_addr = 0; u8 t = setup.wValueH; @@ -387,13 +387,13 @@ bool SendDescriptor() if (desc_length == 0) desc_length = pgm_read_byte(desc_addr); - if ((u8)setup.wLength < desc_length) // bit of a cheat limiting to 255 bytes TODO (saved 8 bytes) - desc_length = (u8)setup.wLength; + if (setup.wLength < desc_length) + desc_length = setup.wLength; // Send descriptor // EP0 is 64 bytes long // RWAL and FIFOCON don't work on EP0 - u8 n = 0; + u16 n = 0; do { if (!WaitForINOrOUT()) |