aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrey Smirnov2012-11-07 10:33:51 -0800
committerAndrey Smirnov2012-11-07 10:33:51 -0800
commitc5c4db01969608ac19bba290b9f6ec965ef01e5c (patch)
treef23c2a25819ba4a6c2f76c6d0197b006f0a341a7 /lib
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 'lib')
-rw-r--r--lib/usb/usb_control.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/usb/usb_control.c b/lib/usb/usb_control.c
index 3dd0857..b4ac57e 100644
--- a/lib/usb/usb_control.c
+++ b/lib/usb/usb_control.c
@@ -102,7 +102,8 @@ static int usb_control_request_dispatch(struct usb_setup_data *req)
result = cb[i].cb(req, &control_state.ctrl_buf,
&control_state.ctrl_len,
&control_state.complete);
- if (result)
+ if (result == USBD_REQ_HANDLED ||
+ result == USBD_REQ_NOTSUPP)
return result;
}
}