Fixed incorrect comparison in the descriptor callback routine of the TeensyHID bootlo...
[pub/USBasp.git] / Bootloaders / DFU / BootloaderDFU.c
index 553a5a2..d90accb 100644 (file)
@@ -101,6 +101,9 @@ int main(void)
 {\r
        /* Configure hardware required by the bootloader */\r
        SetupHardware();\r
+       \r
+       /* Enable global interrupts so that the USB stack can function */\r
+       sei();\r
 \r
        /* Run the USB management task while the bootloader is supposed to be running */\r
        while (RunBootloader || WaitForExit)\r
@@ -205,8 +208,8 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
                                        /* Throw away the filler bytes before the start of the firmware */\r
                                        DiscardFillerBytes(DFU_FILLER_BYTES_SIZE);\r
 \r
-                                       /* Throw away the page alignment filler bytes before the start of the firmware */\r
-                                       DiscardFillerBytes(StartAddr % SPM_PAGESIZE);\r
+                                       /* Throw away the packet alignment filler bytes before the start of the firmware */\r
+                                       DiscardFillerBytes(StartAddr % FIXED_CONTROL_ENDPOINT_SIZE);\r
                                        \r
                                        /* Calculate the number of bytes remaining to be written */\r
                                        uint16_t BytesRemaining = ((EndAddr - StartAddr) + 1);\r