Skip to content

Commit

Permalink
usb_cdc: add support for bootloader requests over USB CDC
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Haun <[email protected]>
  • Loading branch information
Laikulo committed Sep 16, 2023
1 parent 8ef0f7d commit ef10034
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/generic/usb_cdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
//
// This file may be distributed under the terms of the GNU GPLv3 license.

#include <string.h> // memmove
#include "autoconf.h" // CONFIG_USB_VENDOR_ID
#include <string.h> // memmove memcmp
#include "autoconf.h" // CONFIG_USB_VENDOR_ID CONFIG_HAVE_BOOTLOADER_REQUEST
#include "board/misc.h" // console_sendf
#include "board/pgm.h" // PROGMEM
#include "board/usb_cdc_ep.h" // USB_CDC_EP_BULK_IN
Expand Down Expand Up @@ -113,6 +113,9 @@ usb_bulk_out_task(void)
}
// Process a message block
int_fast8_t ret = command_find_and_dispatch(receive_buf, rpos, &pop_count);
if (CONFIG_HAVE_BOOTLOADER_REQUEST && ret < 0 && pop_count == 32
&& !memcmp(receive_buf, " \x1c Request Serial Bootloader!! ~", 32))
bootloader_request();
if (ret) {
// Move buffer
uint_fast8_t needcopy = rpos - pop_count;
Expand Down

0 comments on commit ef10034

Please sign in to comment.