make style
This commit is contained in:
@@ -633,24 +633,24 @@ static int CmdSmartUpgrade(const char *Cmd) {
|
||||
uint32_t bytes_remaining = firmware_size;
|
||||
|
||||
while (bytes_remaining > 0) {
|
||||
|
||||
|
||||
struct {
|
||||
uint32_t idx;
|
||||
uint32_t bytes_in_packet;
|
||||
uint16_t crc;
|
||||
uint8_t data[400];
|
||||
uint8_t data[400];
|
||||
} PACKED upload;
|
||||
|
||||
|
||||
uint32_t bytes_in_packet = MIN(sizeof(upload.data), bytes_remaining);
|
||||
|
||||
upload.idx = index + bytes_sent;
|
||||
upload.bytes_in_packet = bytes_in_packet;
|
||||
memcpy(upload.data, firmware + bytes_sent, bytes_in_packet);
|
||||
|
||||
|
||||
uint8_t a = 0, b = 0;
|
||||
compute_crc(CRC_14443_A, upload.data, bytes_in_packet, &a, &b);
|
||||
upload.crc = (a << 8 | b);
|
||||
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_SMART_UPLOAD, (uint8_t *)&upload, sizeof(upload));
|
||||
if (!WaitForResponseTimeout(CMD_SMART_UPLOAD, &resp, 2000)) {
|
||||
@@ -658,7 +658,7 @@ static int CmdSmartUpgrade(const char *Cmd) {
|
||||
free(firmware);
|
||||
return PM3_ETIMEOUT;
|
||||
}
|
||||
|
||||
|
||||
if (resp.status != PM3_SUCCESS) {
|
||||
PrintAndLogEx(WARNING, "uploading to device failed");
|
||||
free(firmware);
|
||||
@@ -671,25 +671,25 @@ static int CmdSmartUpgrade(const char *Cmd) {
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(SUCCESS, "Sim module firmware updating, don\'t turn off your PM3!");
|
||||
|
||||
// trigger the firmware upgrade
|
||||
// trigger the firmware upgrade
|
||||
clearCommandBuffer();
|
||||
struct {
|
||||
uint16_t fw_size;
|
||||
uint16_t crc;
|
||||
} PACKED payload;
|
||||
payload.fw_size = firmware_size;
|
||||
payload.fw_size = firmware_size;
|
||||
|
||||
uint8_t a = 0, b = 0;
|
||||
compute_crc(CRC_14443_A, firmware, firmware_size, &a, &b);
|
||||
payload.crc = (a << 8 | b);
|
||||
|
||||
|
||||
free(firmware);
|
||||
SendCommandNG(CMD_SMART_UPGRADE, (uint8_t *)&payload, sizeof(payload));
|
||||
if (!WaitForResponseTimeout(CMD_SMART_UPGRADE, &resp, 2500)) {
|
||||
PrintAndLogEx(WARNING, "timeout while waiting for reply.");
|
||||
return PM3_ETIMEOUT;
|
||||
}
|
||||
|
||||
|
||||
if (resp.status == PM3_SUCCESS) {
|
||||
PrintAndLogEx(SUCCESS, "Sim module firmware upgrade " _GREEN_("successful"));
|
||||
PrintAndLogEx(HINT, "run " _YELLOW_("`hw status`") " to validate the fw version ");
|
||||
@@ -843,7 +843,7 @@ static int CmdSmartSetClock(const char *Cmd) {
|
||||
payload.new_clk = new_clk;
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_SMART_SETCLOCK, (uint8_t*)&payload, sizeof(payload));
|
||||
SendCommandNG(CMD_SMART_SETCLOCK, (uint8_t *)&payload, sizeof(payload));
|
||||
PacketResponseNG resp;
|
||||
if (!WaitForResponseTimeout(CMD_SMART_SETCLOCK, &resp, 2500)) {
|
||||
PrintAndLogEx(WARNING, "smart card select failed");
|
||||
|
||||
Reference in New Issue
Block a user