summaryrefslogtreecommitdiffstats
path: root/app/dfu.c
diff options
context:
space:
mode:
authorroot <root@ka-ata-killa.ourano.james.local>2021-03-06 18:19:33 +0000
committerroot <root@ka-ata-killa.ourano.james.local>2021-03-06 18:23:04 +0000
commit03486e52a2dde8ade759f36fea8b403b6524451c (patch)
treedc54d6ff9797340d83e159b596fd80cc1f2826c6 /app/dfu.c
parentf519bbe55f6917d86af6bb4946dfef073175d8f3 (diff)
downloadclock-03486e52a2dde8ade759f36fea8b403b6524451c.tar.gz
clock-03486e52a2dde8ade759f36fea8b403b6524451c.tar.bz2
clock-03486e52a2dde8ade759f36fea8b403b6524451c.zip
pull a new libopencm3 in the hope it fixes tim's usb problems
Diffstat (limited to 'app/dfu.c')
-rw-r--r--app/dfu.c24
1 files changed, 11 insertions, 13 deletions
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;
}