mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 18:48:13 -07:00
HF_Legic: remove global variable and cleanup
As requested by @iceman1001: * removed global variable * updated according to make style * added entry in CHANGELOG.md
This commit is contained in:
parent
8c8a86cb83
commit
db02a1f306
4 changed files with 45 additions and 48 deletions
|
@ -20,7 +20,7 @@
|
|||
#include "legicrfsim.h"
|
||||
|
||||
void ModInfo(void) {
|
||||
DbpString(" HF Legic Prime standalone ");
|
||||
DbpString(" HF Legic Prime standalone ");
|
||||
}
|
||||
|
||||
// Searching for Legic card until found and read.
|
||||
|
@ -29,53 +29,52 @@ void ModInfo(void) {
|
|||
// A, B, C = Reading
|
||||
// A, D = Simulating
|
||||
|
||||
void RunMod(){
|
||||
StandAloneMode();
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||
Dbprintf(">> HF Legic Prime Read/Simulate Started <<");
|
||||
void RunMod() {
|
||||
StandAloneMode();
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||
Dbprintf(">> HF Legic Prime Read/Simulate Started <<");
|
||||
|
||||
int read_success;
|
||||
for(;;){
|
||||
WDT_HIT();
|
||||
int read_success;
|
||||
for (;;) {
|
||||
WDT_HIT();
|
||||
|
||||
//exit from hf_legic, send usbcommand
|
||||
if(data_available()) break;
|
||||
//exit from hf_legic, send usbcommand
|
||||
if (data_available()) break;
|
||||
|
||||
//Was our button held down or pressed?
|
||||
int button_pressed = BUTTON_HELD(280);
|
||||
if(button_pressed != BUTTON_HOLD) continue;
|
||||
//Was our button held down or pressed?
|
||||
int button_pressed = BUTTON_HELD(280);
|
||||
if (button_pressed != BUTTON_HOLD) continue;
|
||||
|
||||
LED_A_OFF();
|
||||
LED_B_OFF();
|
||||
LED_C_ON();
|
||||
LED_D_OFF();
|
||||
LED_A_OFF();
|
||||
LED_B_OFF();
|
||||
LED_C_ON();
|
||||
LED_D_OFF();
|
||||
|
||||
WAIT_BUTTON_RELEASED();
|
||||
WAIT_BUTTON_RELEASED();
|
||||
|
||||
//record
|
||||
DbpString("[=] start recording");
|
||||
//record
|
||||
DbpString("[=] start recording");
|
||||
|
||||
//search for legic card until reading successfull or button pressed
|
||||
do{
|
||||
LED_C_ON();
|
||||
SpinDelay(1000);
|
||||
// We don't care if we read a MIM256, MIM512 or MIM1024
|
||||
// we just read 1024 bytes
|
||||
LegicRfReader(0, 1024, 0x55);
|
||||
read_success = check_success();
|
||||
}while(read_success == 0 && !BUTTON_PRESS());
|
||||
//search for legic card until reading successfull or button pressed
|
||||
do {
|
||||
LED_C_ON();
|
||||
SpinDelay(1000);
|
||||
// We don't care if we read a MIM256, MIM512 or MIM1024
|
||||
// we just read 1024 bytes
|
||||
read_success = LegicRfReader(0, 1024, 0x55);
|
||||
} while (read_success == 0 && !BUTTON_PRESS());
|
||||
|
||||
//simulate if read successfully
|
||||
if(read_success == 1){
|
||||
LED_A_OFF();
|
||||
LED_B_OFF();
|
||||
LED_C_OFF();
|
||||
LED_D_ON();
|
||||
// The read data is migrated to a MIM1024 card
|
||||
LegicRfSimulate(2);
|
||||
}else{
|
||||
LEDsoff();
|
||||
WAIT_BUTTON_RELEASED();
|
||||
//simulate if read successfully
|
||||
if (read_success == 1) {
|
||||
LED_A_OFF();
|
||||
LED_B_OFF();
|
||||
LED_C_OFF();
|
||||
LED_D_ON();
|
||||
// The read data is migrated to a MIM1024 card
|
||||
LegicRfSimulate(2);
|
||||
} else {
|
||||
LEDsoff();
|
||||
WAIT_BUTTON_RELEASED();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue