mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
timeout in listening window EM4x50
This commit is contained in:
parent
d6548d1c80
commit
6aa65b735b
1 changed files with 8 additions and 7 deletions
|
@ -90,6 +90,7 @@ static em4x50_tag_t tag = {
|
||||||
#define EM4X50_COMMAND_WRITE_PASSWORD 0x11
|
#define EM4X50_COMMAND_WRITE_PASSWORD 0x11
|
||||||
#define EM4X50_COMMAND_SELECTIVE_READ 0x0A
|
#define EM4X50_COMMAND_SELECTIVE_READ 0x0A
|
||||||
|
|
||||||
|
#define EM4X50_COMMAND_TIMEOUT 5000
|
||||||
#define FPGA_TIMER_0 0
|
#define FPGA_TIMER_0 0
|
||||||
|
|
||||||
int gHigh = 0;
|
int gHigh = 0;
|
||||||
|
@ -412,13 +413,13 @@ static void em4x50_send_word(const uint8_t bytes[4]) {
|
||||||
em4x50_send_bit(0);
|
em4x50_send_bit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool find_single_listen_window(void) {
|
static bool find_single_listen_window(int16_t timeout) {
|
||||||
|
|
||||||
// find single listen window
|
// find single listen window
|
||||||
|
|
||||||
int cnt_pulses = 0;
|
int cnt_pulses = 0;
|
||||||
|
|
||||||
while (cnt_pulses < EM4X50_T_WAITING_FOR_SNGLLIW) {
|
while (cnt_pulses < EM4X50_T_WAITING_FOR_SNGLLIW && timeout--) {
|
||||||
|
|
||||||
// identification of listen window is done via evaluation of
|
// identification of listen window is done via evaluation of
|
||||||
// pulse lengths
|
// pulse lengths
|
||||||
|
@ -440,7 +441,7 @@ static bool find_single_listen_window(void) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool find_double_listen_window(bool bcommand) {
|
static bool find_double_listen_window(bool bcommand, int16_t timeout) {
|
||||||
|
|
||||||
// find two successive listen windows that indicate the beginning of
|
// find two successive listen windows that indicate the beginning of
|
||||||
// data transmission
|
// data transmission
|
||||||
|
@ -450,7 +451,7 @@ static bool find_double_listen_window(bool bcommand) {
|
||||||
|
|
||||||
int cnt_pulses = 0;
|
int cnt_pulses = 0;
|
||||||
|
|
||||||
while (cnt_pulses < EM4X50_T_WAITING_FOR_DBLLIW) {
|
while (cnt_pulses < EM4X50_T_WAITING_FOR_DBLLIW && timeout--) {
|
||||||
|
|
||||||
// identification of listen window is done via evaluation of
|
// identification of listen window is done via evaluation of
|
||||||
// pulse lengths
|
// pulse lengths
|
||||||
|
@ -507,7 +508,7 @@ static bool find_em4x50_tag(void) {
|
||||||
// function is used to check wether a tag on the proxmark is an
|
// function is used to check wether a tag on the proxmark is an
|
||||||
// EM4x50 tag or not -> speed up "lf search" process
|
// EM4x50 tag or not -> speed up "lf search" process
|
||||||
|
|
||||||
return (find_single_listen_window());
|
return (find_single_listen_window(EM4X50_COMMAND_TIMEOUT));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,7 +520,7 @@ static bool request_receive_mode(void) {
|
||||||
|
|
||||||
bool bcommand = true;
|
bool bcommand = true;
|
||||||
|
|
||||||
return find_double_listen_window(bcommand);
|
return find_double_listen_window(bcommand, EM4X50_COMMAND_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool check_ack(bool bliw) {
|
static bool check_ack(bool bliw) {
|
||||||
|
@ -725,7 +726,7 @@ static bool standard_read(int *now) {
|
||||||
uint8_t bits[EM4X50_TAG_WORD] = {0};
|
uint8_t bits[EM4X50_TAG_WORD] = {0};
|
||||||
|
|
||||||
// start with the identification of two succsessive listening windows
|
// start with the identification of two succsessive listening windows
|
||||||
if (find_double_listen_window(false)) {
|
if (find_double_listen_window(false, EM4X50_COMMAND_TIMEOUT)) {
|
||||||
|
|
||||||
// read and save words until following double listen window is detected
|
// read and save words until following double listen window is detected
|
||||||
while (get_word_from_bitstream(bits) == EM4X50_TAG_WORD)
|
while (get_word_from_bitstream(bits) == EM4X50_TAG_WORD)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue