test/test_device_modes_as_dep: increase duration of sleep() between nfc_idle() and nfc_target_init() to wait for the end of nfc_initiator_poll_dep_target().
This commit is contained in:
parent
bd0de9bd61
commit
84a864f8d3
1 changed files with 14 additions and 13 deletions
|
@ -55,7 +55,18 @@ target_thread (void *arg)
|
||||||
cut_set_current_test_context (((struct thread_data *) arg)->cut_test_context);
|
cut_set_current_test_context (((struct thread_data *) arg)->cut_test_context);
|
||||||
|
|
||||||
printf ("=========== TARGET %s =========\n", nfc_device_get_name (device));
|
printf ("=========== TARGET %s =========\n", nfc_device_get_name (device));
|
||||||
nfc_target nt = {
|
nfc_target nt;
|
||||||
|
|
||||||
|
uint8_t abtRx[1024];
|
||||||
|
size_t szRx = sizeof (abtRx);
|
||||||
|
|
||||||
|
// 1) nfc_target_init should take target in idle mode
|
||||||
|
int res = nfc_target_init (device, &nt, abtRx, szRx, 500);
|
||||||
|
cut_assert_operator_int (res, >=, 0, cut_message ("Can't initialize NFC device as target: %s", nfc_strerror (device)));
|
||||||
|
if (res < 0) { thread_res = -1; return (void*) thread_res; }
|
||||||
|
|
||||||
|
// 2) act as target
|
||||||
|
nfc_target nt1 = {
|
||||||
.nm = {
|
.nm = {
|
||||||
.nmt = NMT_DEP,
|
.nmt = NMT_DEP,
|
||||||
.nbr = NBR_UNDEFINED
|
.nbr = NBR_UNDEFINED
|
||||||
|
@ -75,18 +86,8 @@ target_thread (void *arg)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
sleep(6);
|
||||||
uint8_t abtRx[1024];
|
res = nfc_target_init (device, &nt1, abtRx, szRx, 0);
|
||||||
size_t szRx = sizeof (abtRx);
|
|
||||||
|
|
||||||
// 1) nfc_target_init should take target in idle mode
|
|
||||||
int res = nfc_target_init (device, &nt, abtRx, szRx, 500);
|
|
||||||
cut_assert_operator_int (res, >=, 0, cut_message ("Can't initialize NFC device as target: %s", nfc_strerror (device)));
|
|
||||||
if (res < 0) { thread_res = -1; return (void*) thread_res; }
|
|
||||||
|
|
||||||
// 2) act as target
|
|
||||||
sleep(1);
|
|
||||||
res = nfc_target_init (device, &nt, abtRx, szRx, 0);
|
|
||||||
cut_assert_operator_int (res, >, 0, cut_message ("Can't initialize NFC device as target: %s", nfc_strerror (device)));
|
cut_assert_operator_int (res, >, 0, cut_message ("Can't initialize NFC device as target: %s", nfc_strerror (device)));
|
||||||
if (res < 0) { thread_res = -1; return (void*) thread_res; }
|
if (res < 0) { thread_res = -1; return (void*) thread_res; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue