From da0529dd994262bf5b878c00cf70bf8aef6b6352 Mon Sep 17 00:00:00 2001 From: Puck Meerburg Date: Tue, 30 Dec 2025 17:05:46 +0000 Subject: [PATCH] Add vendor request to reset the MCU There's two issues with this. 1. There's no way to force a USB reset. 2. This USB stack is cursed. I can't tell how much of the latter is my fault, though, so I'm keeping it in. --- src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 37be853..b2263df 100644 --- a/src/main.c +++ b/src/main.c @@ -15,12 +15,12 @@ int anim_render(uint16_t *fb, int index, int frame); enum usb_control_resp bl_handler(enum usb_control_state state) { - if (usb_control_request.bmRequestType != 0x60) return USB_CONTROL_RESP_PASS; + if ((usb_control_request.bmRequestType & 0x7f) != 0x43) return USB_CONTROL_RESP_PASS; if (usb_control_request.bRequest != 0x69) return USB_CONTROL_RESP_STALL; - asm volatile("j 0x00"); + if (state == USB_CONTROL_FINISHED) asm volatile("j 0x00"); return USB_CONTROL_RESP_ACK; }