* add rfid_reader_rc632_common.h to noinst_HEADERS
[librfid] / utils / common.c
index 2966ab4..ec7fda0 100644 (file)
@@ -3,7 +3,10 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
+
+#ifndef __MINGW32__
 #include <libgen.h>
+#endif
 
 #include <librfid/rfid.h>
 #include <librfid/rfid_scan.h>
@@ -15,6 +18,7 @@
 #include <librfid/rfid_protocol_mifare_ul.h>
 
 #include "librfid-tool.h"
+#include "common.h"
 
 const char *
 hexdump(const void *data, unsigned int len)
@@ -51,10 +55,8 @@ hexread(unsigned char *result, const unsigned char *in, unsigned int len)
        unsigned char *res = result;
 
        for (pos = in; pos-in <= len-2; pos+=2) {
-               if (*pos == ':') {
+               if (*pos == ':')
                        pos++;
-                       continue;
-               }
                dig1 = *pos;
                dig2 = *(pos+1);
 
@@ -70,13 +72,13 @@ struct rfid_protocol_handle *ph;
 
 int reader_init(void) 
 {
-       printf("opening reader handle\n");
-       rh = rfid_reader_open(NULL, RFID_READER_CM5121);
+       printf("opening reader handle OpenPCD, CM5x21\n");
+       rh = rfid_reader_open(NULL, RFID_READER_OPENPCD);
        if (!rh) {
-               fprintf(stderr, "No Omnikey Cardman 5121 found\n");
-               rh = rfid_reader_open(NULL, RFID_READER_OPENPCD);
+               fprintf(stderr, "No OpenPCD found\n");
+               rh = rfid_reader_open(NULL, RFID_READER_CM5121);
                if (!rh) {
-                       fprintf(stderr, "No OpenPCD found either\n");
+                       fprintf(stderr, "No Omnikey Cardman 5x21 found\n");
                        return -1;
                }
        }
@@ -85,17 +87,16 @@ int reader_init(void)
 
 int l2_init(int layer2)
 {
-       unsigned char buf[0x3f];
        int rc;
 
        printf("opening layer2 handle\n");
        l2h = rfid_layer2_init(rh, layer2);
        if (!l2h) {
-               fprintf(stderr, "error during iso14443a_init\n");
+               fprintf(stderr, "error during layer2(%d)_init (0=14a,1=14b,3=15)\n",layer2);
                return -1;
        }
 
-       printf("running layer2 anticol\n");
+       printf("running layer2 anticol(_open)\n");
        rc = rfid_layer2_open(l2h);
        if (rc < 0) {
                fprintf(stderr, "error during layer2_open\n");