Remove extra whitespaces/tabs before EOL.
find . -name '*.[ch]' | xargs perl -pi -e 's/\t+$//; s/ +$//' Thanks to Ludovic.
This commit is contained in:
parent
167238c60d
commit
26865bbc19
66 changed files with 483 additions and 483 deletions
|
|
@ -18,7 +18,7 @@ test_access_storm (void)
|
|||
int res = 0;
|
||||
|
||||
nfc_init (NULL);
|
||||
|
||||
|
||||
size_t ref_device_count = nfc_list_devices (NULL, connstrings, MAX_DEVICE_COUNT);
|
||||
if (!ref_device_count)
|
||||
cut_omit ("No NFC device found");
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ target_thread (void *arg)
|
|||
const uint8_t abtAttRx[] = "Hello DEP target!";
|
||||
cut_assert_equal_memory (abtAttRx, sizeof (abtAttRx), abtRx, szRx, cut_message ("Invalid received data"));
|
||||
if (res <= 0) { thread_res = -1; return (void*) thread_res; }
|
||||
|
||||
|
||||
const uint8_t abtTx[] = "Hello DEP initiator!";
|
||||
res = nfc_target_send_bytes (device, abtTx, sizeof(abtTx), 500);
|
||||
cut_assert_operator_int (res, >, 0, cut_message ("Can't send bytes to initiator: %s", nfc_strerror (device)));
|
||||
|
|
@ -121,7 +121,7 @@ initiator_thread (void *arg)
|
|||
|
||||
nfc_target nt;
|
||||
|
||||
// Active mode
|
||||
// Active mode
|
||||
printf ("=========== INITIATOR %s (Active mode / %s Kbps) =========\n", nfc_device_get_name (device), str_nfc_baud_rate(nbr));
|
||||
res = nfc_initiator_select_dep_target (device, NDM_ACTIVE, nbr, NULL, &nt, 1000);
|
||||
cut_assert_operator_int (res, >, 0, cut_message ("Can't select any DEP target: %s", nfc_strerror (device)));
|
||||
|
|
@ -159,15 +159,15 @@ test_dep (void)
|
|||
.device = devices[TARGET],
|
||||
.cut_test_context = test_context,
|
||||
};
|
||||
|
||||
|
||||
struct thread_data initiator_data = {
|
||||
.device = devices[INITIATOR],
|
||||
.cut_test_context = test_context,
|
||||
};
|
||||
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
initiator_data.nbr = nbrs[i];
|
||||
|
||||
|
||||
if ((res = pthread_create (&(threads[TARGET]), NULL, target_thread, &target_data)))
|
||||
cut_fail ("pthread_create() returned %d", res);
|
||||
if ((res = pthread_create (&(threads[INITIATOR]), NULL, initiator_thread, &initiator_data)))
|
||||
|
|
@ -181,5 +181,5 @@ test_dep (void)
|
|||
cut_assert_equal_int (0, result[INITIATOR], cut_message ("Unexpected initiator return code"));
|
||||
cut_assert_equal_int (0, result[TARGET], cut_message ("Unexpected target return code"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ cut_setup (void)
|
|||
if (n < 2) {
|
||||
cut_omit ("At least two NFC devices must be plugged-in to run this test");
|
||||
}
|
||||
|
||||
|
||||
nfc_init (NULL);
|
||||
devices[TARGET] = nfc_open (NULL, connstrings[TARGET]);
|
||||
devices[INITIATOR] = nfc_open (NULL, connstrings[INITIATOR]);
|
||||
|
|
@ -90,11 +90,11 @@ target_thread (void *arg)
|
|||
res = nfc_target_receive_bytes (device, abtRx, sizeof (abtRx), 500);
|
||||
cut_assert_operator_int (res, >, 0, cut_message ("Can't receive bytes from initiator: %s", nfc_strerror (device)));
|
||||
szRx = (size_t) res;
|
||||
|
||||
|
||||
const uint8_t abtAttRx[] = "Hello DEP target!";
|
||||
cut_assert_equal_memory (abtAttRx, sizeof (abtAttRx), abtRx, szRx, cut_message ("Invalid received data"));
|
||||
if (res <= 0) { thread_res = -1; return (void*) thread_res; }
|
||||
|
||||
|
||||
const uint8_t abtTx[] = "Hello DEP initiator!";
|
||||
res = nfc_target_send_bytes (device, abtTx, sizeof(abtTx), 500);
|
||||
cut_assert_operator_int (res, >, 0, cut_message ("Can't send bytes to initiator: %s", nfc_strerror (device)));
|
||||
|
|
@ -107,7 +107,7 @@ target_thread (void *arg)
|
|||
|
||||
cut_assert_equal_memory (abtAttRx, sizeof (abtAttRx), abtRx, szRx, cut_message ("Invalid received data"));
|
||||
if (res <= 0) { thread_res = -1; return (void*) thread_res; }
|
||||
|
||||
|
||||
res = nfc_target_send_bytes (device, abtTx, sizeof(abtTx), 500);
|
||||
cut_assert_operator_int (res, >, 0, cut_message ("Can't send bytes to initiator: %s", nfc_strerror (device)));
|
||||
if (res <= 0) { thread_res = -1; return (void*) thread_res; }
|
||||
|
|
@ -119,11 +119,11 @@ target_thread (void *arg)
|
|||
|
||||
cut_assert_equal_memory (abtAttRx, sizeof (abtAttRx), abtRx, szRx, cut_message ("Invalid received data"));
|
||||
if (res <= 0) { thread_res = -1; return (void*) thread_res; }
|
||||
|
||||
|
||||
res = nfc_target_send_bytes (device, abtTx, sizeof(abtTx), 500);
|
||||
cut_assert_operator_int (res, >, 0, cut_message ("Can't send bytes to initiator: %s", nfc_strerror (device)));
|
||||
if (res <= 0) { thread_res = -1; return (void*) thread_res; }
|
||||
|
||||
|
||||
// Fourth pass
|
||||
res = nfc_target_receive_bytes (device, abtRx, sizeof (abtRx), 500);
|
||||
cut_assert_operator_int (res, >, 0, cut_message ("Can't receive bytes from initiator: %s", nfc_strerror (device)));
|
||||
|
|
@ -131,7 +131,7 @@ target_thread (void *arg)
|
|||
|
||||
cut_assert_equal_memory (abtAttRx, sizeof (abtAttRx), abtRx, szRx, cut_message ("Invalid received data"));
|
||||
if (res <= 0) { thread_res = -1; return (void*) thread_res; }
|
||||
|
||||
|
||||
res = nfc_target_send_bytes (device, abtTx, sizeof(abtTx), 500);
|
||||
cut_assert_operator_int (res, >, 0, cut_message ("Can't send bytes to initiator: %s", nfc_strerror (device)));
|
||||
if (res <= 0) { thread_res = -1; return (void*) thread_res; }
|
||||
|
|
@ -226,7 +226,7 @@ initiator_thread (void *arg)
|
|||
res = nfc_initiator_deselect_target (device);
|
||||
cut_assert_operator_int (res, >=, 0, cut_message ("Can't deselect target: %s", nfc_strerror (device)));
|
||||
if (res < 0) { thread_res = -1; return (void*) thread_res; }
|
||||
|
||||
|
||||
// Passive mode / 424Kbps
|
||||
printf ("=========== INITIATOR %s (Passive mode / 424Kbps) =========\n", nfc_device_get_name (device));
|
||||
res = nfc_initiator_select_dep_target (device, NDM_PASSIVE, NBR_424, NULL, &nt, 1000);
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ target_thread (void *arg)
|
|||
cut_set_current_test_context (((struct thread_data *) arg)->cut_test_context);
|
||||
|
||||
printf ("=========== TARGET %s =========\n", nfc_device_get_name (device));
|
||||
nfc_target nt;
|
||||
nfc_target nt;
|
||||
|
||||
uint8_t abtRx[1024];
|
||||
size_t szRx = sizeof (abtRx);
|
||||
|
|
@ -66,7 +66,7 @@ target_thread (void *arg)
|
|||
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 = {
|
||||
|
|
@ -96,11 +96,11 @@ target_thread (void *arg)
|
|||
res = nfc_target_receive_bytes (device, abtRx, sizeof (abtRx), 500);
|
||||
cut_assert_operator_int (res, >, 0, cut_message ("Can't receive bytes from initiator: %s", nfc_strerror (device)));
|
||||
szRx = (size_t) res;
|
||||
|
||||
|
||||
const uint8_t abtAttRx[] = "Hello DEP target!";
|
||||
cut_assert_equal_memory (abtAttRx, sizeof (abtAttRx), abtRx, szRx, cut_message ("Invalid received data"));
|
||||
if (res <= 0) { thread_res = -1; return (void*) thread_res; }
|
||||
|
||||
|
||||
const uint8_t abtTx[] = "Hello DEP initiator!";
|
||||
res = nfc_target_send_bytes (device, abtTx, sizeof(abtTx), 500);
|
||||
cut_assert_operator_int (res, >, 0, cut_message ("Can't send bytes to initiator: %s", nfc_strerror (device)));
|
||||
|
|
@ -130,13 +130,13 @@ initiator_thread (void *arg)
|
|||
cut_assert_equal_int (0, res, cut_message ("Can't initialize NFC device as initiator: %s", nfc_strerror (device)));
|
||||
if (res < 0) { thread_res = -1; return (void*) thread_res; }
|
||||
|
||||
// 1) As other device should be in idle mode, nfc_initiator_poll_dep_target should return 0
|
||||
// 1) As other device should be in idle mode, nfc_initiator_poll_dep_target should return 0
|
||||
nfc_target nt;
|
||||
res = nfc_initiator_poll_dep_target (device, NDM_PASSIVE, NBR_106, NULL, &nt, 1000);
|
||||
cut_assert_equal_int (0, res, cut_message ("Problem with nfc_idle"));
|
||||
if (res != 0) { thread_res = -1; return (void*) thread_res; }
|
||||
|
||||
|
||||
|
||||
// 2 As other device should be in target mode, nfc_initiator_poll_dep_target should be positive.
|
||||
nfc_target nt1;
|
||||
|
||||
|
|
@ -165,12 +165,12 @@ initiator_thread (void *arg)
|
|||
cut_assert_operator_int (res, >=, 0, cut_message ("Can't deselect target: %s", nfc_strerror (device)));
|
||||
if (res < 0) { thread_res = -1; return (void*) thread_res; }
|
||||
|
||||
// 3) As other device should be in idle mode, nfc_initiator_poll_dep_target should return 0
|
||||
// 3) As other device should be in idle mode, nfc_initiator_poll_dep_target should return 0
|
||||
nfc_target nt2;
|
||||
res = nfc_initiator_poll_dep_target (device, NDM_PASSIVE, NBR_106, NULL, &nt2, 1000);
|
||||
cut_assert_equal_int (0, res, cut_message ("Problem with nfc_idle"));
|
||||
if (res != 0) { thread_res = -1; return (void*) thread_res; }
|
||||
|
||||
|
||||
return (void *) thread_res;
|
||||
}
|
||||
|
||||
|
|
@ -184,12 +184,12 @@ test_dep_states (void)
|
|||
.device = first_device,
|
||||
.cut_test_context = test_context,
|
||||
};
|
||||
|
||||
|
||||
struct thread_data initiator_data = {
|
||||
.device = second_device,
|
||||
.cut_test_context = test_context,
|
||||
};
|
||||
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if ((res = pthread_create (&(threads[1]), NULL, target_thread, &target_data)))
|
||||
cut_fail ("pthread_create() returned %d", res);
|
||||
|
|
@ -204,7 +204,7 @@ test_dep_states (void)
|
|||
|
||||
cut_assert_equal_int (0, result[0], cut_message ("Unexpected initiator return code"));
|
||||
cut_assert_equal_int (0, result[1], cut_message ("Unexpected target return code"));
|
||||
|
||||
|
||||
// initiator --> target, target --> initiator
|
||||
target_data.device = second_device;
|
||||
initiator_data.device = first_device;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ test_register_endianness (void)
|
|||
{
|
||||
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||
int res = 0;
|
||||
|
||||
|
||||
nfc_init (NULL);
|
||||
|
||||
size_t device_count = nfc_list_devices (NULL, connstrings, MAX_DEVICE_COUNT);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ test_register_endianness (void)
|
|||
{
|
||||
nfc_connstring connstrings[MAX_DEVICE_COUNT];
|
||||
int res = 0;
|
||||
|
||||
|
||||
nfc_init (NULL);
|
||||
|
||||
size_t device_count = nfc_list_devices (NULL, connstrings, MAX_DEVICE_COUNT);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue