From 03486e52a2dde8ade759f36fea8b403b6524451c Mon Sep 17 00:00:00 2001 From: root Date: Sat, 6 Mar 2021 18:19:33 +0000 Subject: pull a new libopencm3 in the hope it fixes tim's usb problems --- app/dfu.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'app/dfu.c') diff --git a/app/dfu.c b/app/dfu.c index 08e3bf9..8e72e3f 100644 --- a/app/dfu.c +++ b/app/dfu.c @@ -36,7 +36,7 @@ const struct usb_iface_assoc_descriptor dfu_iface_assoc = { }; -static int +static void dfu_detach_complete (usbd_device *usbd_dev, struct usb_setup_data *req) { (void) req; @@ -48,23 +48,21 @@ dfu_detach_complete (usbd_device *usbd_dev, struct usb_setup_data *req) //SCB_AIRCR= SCB_AIRCR_SYSRESETREQ; scb_reset_core(); - return 1; } -int +enum usbd_request_return_codes dfu_control_request (usbd_device *usbd_dev, struct usb_setup_data *req, uint8_t **buf, uint16_t *len, - usbd_control_complete_callback *complete) -{ + usbd_control_complete_callback *complete) { (void) buf; (void) len; (void) usbd_dev; - if ((req->bmRequestType & 0x7F) != 0x21) { - return 0; /* Only accept class request. */ - } + if ((req->bmRequestType & 0x7F) != 0x21) + return USBD_REQ_NEXT_CALLBACK; - switch (req->bRequest) { + switch (req->bRequest) + { case DFU_GETSTATUS: { (*buf) [0] = DFU_STATUS_OK; (*buf) [1] = 0; @@ -73,20 +71,20 @@ dfu_control_request (usbd_device *usbd_dev, struct usb_setup_data *req, (*buf) [4] = STATE_APP_IDLE; (*buf) [5] = 0; /* iString not used here */ *len = 6; - return 1; + return USBD_REQ_HANDLED; } case DFU_GETSTATE: /* Return state with no state transision. */ *buf[0] = STATE_APP_IDLE; *len = 1; - return 1; + return USBD_REQ_HANDLED; case DFU_DETACH: *complete = dfu_detach_complete; - return 1; + return USBD_REQ_HANDLED; } - return 0; + return USBD_REQ_NEXT_CALLBACK; } -- cgit v1.2.3