diff --git a/src/lib.rs b/src/lib.rs index 84a5823..115ca35 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -340,6 +340,8 @@ pub enum ReportField { pub struct Report { /// The (optional) report id associated with the report. pub report_id: Option, + /// The (optional) usage id associated with the report. + pub usage: Option, /// The size in bits of the report. pub size_in_bits: usize, /// The list of fields in the report. diff --git a/src/report_descriptor_parser.rs b/src/report_descriptor_parser.rs index 4f0662e..b50a512 100644 --- a/src/report_descriptor_parser.rs +++ b/src/report_descriptor_parser.rs @@ -455,7 +455,9 @@ impl ReportDescriptorParser { } } - reports.push(Report { report_id: *id, size_in_bits: bit_position as usize, fields }); + let usage = report_data.first().and_then(|d| d.member_of.get(1)).map(|c| c.usage); + + reports.push(Report { report_id: *id, usage, size_in_bits: bit_position as usize, fields }); } (reports, bad_reports)