Skip to content

Commit

Permalink
lf awid/hid/io/410x watch - now works with user side abort
Browse files Browse the repository at this point in the history
  • Loading branch information
iceman1001 committed Feb 2, 2021
1 parent ea7d4ae commit 47c27d7
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 61 deletions.
60 changes: 16 additions & 44 deletions armsrc/lfops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1251,20 +1251,13 @@ int lf_hid_watch(int findone, uint32_t *high, uint32_t *low) {
BigBuf_Clear_keep_EM();

int res = PM3_SUCCESS;
uint16_t interval = 0;
while (BUTTON_PRESS() == false) {
for (;;) {

WDT_HIT();

// cancel w usb command.
if (interval == 4000) {
if (data_available()) {
res = PM3_EOPABORTED;
break;
}
interval = 0;
} else {
interval++;
if (data_available() || BUTTON_PRESS()) {
res = PM3_EOPABORTED;
break;
}

DoAcquisition_default(-1, false);
Expand Down Expand Up @@ -1360,20 +1353,13 @@ int lf_awid_watch(int findone, uint32_t *high, uint32_t *low) {
LFSetupFPGAForADC(LF_DIVISOR_125, true);

int res = PM3_SUCCESS;
uint16_t interval = 0;
while (BUTTON_PRESS() == false) {
for (;;) {

WDT_HIT();

// cancel w usb command.
if (interval == 4000) {
if (data_available()) {
res = PM3_EOPABORTED;
break;
}
interval = 0;
} else {
interval++;
if (data_available() || BUTTON_PRESS()) {
res = PM3_EOPABORTED;
break;
}

DoAcquisition_default(-1, false);
Expand Down Expand Up @@ -1465,19 +1451,12 @@ int lf_em410x_watch(int findone, uint32_t *high, uint64_t *low) {
LFSetupFPGAForADC(LF_DIVISOR_125, true);

int res = PM3_SUCCESS;
uint16_t interval = 0;
while (BUTTON_PRESS() == false) {
for (;;) {
WDT_HIT();

// cancel w usb command.
if (interval == 4000) {
if (data_available()) {
res = PM3_EOPABORTED;
break;
}
interval = 0;
} else {
interval++;
if (data_available() || BUTTON_PRESS()) {
res = PM3_EOPABORTED;
break;
}

DoAcquisition_default(-1, false);
Expand Down Expand Up @@ -1541,20 +1520,13 @@ int lf_io_watch(int findone, uint32_t *high, uint32_t *low) {
LFSetupFPGAForADC(LF_DIVISOR_125, true);

int res = PM3_SUCCESS;
uint16_t interval = 0;
while (BUTTON_PRESS() == false) {
for (;;) {

WDT_HIT();

// cancel w usb command.
if (interval == 4000) {
if (data_available()) {
res = PM3_EOPABORTED;
break;
}
interval = 0;
} else {
interval++;
if (data_available() || BUTTON_PRESS()) {
res = PM3_EOPABORTED;
break;
}

DoAcquisition_default(-1, false);
Expand Down
5 changes: 1 addition & 4 deletions client/src/cmdlfawid.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,7 @@ static int CmdAWIDWatch(const char *Cmd) {
PrintAndLogEx(INFO, "Press pm3-button to stop reading cards");
clearCommandBuffer();
SendCommandNG(CMD_LF_AWID_WATCH, NULL, 0);
PacketResponseNG resp;
WaitForResponse(CMD_LF_AWID_WATCH, &resp);
PrintAndLogEx(INFO, "Done");
return resp.status;
return lfsim_wait_check(CMD_LF_AWID_WATCH);
}

//by marshmellow
Expand Down
6 changes: 1 addition & 5 deletions client/src/cmdlfem410x.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,13 +287,9 @@ static int CmdEM410xWatch(const char *Cmd) {
CLIParserFree(ctx);

PrintAndLogEx(SUCCESS, "Watching for EM410x cards - place tag on antenna");
PrintAndLogEx(INFO, "Press pm3-button to stop reading cards");
clearCommandBuffer();
SendCommandNG(CMD_LF_EM410X_WATCH, NULL, 0);
PacketResponseNG resp;
WaitForResponse(CMD_LF_EM410X_WATCH, &resp);
PrintAndLogEx(INFO, "Done");
return resp.status;
return lfsim_wait_check(CMD_LF_EM410X_WATCH);
}

//by marshmellow
Expand Down
5 changes: 1 addition & 4 deletions client/src/cmdlfhid.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,7 @@ static int CmdHIDWatch(const char *Cmd) {
PrintAndLogEx(INFO, "Press pm3-button to stop reading cards");
clearCommandBuffer();
SendCommandNG(CMD_LF_HID_WATCH, NULL, 0);
PacketResponseNG resp;
WaitForResponse(CMD_LF_HID_WATCH, &resp);
PrintAndLogEx(INFO, "Done");
return resp.status;
return lfsim_wait_check(CMD_LF_HID_WATCH);
}

static int CmdHIDSim(const char *Cmd) {
Expand Down
5 changes: 1 addition & 4 deletions client/src/cmdlfio.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ static int CmdIOProxWatch(const char *Cmd) {
PrintAndLogEx(INFO, "Press pm3-button to stop reading cards");
clearCommandBuffer();
SendCommandNG(CMD_LF_IO_WATCH, NULL, 0);
PacketResponseNG resp;
WaitForResponse(CMD_LF_IO_WATCH, &resp);
PrintAndLogEx(INFO, "Done");
return resp.status;
return lfsim_wait_check(CMD_LF_IO_WATCH);
}

//IO-Prox demod - FSK RF/64 with preamble of 000000001
Expand Down

0 comments on commit 47c27d7

Please sign in to comment.