Skip to content

Allow serial "break" to trigger KeyboardInterrupt #7227

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

Merged
merged 2 commits into from
Nov 19, 2022
Merged
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
8 changes: 7 additions & 1 deletion supervisor/shared/usb/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_requ
#endif // CIRCUITPY_USB_VENDOR


#if MICROPY_KBD_EXCEPTION
#if MICROPY_KBD_EXCEPTION && CIRCUITPY_USB_CDC

/**
* Callback invoked when received an "wanted" char.
Expand All @@ -359,4 +359,10 @@ void tud_cdc_rx_wanted_cb(uint8_t itf, char wanted_char) {
}
}

void tud_cdc_send_break_cb(uint8_t itf, uint16_t duration_ms) {
if (usb_cdc_console_enabled() && mp_interrupt_char != -1 && itf == 0 && duration_ms > 0) {
mp_sched_keyboard_interrupt();
}
}

#endif