(info: &HidFirmwareInfo, verbose: bool)
| 153 | } |
| 154 | |
| 155 | fn print_fw_info(info: &HidFirmwareInfo, verbose: bool) { |
| 156 | assert_eq!(info.report_id, ReportIdCmd::E0Read as u8); |
| 157 | |
| 158 | info!(" Signature: {:X?}", info.signature); |
| 159 | // Something's totally off if the signature is invalid |
| 160 | if info.signature != [b'C', b'Y'] { |
| 161 | error!("Firmware Signature is invalid."); |
| 162 | return; |
| 163 | } |
| 164 | |
| 165 | info!(" Bootloader Info"); |
| 166 | info!( |
| 167 | " Security Support: {:?}", |
| 168 | info.bootloader_info & 0b001 != 0 |
| 169 | ); |
| 170 | info!( |
| 171 | " Flashing Support: {:?}", |
| 172 | info.bootloader_info & 0b010 == 0 |
| 173 | ); |
| 174 | // App Priority means you can configure whether the main or backup firmware |
| 175 | // has priority. This can either be configured in the flash image or by |
| 176 | // sending a command. But the CCG3 SDK lets you disable support for this at |
| 177 | // compile-time. If disabled, both images have the same priority. |
| 178 | let app_priority_support = info.bootloader_info & 0b100 != 0; |
| 179 | info!(" App Priority: {:?}", app_priority_support); |
| 180 | info!( |
| 181 | " Flash Row Size: {:?} B", |
| 182 | decode_flash_row_size(info.bootloader_info) |
| 183 | ); |
| 184 | info!(" Boot Mode Reason"); |
| 185 | info!( |
| 186 | " Jump to Bootloader: {:?}", |
| 187 | info.bootmode_reason & 0b000001 != 0 |
| 188 | ); |
| 189 | let image_1_valid = info.bootmode_reason & 0b000100 == 0; |
| 190 | let image_2_valid = info.bootmode_reason & 0b001000 == 0; |
| 191 | info!(" FW 1 valid: {:?}", image_1_valid); |
| 192 | info!(" FW 2 valid: {:?}", image_2_valid); |
| 193 | if app_priority_support { |
| 194 | info!( |
| 195 | " App Priority: {:?}", |
| 196 | info.bootmode_reason & 0b110000 |
| 197 | ); |
| 198 | } |
| 199 | info!(" UID: {:X?}", info.device_uid); |
| 200 | info!(" Silicon ID: {:X?}", info.silicon_id); |
| 201 | let bl_ver = BaseVersion::from(info.bl_version.as_slice()); |
| 202 | let base_version_1 = BaseVersion::from(info.image_1_ver.as_slice()); |
| 203 | let base_version_2 = BaseVersion::from(info.image_2_ver.as_slice()); |
| 204 | info!(" BL Version: {} ", bl_ver,); |
| 205 | info!( |
| 206 | " Image 1 start: 0x{:08X}", |
| 207 | u32::from_le_bytes(info.image_1_row) |
| 208 | ); |
| 209 | info!( |
| 210 | " Image 2 start: 0x{:08X}", |
| 211 | u32::from_le_bytes(info.image_2_row) |
| 212 | ); |
no outgoing calls
no test coverage detected