subsys: usb: configure Interface descriptor at runtime

Introduce function to configure interface descriptor at runtime.
It is simple to leave the corresponding function to configure the
interface descriptor and fix bInterfaceNumber and iInterface values,
for example.

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
This commit is contained in:
Johann Fischer 2018-04-28 01:17:30 +02:00 committed by Carles Cufí
commit 1237549082
3 changed files with 45 additions and 0 deletions

View file

@ -105,6 +105,11 @@ typedef void (*usb_ep_callback)(u8_t ep,
typedef int (*usb_request_handler) (struct usb_setup_packet *detup,
s32_t *transfer_len, u8_t **payload_data);
/**
* Function for interface runtime configuration
*/
typedef void (*usb_interface_config)(u8_t bInterfaceNumber);
/*
* USB Endpoint Configuration
*/
@ -169,6 +174,8 @@ struct usb_cfg_data {
const u8_t *usb_device_description;
/** Pointer to interface descriptor */
const void *interface_descriptor;
/** Function for interface runtime configuration */
usb_interface_config interface_config;
/** Callback to be notified on USB connection status change */
usb_status_callback cb_usb_status;
/** USB interface (Class) handler and storage space */