10000 Merge pull request #7227 from jepler/serial-break-is-interrupt · kdb424/circuitpython@0f6c708 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0f6c708

Browse files
authored
Merge pull request adafruit#7227 from jepler/serial-break-is-interrupt
Allow serial "break" to trigger KeyboardInterrupt
2 parents f637332 + afca4ce commit 0f6c708

File tree

1 file changed

+7
-1
lines changed
  • supervisor/shared/usb

1 file changed

+7
-1
lines changed

supervisor/shared/usb/usb.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_requ
341341
#endif // CIRCUITPY_USB_VENDOR
342342

343343

344-
#if MICROPY_KBD_EXCEPTION
344+
#if MICROPY_KBD_EXCEPTION && CIRCUITPY_USB_CDC
345345

346346
/**
347347
* Callback invoked when received an "wanted" char.
@@ -359,4 +359,10 @@ void tud_cdc_rx_wanted_cb(uint8_t itf, char wanted_char) {
359359
}
360360
}
361361

362+
void tud_cdc_send_break_cb(uint8_t itf, uint16_t duration_ms) {
363+
if (usb_cdc_console_enabled() && mp_interrupt_char != -1 && itf == 0 && duration_ms > 0) {
364+
mp_sched_keyboard_interrupt();
365+
}
366+
}
367+
362368
#endif

0 commit comments

Comments
 (0)
0