MCPcopy Create free account
hub / github.com/FrameworkComputer/framework-system / decode_fw_info

Function decode_fw_info

framework_lib/src/ccgx/hid.rs:141–153  ·  view source on GitHub ↗
(buf: &[u8])

Source from the content-addressed store, hash-verified

139}
140
141fn decode_fw_info(buf: &[u8]) -> HidFirmwareInfo {
142 let info_len = std::mem::size_of::<HidFirmwareInfo>();
143 let info: HidFirmwareInfo = unsafe { std::ptr::read(buf[..info_len].as_ptr() as *const _) };
144
145 // TODO: Return Option?
146 assert_eq!(info.report_id, ReportIdCmd::E0Read as u8);
147 if info.signature != [b'C', b'Y'] {
148 println!("{:X?}", info);
149 }
150 assert_eq!(info.signature, [b'C', b'Y']);
151
152 info
153}
154
155fn print_fw_info(info: &HidFirmwareInfo, verbose: bool) {
156 assert_eq!(info.report_id, ReportIdCmd::E0Read as u8);

Callers 1

get_fw_infoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected