[usb] fix user_callback_set_config
USB using control callbacks was broken since d6bad27735a77b8daa90ce72b843cf08ba78697d Properly check if user usb control callback are registered, while here make sure user_callback_set_config callback pointers are initialized to NULL.
This commit is contained in:
parent
8a15cec6bf
commit
922d8f7079
@ -86,6 +86,11 @@ usbd_device *usbd_init(const usbd_driver *driver,
|
||||
usbd_dev->user_callback_ctr[0][USB_TRANSACTION_IN] =
|
||||
_usbd_control_in;
|
||||
|
||||
int i;
|
||||
for (i = 0; i < MAX_USER_SET_CONFIG_CALLBACK; i++) {
|
||||
usbd_dev->user_callback_set_config[i] = NULL;
|
||||
}
|
||||
|
||||
return usbd_dev;
|
||||
}
|
||||
|
||||
|
@ -256,7 +256,7 @@ static int usb_standard_set_configuration(usbd_device *usbd_dev,
|
||||
/* Reset all endpoints. */
|
||||
usbd_dev->driver->ep_reset(usbd_dev);
|
||||
|
||||
if (usbd_dev->user_callback_set_config) {
|
||||
if (usbd_dev->user_callback_set_config[0]) {
|
||||
/*
|
||||
* Flush control callbacks. These will be reregistered
|
||||
* by the user handler.
|
||||
|
Loading…
x
Reference in New Issue
Block a user