projects
/
pub
/
USBasp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
13935a3
)
Fixed Endpoint_Write_Control_* functions writing more data than expected by the host...
author
Dean Camera
<dean@fourwalledcubicle.com>
Sat, 2 May 2009 13:05:25 +0000
(13:05 +0000)
committer
Dean Camera
<dean@fourwalledcubicle.com>
Sat, 2 May 2009 13:05:25 +0000
(13:05 +0000)
Bootloaders/CDC/BootloaderCDC.c
patch
|
blob
|
blame
|
history
Bootloaders/CDC/BootloaderCDC.h
patch
|
blob
|
blame
|
history
Bootloaders/CDC/Descriptors.c
patch
|
blob
|
blame
|
history
LUFA/Drivers/USB/LowLevel/Endpoint.c
patch
|
blob
|
blame
|
history
diff --git
a/Bootloaders/CDC/BootloaderCDC.c
b/Bootloaders/CDC/BootloaderCDC.c
index
ef8707d
..
f36c4fc
100644
(file)
--- a/
Bootloaders/CDC/BootloaderCDC.c
+++ b/
Bootloaders/CDC/BootloaderCDC.c
@@
-350,7
+350,7
@@
static void WriteNextResponseByte(const uint8_t Response)
/* Select the IN endpoint so that the next data byte can be written */
\r
Endpoint_SelectEndpoint(CDC_TX_EPNUM);
\r
\r
/* Select the IN endpoint so that the next data byte can be written */
\r
Endpoint_SelectEndpoint(CDC_TX_EPNUM);
\r
\r
- /* If
OUT endpoint empty, clear it and wait for the next packet from
the host */
\r
+ /* If
IN endpoint full, clear it and wait util ready for the next packet to
the host */
\r
if (!(Endpoint_IsReadWriteAllowed()))
\r
{
\r
Endpoint_ClearIN();
\r
if (!(Endpoint_IsReadWriteAllowed()))
\r
{
\r
Endpoint_ClearIN();
\r
diff --git
a/Bootloaders/CDC/BootloaderCDC.h
b/Bootloaders/CDC/BootloaderCDC.h
index
7669b83
..
e302a39
100644
(file)
--- a/
Bootloaders/CDC/BootloaderCDC.h
+++ b/
Bootloaders/CDC/BootloaderCDC.h
@@
-82,7
+82,7
@@
#define BOOTLOADER_HWVERSION_MINOR 0x00
\r
\r
/** Eight character bootloader firmware identifier reported to the host when requested */
\r
#define BOOTLOADER_HWVERSION_MINOR 0x00
\r
\r
/** Eight character bootloader firmware identifier reported to the host when requested */
\r
- #define SOFTWARE_IDENTIFIER "LUFA
-
CDC"
\r
+ #define SOFTWARE_IDENTIFIER "LUFACDC"
\r
\r
/* Event Handlers: */
\r
/** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */
\r
\r
/* Event Handlers: */
\r
/** Indicates that this module will catch the USB_Disconnect event when thrown by the library. */
\r
diff --git
a/Bootloaders/CDC/Descriptors.c
b/Bootloaders/CDC/Descriptors.c
index
e9787cf
..
06088d8
100644
(file)
--- a/
Bootloaders/CDC/Descriptors.c
+++ b/
Bootloaders/CDC/Descriptors.c
@@
-198,7
+198,7
@@
USB_Descriptor_String_t LanguageString =
*/
\r
USB_Descriptor_String_t ProductString =
\r
{
\r
*/
\r
USB_Descriptor_String_t ProductString =
\r
{
\r
- .Header = {.Size = USB_STRING_LEN(1
5
), .Type = DTYPE_String},
\r
+ .Header = {.Size = USB_STRING_LEN(1
8
), .Type = DTYPE_String},
\r
\r
.UnicodeString = L"AVR CDC Bootloader"
\r
};
\r
\r
.UnicodeString = L"AVR CDC Bootloader"
\r
};
\r
diff --git
a/LUFA/Drivers/USB/LowLevel/Endpoint.c
b/LUFA/Drivers/USB/LowLevel/Endpoint.c
index
a872a00
..
f4f2bdc
100644
(file)
--- a/
LUFA/Drivers/USB/LowLevel/Endpoint.c
+++ b/
LUFA/Drivers/USB/LowLevel/Endpoint.c
@@
-288,9
+288,11
@@
uint8_t Endpoint_Read_Stream_BE(void* Buffer, uint16_t Length
\r
uint8_t Endpoint_Write_Control_Stream_LE(const void* Buffer, uint16_t Length)
\r
{
\r
\r
uint8_t Endpoint_Write_Control_Stream_LE(const void* Buffer, uint16_t Length)
\r
{
\r
- uint8_t* DataStream = (uint8_t*)Buffer;
\r
+ uint8_t* DataStream
= (uint8_t*)Buffer;
\r
bool LastPacketFull = false;
\r
bool LastPacketFull = false;
\r
- bool ShortTransfer = (Length < USB_ControlRequest.wLength);
\r
+
\r
+ if (Length > USB_ControlRequest.wLength)
\r
+ Length = USB_ControlRequest.wLength;
\r
\r
while (Length && !(Endpoint_IsOUTReceived()))
\r
{
\r
\r
while (Length && !(Endpoint_IsOUTReceived()))
\r
{
\r
@@
-309,7
+311,7
@@
uint8_t Endpoint_Write_Control_Stream_LE(const void* Buffer, uint16_t Length)
if (Endpoint_IsOUTReceived())
\r
return ENDPOINT_RWCSTREAM_ERROR_HostAborted;
\r
\r
if (Endpoint_IsOUTReceived())
\r
return ENDPOINT_RWCSTREAM_ERROR_HostAborted;
\r
\r
- if (LastPacketFull
|| ShortTransfer
)
\r
+ if (LastPacketFull)
\r
{
\r
while (!(Endpoint_IsINReady()));
\r
Endpoint_ClearIN();
\r
{
\r
while (!(Endpoint_IsINReady()));
\r
Endpoint_ClearIN();
\r
@@
-324,26
+326,29
@@
uint8_t Endpoint_Write_Control_Stream_BE(const void* Buffer, uint16_t Length)
{
\r
uint8_t* DataStream = (uint8_t*)(Buffer + Length - 1);
\r
bool LastPacketFull = false;
\r
{
\r
uint8_t* DataStream = (uint8_t*)(Buffer + Length - 1);
\r
bool LastPacketFull = false;
\r
- bool ShortTransfer = (Length < USB_ControlRequest.wLength);
\r
\r
\r
+ if (Length > USB_ControlRequest.wLength)
\r
+ Length = USB_ControlRequest.wLength;
\r
+
\r
while (Length && !(Endpoint_IsOUTReceived()))
\r
{
\r
while (Length && !(Endpoint_IsOUTReceived()))
\r
{
\r
- while (!(Endpoint_IsINReady()));
\r
-
\r
- while (Length && (Endpoint_BytesInEndpoint() < USB_ControlEndpointSize))
\r
+ if (Endpoint_IsINReady())
\r
{
\r
{
\r
- Endpoint_Write_Byte(*(DataStream--));
\r
- Length--;
\r
+ while (Length && (Endpoint_BytesInEndpoint() < USB_ControlEndpointSize))
\r
+ {
\r
+ Endpoint_Write_Byte(*(DataStream--));
\r
+ Length--;
\r
+ }
\r
+
\r
+ LastPacketFull = (Endpoint_BytesInEndpoint() == USB_ControlEndpointSize);
\r
+ Endpoint_ClearIN();
\r
}
\r
}
\r
-
\r
- LastPacketFull = (Endpoint_BytesInEndpoint() == USB_ControlEndpointSize);
\r
- Endpoint_ClearIN();
\r
}
\r
\r
if (Endpoint_IsOUTReceived())
\r
return ENDPOINT_RWCSTREAM_ERROR_HostAborted;
\r
\r
}
\r
\r
if (Endpoint_IsOUTReceived())
\r
return ENDPOINT_RWCSTREAM_ERROR_HostAborted;
\r
\r
- if (LastPacketFull
|| ShortTransfer
)
\r
+ if (LastPacketFull)
\r
{
\r
while (!(Endpoint_IsINReady()));
\r
Endpoint_ClearIN();
\r
{
\r
while (!(Endpoint_IsINReady()));
\r
Endpoint_ClearIN();
\r
@@
-360,15
+365,16
@@
uint8_t Endpoint_Read_Control_Stream_LE(void* Buffer, uint16_t Length)
\r
while (Length)
\r
{
\r
\r
while (Length)
\r
{
\r
- while (!(Endpoint_IsOUTReceived()));
\r
-
\r
- while (Length && Endpoint_BytesInEndpoint())
\r
+ if (Endpoint_IsOUTReceived())
\r
{
\r
{
\r
- *(DataStream++) = Endpoint_Read_Byte();
\r
- Length--;
\r
+ while (Length && Endpoint_BytesInEndpoint())
\r
+ {
\r
+ *(DataStream++) = Endpoint_Read_Byte();
\r
+ Length--;
\r
+ }
\r
+
\r
+ Endpoint_ClearOUT();
\r
}
\r
}
\r
-
\r
- Endpoint_ClearOUT();
\r
}
\r
\r
while (!(Endpoint_IsINReady()));
\r
}
\r
\r
while (!(Endpoint_IsINReady()));
\r
@@
-382,15
+388,16
@@
uint8_t Endpoint_Read_Control_Stream_BE(void* Buffer, uint16_t Length)
\r
while (Length)
\r
{
\r
\r
while (Length)
\r
{
\r
- while (!(Endpoint_IsOUTReceived()));
\r
-
\r
- while (Length && Endpoint_BytesInEndpoint())
\r
+ if (Endpoint_IsOUTReceived())
\r
{
\r
{
\r
- *(DataStream--) = Endpoint_Read_Byte();
\r
- Length--;
\r
+ while (Length && Endpoint_BytesInEndpoint())
\r
+ {
\r
+ *(DataStream--) = Endpoint_Read_Byte();
\r
+ Length--;
\r
+ }
\r
+
\r
+ Endpoint_ClearOUT();
\r
}
\r
}
\r
-
\r
- Endpoint_ClearOUT();
\r
}
\r
\r
while (!(Endpoint_IsINReady()));
\r
}
\r
\r
while (!(Endpoint_IsINReady()));
\r