- remove prototypes for already-removed _register() functions from headers
authorHarald Welte <laforge@gnumonks.org>
Sat, 14 Oct 2006 15:22:36 +0000 (15:22 +0000)
committerHarald Welte <laforge@gnumonks.org>
Sat, 14 Oct 2006 15:22:36 +0000 (15:22 +0000)
- automatically define LIBRFID_STATIC if LIBRFID_FIRMWARE is set
- remove any references to printf/snprintf
- remove bogus free() in 14443b_init

git-svn-id: https://svn.gnumonks.org/trunk/librfid@1905 e0336214-984f-0b4b-a45f-81c69e1f0ede

include/librfid/rfid_protocol.h
include/librfid/rfid_reader.h
include/librfid/rfid_system.h
src/rfid.c
src/rfid_asic_rc632.c
src/rfid_layer2_iso14443b.c
src/rfid_reader_cm5121.c
src/rfid_reader_cm5121_openct.c
src/rfid_reader_openpcd.c

index 28fae69..2b02a42 100644 (file)
@@ -68,8 +68,6 @@ struct rfid_protocol {
        } fn;
 };
 
-int rfid_protocol_register(struct rfid_protocol *p);
-
 #include <librfid/rfid_protocol_tcl.h>
 #include <librfid/rfid_protocol_mifare_ul.h>
 #include <librfid/rfid_protocol_mifare_classic.h>
index 2221abd..2a5c2d1 100644 (file)
@@ -63,9 +63,6 @@ struct rfid_reader_handle {
        struct rfid_reader *reader;
 };
 
-
-extern int rfid_reader_register(struct rfid_reader *r);
-
 extern struct rfid_reader_handle *
 rfid_reader_open(void *data, unsigned int id);
 
index 9b07cf7..7f9c1b3 100644 (file)
@@ -1,10 +1,14 @@
 /* system / environment specific defines */
 
 /* build for openpcd firmware */
-//#define LIBRFID_FIRMWARE
+#define LIBRFID_FIRMWARE
 
 /* build without dynamic allocations */
+//#define LIBRFID_STATIC
+//
+#ifdef LIBRFID_FIRMWARE
 #define LIBRFID_STATIC
+#endif
 
 #ifdef __LIBRFID__
 
index 10abb99..fa98220 100644 (file)
@@ -31,6 +31,7 @@ struct rfid_asic_transport_handle rfid_ath;
 struct rfid_reader_handle rfid_rh;
 #endif
 
+#ifndef LIBRFID_FIRMWARE
 const char *
 rfid_hexdump(const void *data, unsigned int len)
 {
@@ -47,6 +48,9 @@ rfid_hexdump(const void *data, unsigned int len)
        }
        return string;
 }
+#else
+#define rfid_hexdump(x, y) hexdump(x, y)
+#endif
 
 #if 0
 int rfid_setopt(struct rfid_handle *rh, unsigned int level,
@@ -98,16 +102,6 @@ int rfid_getopt(struct rfid_handle *rh, unsigned int level,
 
 int rfid_init()
 {
-#if 0
-       rfid_reader_register(&rfid_reader_cm5121);
-       rfid_reader_register(&rfid_reader_openpcd);
-       rfid_layer2_register(&rfid_layer2_iso14443a);
-       rfid_layer2_register(&rfid_layer2_iso14443b);
-       rfid_protocol_register(&rfid_protocol_tcl);
-       rfid_protocol_register(&rfid_protocol_mful);
-       rfid_protocol_register(&rfid_protocol_mfcl);
-#endif
-
        return 0;
 }
 
index f8a8483..b421ca6 100644 (file)
@@ -402,7 +402,7 @@ rc632_transceive(struct rfid_asic_handle *handle,
                                return ret;
 
                        cur_tx_len = 64 - fifo_fill;
-                       printf("refilling tx fifo with %u bytes\n", cur_tx_len);
+                       //printf("refilling tx fifo with %u bytes\n", cur_tx_len);
                } else
                        cur_tx_len = 0;
 
@@ -420,9 +420,9 @@ rc632_transceive(struct rfid_asic_handle *handle,
        if (ret < 0)
                return ret;
 
-       if (rx_avail > *rx_len)
-               printf("rx_avail(%d) > rx_len(%d), JFYI\n", rx_avail, *rx_len);
-       else if (*rx_len > rx_avail)
+       if (rx_avail > *rx_len) {
+               //printf("rx_avail(%d) > rx_len(%d), JFYI\n", rx_avail, *rx_len);
+       else if (*rx_len > rx_avail)
                *rx_len = rx_avail;
 
        if (rx_avail == 0) {
index d88fee5..34575c5 100644 (file)
@@ -173,10 +173,8 @@ transceive_attrib(struct rfid_layer2_handle *h, const unsigned char *inf,
        int ret = 0;
        
        DEBUGP("fsd is %u\n", h->priv.iso14443b.fsd);
-       if (rx_len >= rx_len-1) {
-               perror("rx_len too large\n");
-               goto out_attrib;
-       }
+       if (rx_len >= rx_len-1)
+               return -EINVAL;
 
        /* initialize attrib frame */
        memset(&_attrib_buf, 0, sizeof(_attrib_buf));
@@ -230,7 +228,6 @@ transceive_attrib(struct rfid_layer2_handle *h, const unsigned char *inf,
        memcpy(rx_data, rx_buf+1, *rx_len);
 
 out_rx:
-       free(rx_buf);
 out_attrib:
 
        return ret;
index a62cc4c..9587272 100644 (file)
@@ -305,7 +305,6 @@ static int cm5121_enable_rc632(struct rfid_asic_transport_handle *rath)
        unsigned int rx_len = sizeof(rx_buf);
 
        PC_to_RDR_Escape(rath->data, tx_buf, 1, rx_buf, &rx_len);
-       printf("received %u bytes from 01 command\n", rx_len);
 
        return 0;
 }
index 4bc879c..801f076 100644 (file)
@@ -39,18 +39,13 @@ int cm5121_source_init(struct rfid_asic_transport_handle *rath)
        if (!h)
                return -1;
 
-       printf("acquiring card lock\n");
        rc = ct_card_lock(h, slot, IFD_LOCK_EXCLUSIVE, &lock);
-       if (rc < 0) {
-               fprintf(stderr, "error, no card lock\n");
+       if (rc < 0)
                return -1;
-       }
 
        rc = ct_card_reset(h, slot, atr, sizeof(atr));
-       if (rc < 0) {
-               fprintf(stderr, "error, can't reset virtual card\n");
+       if (rc < 0)
                return -1;
-       }
 
        rath->data = h;
 
index dc9db10..aee3d18 100644 (file)
@@ -233,7 +233,7 @@ static int openpcd_reg_read(struct rfid_asic_transport_handle *rath,
                            unsigned char reg,
                            unsigned char *value)
 {
-       return rc632_reg_write(rath, reg, value);
+       return rc632_reg_read(rath, reg, value);
 }
 
 
@@ -241,7 +241,7 @@ static int openpcd_fifo_read(struct rfid_asic_transport_handle *rath,
                             unsigned char num_bytes,
                             unsigned char *buf)
 {
-       return rc632_reg_write(rath, num_bytes, buf);
+       return rc632_fifo_read(rath, num_bytes, buf);
 }
 
 static int openpcd_fifo_write(struct rfid_asic_transport_handle *rath,