aboutsummaryrefslogtreecommitdiff
path: root/include/libopencm3/usb
diff options
context:
space:
mode:
authorAndrey Smirnov2012-11-07 10:33:51 -0800
committerAndrey Smirnov2012-11-07 10:33:51 -0800
commitc5c4db01969608ac19bba290b9f6ec965ef01e5c (patch)
treef23c2a25819ba4a6c2f76c6d0197b006f0a341a7 /include/libopencm3/usb
parent12e178686331fd0a8e3564a9f0e77fece4a04617 (diff)
Extend control hook framework
This commits adds a new error code that can be return from a registered control callback: USBD_REQ_NEXT_CALLBACK. This return code signifies that the callback is done processing the data successfully, but user would like to have all matching callbacks down the callback chain to be executed too. This change allows for example to intercept standard requests like GET_DESCRIPTOR, do some small action upon receiving of one, but still have the standard callback executed and do it's job. This way user doesn't have to re-implement standard GET_DESCRIPTOR functionality if they want to intercept that request to do some small thing.
Diffstat (limited to 'include/libopencm3/usb')
-rw-r--r--include/libopencm3/usb/usbd.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/libopencm3/usb/usbd.h b/include/libopencm3/usb/usbd.h
index 9da8379..8f68555 100644
--- a/include/libopencm3/usb/usbd.h
+++ b/include/libopencm3/usb/usbd.h
@@ -24,6 +24,13 @@
BEGIN_DECLS
+
+enum usbd_request_return_codes {
+ USBD_REQ_NOTSUPP = 0,
+ USBD_REQ_HANDLED = 1,
+ USBD_REQ_NEXT_CALLBACK = 2,
+};
+
typedef struct _usbd_driver usbd_driver;
extern const usbd_driver stm32f103_usb_driver;
extern const usbd_driver stm32f107_usb_driver;