usb: use InterfaceNumber in msos.

This commit is contained in:
Dario Nieuwenhuis
2023-02-07 23:45:01 +01:00
parent 3af991ab63
commit 86487db5d1
4 changed files with 9 additions and 5 deletions

View File

@ -7,6 +7,7 @@
use core::mem::size_of;
use super::{capability_type, BosWriter};
use crate::types::InterfaceNumber;
/// A serialized Microsoft OS 2.0 Descriptor set.
///
@ -125,7 +126,7 @@ impl<'d> MsOsDescriptorWriter<'d> {
}
/// Add a function subset.
pub fn function(&mut self, first_interface: u8) {
pub fn function(&mut self, first_interface: InterfaceNumber) {
assert!(
self.config_mark.is_some(),
"MsOsDescriptorWriter: function subset requires a configuration subset"
@ -376,14 +377,14 @@ impl DescriptorSet for ConfigurationSubsetHeader {
pub struct FunctionSubsetHeader {
wLength: u16,
wDescriptorType: u16,
bFirstInterface: u8,
bFirstInterface: InterfaceNumber,
bReserved: u8,
wSubsetLength: u16,
}
impl FunctionSubsetHeader {
/// Creates a function subset header
pub fn new(first_interface: u8) -> Self {
pub fn new(first_interface: InterfaceNumber) -> Self {
FunctionSubsetHeader {
wLength: (size_of::<Self>() as u16).to_le(),
wDescriptorType: (Self::TYPE as u16).to_le(),