t55xx detect/read/write/dump etc will fail if you set lf config to something. Moved the reset / restore of lf config to device side for T55XX readblock. t55xx sniff still obeys lf config since it uses lf sniff beneath.

This commit is contained in:
iceman1001 committed 2021-07-29 10:51:31 +02:00
1 parent 7ec18a040b
commit 765d2acbb0
5 files changed
+27 -35

No files matched your search

-32
View File
@@ -942,27 +942,6 @@ static int CmdT55xxDetect(const char *Cmd) {
// detect called so clear data blocks
T55x7_ClearAllBlockData();
// make sure decimate == 1
sample_config curr_lf_config;
memset(&curr_lf_config, 0, sizeof(sample_config));
res = lf_getconfig(&curr_lf_config);
if (res != PM3_SUCCESS) {
PrintAndLogEx(ERR, "failed to get current device LF config");
return res;
}
int8_t old_decimation = curr_lf_config.decimation;
if (curr_lf_config.decimation != 1) {
curr_lf_config.decimation = 1;
curr_lf_config.verbose = false;
res = lf_config(&curr_lf_config);
if (res != PM3_SUCCESS) {
PrintAndLogEx(ERR, "failed to set LF configuration decimation value to 1");
return res;
}
}
// sanity check.
if (SanityOfflineCheck(use_gb) != PM3_SUCCESS)
return PM3_ESOFT;
@@ -1038,17 +1017,6 @@ static int CmdT55xxDetect(const char *Cmd) {
PrintAndLogEx(WARNING, "Could not detect modulation automatically. Try setting it manually with " _YELLOW_("\'lf t55xx config\'"));
}
if (old_decimation != curr_lf_config.decimation) {
curr_lf_config.decimation = old_decimation;
curr_lf_config.verbose = false;
res = lf_config(&curr_lf_config);
if (res != PM3_SUCCESS) {
PrintAndLogEx(ERR, "failed to restore LF configuration");
return res;
}
}
return PM3_SUCCESS;
}