usb: set the interface handler in InterfaceBuilder.

This commit is contained in:
Dario Nieuwenhuis
2022-04-23 01:29:19 +02:00
parent 092c2b7dfe
commit 7c6a88f3dd
3 changed files with 12 additions and 9 deletions

View File

@ -112,7 +112,8 @@ fn build<'d, D: Driver<'d>>(
let len = config.report_descriptor.len();
let mut func = builder.function(USB_CLASS_HID, USB_SUBCLASS_NONE, USB_PROTOCOL_NONE);
let mut iface = func.interface(Some(control));
let mut iface = func.interface();
iface.handler(control);
let mut alt = iface.alt_setting(USB_CLASS_HID, USB_SUBCLASS_NONE, USB_PROTOCOL_NONE);
// HID descriptor
@ -438,7 +439,7 @@ impl<'d> ControlHandler for Control<'d> {
self.out_report_offset.store(0, Ordering::Release);
}
fn get_descriptor<'a>(&'a mut self, req: Request, buf: &'a mut [u8]) -> InResponse<'a> {
fn get_descriptor<'a>(&'a mut self, req: Request, _buf: &'a mut [u8]) -> InResponse<'a> {
match (req.value >> 8) as u8 {
HID_DESC_DESCTYPE_HID_REPORT => InResponse::Accepted(self.report_descriptor),
HID_DESC_DESCTYPE_HID => InResponse::Accepted(&self.hid_descriptor),