Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

usb_cdc: add support for bootloader requests over USB CDC #6340

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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