Remove Report descriptor structure
Report descriptors lack the 2 byte header other descriptors have and can't be parsed like the rest.
This commit is contained in:
@ -3,7 +3,6 @@ mod device;
|
||||
mod endpoint;
|
||||
mod hid;
|
||||
mod interface;
|
||||
mod report;
|
||||
mod string;
|
||||
|
||||
pub use configuration::*;
|
||||
@ -11,7 +10,6 @@ pub use device::*;
|
||||
pub use endpoint::*;
|
||||
pub use hid::*;
|
||||
pub use interface::*;
|
||||
pub use report::*;
|
||||
pub use string::*;
|
||||
|
||||
use core::mem;
|
||||
@ -49,7 +47,6 @@ pub enum Descriptor<'a> {
|
||||
Interface(Interface),
|
||||
Endpoint(Endpoint),
|
||||
Hid(Hid),
|
||||
Report(Report<'a>),
|
||||
Unknown { ty: u8, data: &'a [u8] },
|
||||
}
|
||||
|
||||
@ -144,9 +141,6 @@ impl<'a> Iterator for Iter<'a> {
|
||||
Endpoint::from_raw(b).map_err(InvalidDescriptor::Endpoint)?,
|
||||
),
|
||||
HID => Descriptor::Hid(Hid::from_raw(b).map_err(InvalidDescriptor::Hid)?),
|
||||
REPORT => {
|
||||
Descriptor::Report(Report::from_raw(b).map_err(InvalidDescriptor::Report)?)
|
||||
}
|
||||
ty => Descriptor::Unknown { ty, data: b },
|
||||
};
|
||||
self.buf = &buf[usize::from(l)..];
|
||||
@ -164,5 +158,4 @@ pub enum InvalidDescriptor {
|
||||
Interface(InvalidInterface),
|
||||
Endpoint(InvalidEndpoint),
|
||||
Hid(InvalidHid),
|
||||
Report(InvalidReport),
|
||||
}
|
||||
|
@ -1,22 +0,0 @@
|
||||
use core::fmt;
|
||||
|
||||
pub struct Report<'a> {
|
||||
pub data: &'a [u8],
|
||||
}
|
||||
|
||||
impl<'a> Report<'a> {
|
||||
pub(crate) fn from_raw(data: &'a [u8]) -> Result<Self, InvalidReport> {
|
||||
Ok(Self { data })
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for Report<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct(stringify!(Report))
|
||||
.field("data", &format_args!("{:02x?}", self.data))
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum InvalidReport {}
|
Reference in New Issue
Block a user