ReadMobib: make it compatible with Basic card

This commit is contained in:
Philippe Teuwen 2012-11-10 17:11:48 +01:00
parent 9f90a04a84
commit 6c7c0a6e63
2 changed files with 52 additions and 33 deletions

View file

@ -15,7 +15,8 @@ cat << EOF | \
sub(/Rx: 00/,"")
gsub(/ +/," ")
sub(/ 90 00 $/,"")
print n toupper($0)}'
print n toupper($0)}' |\
grep -v ": 6A 83"
# Select one typeB target
4A010300
@ -33,72 +34,82 @@ cat << EOF | \
4001 80b2 0204 1d
# Select EnvHol file
4001 80a4 0800 04 2000 2001
4001 00a4 0800 04 2000 2001
#EnvHol1:
4001 80b2 0104 1d
4001 00b2 0104 1d
#EnvHol2:
4001 80b2 0204 1d
4001 00b2 0204 1d
# Select EvLog file
4001 80a4 0800 04 2000 2010
4001 00a4 0800 04 2000 2010
#EvLog1:
4001 80b2 0104 1d
4001 00b2 0104 1d
#EvLog2:
4001 80b2 0204 1d
4001 00b2 0204 1d
#EvLog3:
4001 80b2 0304 1d
4001 00b2 0304 1d
# Select ConList file
4001 80a4 0800 04 2000 2050
4001 00a4 0800 04 2000 2050
#ConList:
4001 80b2 0104 1d
4001 00b2 0104 1d
# Select Contra file
4001 80a4 0800 04 2000 2020
4001 00a4 0800 04 2000 2020
#Contra1:
4001 80b2 0104 1d
4001 00b2 0104 1d
#Contra2:
4001 80b2 0204 1d
4001 00b2 0204 1d
#Contra3:
4001 80b2 0304 1d
4001 00b2 0304 1d
#Contra4:
4001 80b2 0404 1d
4001 00b2 0404 1d
#Contra5:
4001 80b2 0504 1d
4001 00b2 0504 1d
#Contra6:
4001 80b2 0604 1d
4001 00b2 0604 1d
#Contra7:
4001 80b2 0704 1d
4001 00b2 0704 1d
#Contra8:
4001 80b2 0804 1d
4001 00b2 0804 1d
#Contra9:
4001 00b2 0904 1d
#ContraA:
4001 00b2 0a04 1d
#ContraB:
4001 00b2 0b04 1d
#ContraC:
4001 00b2 0c04 1d
# Select Counter file
4001 80a4 0800 04 2000 2069
4001 00a4 0800 04 2000 2069
#Counter:
4001 80b2 0104 1d
4001 00b2 0104 1d
# Select LoadLog file
4001 80a4 0800 04 1000 1014
4001 00a4 0800 04 1000 1014
#LoadLog:
4001 80b2 0104 1d
4001 00b2 0104 1d
# Select Purcha file
4001 80a4 08 0004 1000 1015
4001 00a4 08 0004 1000 1015
#Purcha1:
4001 80b2 0104 1d
4001 00b2 0104 1d
#Purcha2:
4001 80b2 0204 1d
4001 00b2 0204 1d
#Purcha3:
4001 00b2 0304 1d
# Select SpecEv file
4001 80a4 08 0004 2000 2040
4001 00a4 08 0004 2000 2040
#SpecEv1:
4001 80b2 0104 1d
4001 00b2 0104 1d
#SpecEv2:
4001 80b2 0204 1d
4001 00b2 0204 1d
#SpecEv3:
4001 80b2 0304 1d
4001 00b2 0304 1d
#SpecEv4:
4001 80b2 0404 1d
4001 00b2 0404 1d
EOF

View file

@ -67,6 +67,7 @@ static bool quitting = false;
static bool quiet_output = false;
static bool initiator_only_mode = false;
static bool target_only_mode = false;
static bool swap_devices = false;
static int waiting_time = 0;
FILE *fd3;
FILE *fd4;
@ -168,6 +169,9 @@ main(int argc, char *argv[])
printf("INFO: %s\n", "Initiator mode only.");
initiator_only_mode = true;
target_only_mode = false;
} else if (0 == strcmp(argv[arg], "-s")) {
printf("INFO: %s\n", "Swapping devices.");
swap_devices = true;
} else if (0 == strcmp(argv[arg], "-n")) {
if (++arg == argc || (sscanf(argv[arg], "%i", &waiting_time) < 1)) {
ERR("Missing or wrong waiting time value: %s.", argv[arg]);
@ -217,7 +221,7 @@ main(int argc, char *argv[])
// there is already a target used locally or not on the same machine:
// if there is more than one readers opened we open the second reader
// (we hope they're always detected in the same order)
if (szFound == 1) {
if ((szFound == 1) || swap_devices) {
pndInitiator = nfc_open(NULL, connstrings[0]);
} else {
pndInitiator = nfc_open(NULL, connstrings[1]);
@ -353,7 +357,11 @@ main(int argc, char *argv[])
print_nfc_target(ntEmulatedTarget, false);
// Try to open the NFC emulator device
if (swap_devices) {
pndTarget = nfc_open(NULL, connstrings[1]);
} else {
pndTarget = nfc_open(NULL, connstrings[0]);
}
if (pndTarget == NULL) {
printf("Error opening NFC emulator device\n");
if (!target_only_mode) {