From 59ef51d752db28757184565c452640d323440480 Mon Sep 17 00:00:00 2001 From: Zach Eveland Date: Tue, 10 Jan 2012 14:25:40 -0500 Subject: 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 --- bootloaders/diskloader/src/USBCore.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'bootloaders/diskloader/src') 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()) -- cgit v1.2.3-18-g5258