mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-19 04:49:38 -07:00
add verification data was entered-lf em 4x05 write
This commit is contained in:
parent
51b614aa75
commit
6a772a1273
1 changed files with 9 additions and 1 deletions
|
@ -914,6 +914,9 @@ int usage_lf_em_write(void) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// note: em4x05 doesn't have a way to invert data output so we must invert the data prior to writing
|
||||||
|
// it if invertion is needed. (example FSK2a vs FSK)
|
||||||
|
// also em4x05 requires swapping word data when compared to the data used for t55xx chips.
|
||||||
int EM4x05WriteWord(uint8_t addr, uint32_t data, uint32_t pwd, bool usePwd, bool swap, bool invert) {
|
int EM4x05WriteWord(uint8_t addr, uint32_t data, uint32_t pwd, bool usePwd, bool swap, bool invert) {
|
||||||
if (swap) data = SwapBits(data, 32);
|
if (swap) data = SwapBits(data, 32);
|
||||||
|
|
||||||
|
@ -962,7 +965,7 @@ int CmdEM4x05WriteWord(const char *Cmd) {
|
||||||
bool swap = false;
|
bool swap = false;
|
||||||
bool invert = false;
|
bool invert = false;
|
||||||
uint8_t addr = 16; // default to invalid address
|
uint8_t addr = 16; // default to invalid address
|
||||||
|
bool gotData = false;
|
||||||
char cmdp = 0;
|
char cmdp = 0;
|
||||||
while(param_getchar(Cmd, cmdp) != 0x00)
|
while(param_getchar(Cmd, cmdp) != 0x00)
|
||||||
{
|
{
|
||||||
|
@ -979,6 +982,7 @@ int CmdEM4x05WriteWord(const char *Cmd) {
|
||||||
case 'd':
|
case 'd':
|
||||||
case 'D':
|
case 'D':
|
||||||
data = param_get32ex(Cmd, cmdp+1, 0, 16);
|
data = param_get32ex(Cmd, cmdp+1, 0, 16);
|
||||||
|
gotData = true;
|
||||||
cmdp += 2;
|
cmdp += 2;
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
|
@ -1013,6 +1017,10 @@ int CmdEM4x05WriteWord(const char *Cmd) {
|
||||||
|
|
||||||
if ( strlen(Cmd) == 0 ) return usage_lf_em_write();
|
if ( strlen(Cmd) == 0 ) return usage_lf_em_write();
|
||||||
|
|
||||||
|
if (!gotData) {
|
||||||
|
PrintAndLog("You must enter the data you want to write");
|
||||||
|
return usage_lf_em_write();
|
||||||
|
}
|
||||||
return EM4x05WriteWord(addr, data, pwd, usePwd, swap, invert);
|
return EM4x05WriteWord(addr, data, pwd, usePwd, swap, invert);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue