From f87170e06ea157ade400dcb7412e022b04c1839c Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Sun, 30 Jan 2011 15:41:23 +1300 Subject: Clear user control request handlers on set_configuration request. --- lib/usb/usb_standard.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/usb') diff --git a/lib/usb/usb_standard.c b/lib/usb/usb_standard.c index efaea27..adfaa23 100644 --- a/lib/usb/usb_standard.c +++ b/lib/usb/usb_standard.c @@ -150,8 +150,15 @@ static int usb_standard_set_configuration(struct usb_setup_data *req, /* Reset all endpoints. */ _usbd_hw_endpoints_reset(); - if (_usbd_device.user_callback_set_config) + if (_usbd_device.user_callback_set_config) { + /* Flush control callbacks. These will be reregistered + * by the user handler. */ + int i; + for(i = 0; i < MAX_USER_CONTROL_CALLBACK; i++) + _usbd_device.user_control_callback[i].cb = NULL; + _usbd_device.user_callback_set_config(req->wValue); + } return 1; } -- cgit v1.2.3