Add provisions to support multiple altsettings
This commit implements the support for one interface to have multiple altsettings. It also adds hook that user can use to perform actions when the alsetting switch is performed by host. Changes: * For backward compatibility, placed a pointer instead of allocating memory for whole interface struct. * Always execute callback (even if the current interface alternate-settings matches). * Multiple configuration support. Signed-off-by: Kuldeep Singh Dhaka <kuldeepdhaka9@gmail.com>
This commit is contained in:
committed by
Karl Palsson
parent
fd141a8131
commit
db58d5ae82
@@ -89,6 +89,9 @@ extern int usbd_register_control_callback(usbd_device *usbd_dev, uint8_t type,
|
||||
extern int usbd_register_set_config_callback(usbd_device *usbd_dev,
|
||||
void (*callback)(usbd_device *usbd_dev, uint16_t wValue));
|
||||
|
||||
extern void usbd_register_set_altsetting_callback(usbd_device *usbd_dev,
|
||||
void (*callback)(usbd_device *usbd_dev, uint16_t wIndex, uint16_t wValue));
|
||||
|
||||
/* Functions to be provided by the hardware abstraction layer */
|
||||
extern void usbd_poll(usbd_device *usbd_dev);
|
||||
extern void usbd_disconnect(usbd_device *usbd_dev, bool disconnected);
|
||||
|
||||
@@ -163,7 +163,8 @@ struct usb_config_descriptor {
|
||||
|
||||
/* Descriptor ends here. The following are used internally: */
|
||||
const struct usb_interface {
|
||||
int num_altsetting;
|
||||
uint8_t *cur_altsetting;
|
||||
uint8_t num_altsetting;
|
||||
const struct usb_iface_assoc_descriptor *iface_assoc;
|
||||
const struct usb_interface_descriptor *altsetting;
|
||||
} *interface;
|
||||
|
||||
Reference in New Issue
Block a user