minors fixes and indent.

This commit is contained in:
Romuald Conty 2011-04-08 09:17:10 +00:00
parent 9e636c9885
commit d1c676b01d

View file

@ -30,6 +30,8 @@
URL http://www.cs.ru.nl/~petervr/papers/grvw_2009_pickpocket.pdf URL http://www.cs.ru.nl/~petervr/papers/grvw_2009_pickpocket.pdf
*/ */
/* vim: set ts=2 sw=2 et: */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
@ -48,6 +50,11 @@
#include "mfoc.h" #include "mfoc.h"
int main(int argc, char * const argv[]) { int main(int argc, char * const argv[]) {
const nfc_modulation_t nm = {
.nmt = NMT_ISO14443A,
.nbr = NBR_106,
};
int ch, i, k, n, j, m, o; int ch, i, k, n, j, m, o;
int key, block; int key, block;
int succeed = 1; int succeed = 1;
@ -159,26 +166,26 @@ int main(int argc, char * const argv[]) {
mf_init(&t, &r); mf_init(&t, &r);
if (!nfc_initiator_init (r.pdi)) { if (!nfc_initiator_init (r.pdi)) {
nfc_perror (pnd, "nfc_initiator_init"); nfc_perror (r.pdi, "nfc_initiator_init");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
// Drop the field for a while, so can be reset // Drop the field for a while, so can be reset
if (!nfc_configure(r.pdi, NDO_ACTIVATE_FIELD, true) { if (!nfc_configure(r.pdi, NDO_ACTIVATE_FIELD, true)) {
nfc_perror (pnd, "nfc_configure activate field"); nfc_perror (r.pdi, "nfc_configure activate field");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
// Let the reader only try once to find a tag // Let the reader only try once to find a tag
if (!nfc_configure(r.pdi, NDO_INFINITE_SELECT, false) { if (!nfc_configure(r.pdi, NDO_INFINITE_SELECT, false)) {
nfc_perror (pnd, "nfc_configure infinite select"); nfc_perror (r.pdi, "nfc_configure infinite select");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
// Configure the CRC and Parity settings // Configure the CRC and Parity settings
if (!nfc_configure(r.pdi, NDO_HANDLE_CRC, true) { if (!nfc_configure(r.pdi, NDO_HANDLE_CRC, true)) {
nfc_perror (pnd, "nfc_configure crc"); nfc_perror (r.pdi, "nfc_configure crc");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
if (!nfc_configure(r.pdi, NDO_HANDLE_PARITY, true) { if (!nfc_configure(r.pdi, NDO_HANDLE_PARITY, true)) {
nfc_perror (pnd, "nfc_configure parity"); nfc_perror (r.pdi, "nfc_configure parity");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }
@ -189,7 +196,7 @@ int main(int argc, char * const argv[]) {
// mf_select_tag(r.pdi, &(t.nt)); // mf_select_tag(r.pdi, &(t.nt));
if (!nfc_initiator_select_passive_target (r.pdi, nm, NULL, 0, &t.nt)) { if (!nfc_initiator_select_passive_target (r.pdi, nm, NULL, 0, &t.nt)) {
nfc_perror (pnd, "nfc_initiator_select_passive_target"); nfc_perror (r.pdi, "nfc_initiator_select_passive_target");
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} }