usb: add support for custom string descriptors.

This commit is contained in:
Dario Nieuwenhuis
2022-04-23 04:40:57 +02:00
parent 7c6a88f3dd
commit 0476f6b55b
3 changed files with 59 additions and 17 deletions

View File

@@ -189,6 +189,20 @@ pub trait ControlHandler {
let _ = (req, buf);
InResponse::Rejected
}
/// Called when a GET_DESCRIPTOR STRING control request is received.
///
/// Write the response string somewhere (usually to `buf`, but you may use another buffer
/// owned by yourself, or a static buffer), then return it.
fn get_string<'a>(
&'a mut self,
index: StringIndex,
lang_id: u16,
buf: &'a mut [u8],
) -> Option<&'a str> {
let _ = (index, lang_id, buf);
None
}
}
/// Typestate representing a ControlPipe in the DATA IN stage