1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-28 16:01:18 +01:00

Merge pull request #15566 from dylad/pr/usbus/string_descr_for_alt_if

usbus: add optional string descriptor for alt interface
This commit is contained in:
Koen Zandberg 2020-12-09 14:52:40 +01:00 committed by GitHub
commit 1eb30f1cd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -294,6 +294,7 @@ typedef struct usbus_interface_alt {
descriptor generators */
usbus_endpoint_t *ep; /**< List of associated endpoints for
this alternative setting */
usbus_string_t *descr; /**< Descriptor string */
} usbus_interface_alt_t;
/**

View File

@ -205,6 +205,13 @@ static size_t _fmt_descriptors_iface_alts(usbus_t *usbus,
len += sizeof(usb_descriptor_interface_t);
usb_iface.alternate_setting = alts++;
usb_iface.num_endpoints = _num_endpoints_alt(alt);
if (alt->descr) {
usb_iface.idx = alt->descr->idx;
} else {
/* If there is no string descriptor for a given alt interface
set the index to 0 to advertise it */
usb_iface.idx = 0;
}
usbus_control_slicer_put_bytes(usbus, (uint8_t *)&usb_iface,
sizeof(usb_descriptor_interface_t));
len += _fmt_descriptors_post(usbus, alt->descr_gen);