From f59d47cbd1ad0383e4646808e80e37afa87cffa7 Mon Sep 17 00:00:00 2001 From: WGH Date: Thu, 4 Jan 2018 19:23:17 +0300 Subject: [PATCH] docs: usb: clarify usbd_register_control_callback() Expand notes on when the control callbacks must be registered. Reviewed-by: Karl Palsson --- include/libopencm3/usb/usbd.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/libopencm3/usb/usbd.h b/include/libopencm3/usb/usbd.h index bcd28ea0..c1b5d40a 100644 --- a/include/libopencm3/usb/usbd.h +++ b/include/libopencm3/usb/usbd.h @@ -121,8 +121,12 @@ typedef void (*usbd_endpoint_callback)(usbd_device *usbd_dev, uint8_t ep); /* */ /** Registers a control callback. * - * The specified callback will be called if (type == (bmRequestType - * & type_mask)) + * Since the list of user control callbacks is cleared every time + * device configuration is set (inside usb_standard_set_configuration()), + * control callback registration must happen inside (or after) the + * config callback. The specified callback will be called if + * (type == (bmRequestType & type_mask)). + * @sa usbd_register_set_config_callback * @param type Handled request type * @param type_mask Mask to apply before matching request type * @return 0 if successful