Dynamic report of the chipID for flashing purposes

This commit is contained in:
slurdge 2019-07-10 18:41:42 +02:00 committed by Philippe Teuwen
commit 4727ab96d7
5 changed files with 64 additions and 5 deletions

View file

@ -347,7 +347,7 @@ static int wait_for_ack(PacketResponseNG *ack) {
}
// Go into flashing mode
int flash_start_flashing(int enable_bl_writes, char *serial_port_name) {
int flash_start_flashing(int enable_bl_writes, char *serial_port_name, uint32_t * chipinfo) {
uint32_t state;
if (enter_bootloader(serial_port_name) < 0)
@ -356,6 +356,13 @@ int flash_start_flashing(int enable_bl_writes, char *serial_port_name) {
if (get_proxmark_state(&state) < 0)
return -1;
if (state & DEVICE_INFO_FLAG_UNDERSTANDS_CHIP_INFO) {
SendCommandBL(CMD_CHIP_INFO, 0, 0, 0, NULL, 0);
PacketResponseNG resp;
WaitForResponse(CMD_CHIP_INFO, &resp);
*chipinfo = resp.oldarg[0];
}
if (state & DEVICE_INFO_FLAG_UNDERSTANDS_START_FLASH) {
// This command is stupid. Why the heck does it care which area we're
// flashing, as long as it's not the bootloader area? The mind boggles.