fixed ISO 14443A anticollision
[librfid] / src / rfid_reader_cm5121.c
index dd15fd6..1514551 100644 (file)
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-
-#ifndef LIBRFID_FIRMWARE
-
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
 
 #include <librfid/rfid.h>
+
+#ifndef LIBRFID_FIRMWARE
+
 #include <librfid/rfid_reader.h>
 #include <librfid/rfid_asic.h>
 #include <librfid/rfid_asic_rc632.h>
@@ -67,7 +67,7 @@ int Write1ByteToReg(struct rfid_asic_transport_handle *rath,
 {
        unsigned char sndbuf[SENDBUF_LEN];
        unsigned char rcvbuf[RECVBUF_LEN];
-       unsigned int retlen = RECVBUF_LEN;
+       size_t retlen = RECVBUF_LEN;
 
        sndbuf[0] = 0x20;
        sndbuf[1] = 0x00;
@@ -96,7 +96,7 @@ static int Read1ByteFromReg(struct rfid_asic_transport_handle *rath,
 {
        unsigned char sndbuf[SENDBUF_LEN];
        unsigned char recvbuf[RECVBUF_LEN];
-       unsigned int retlen = sizeof(recvbuf);
+       size_t retlen = sizeof(recvbuf);
 
        sndbuf[0] = 0x20;
        sndbuf[1] = 0x00;
@@ -124,7 +124,7 @@ static int ReadNBytesFromFIFO(struct rfid_asic_transport_handle *rath,
 {
        unsigned char sndbuf[SENDBUF_LEN];
        unsigned char recvbuf[0x7f];
-       unsigned int retlen = sizeof(recvbuf);
+       size_t retlen = sizeof(recvbuf);
 
        sndbuf[0] = 0x20;
        sndbuf[1] = 0x00;
@@ -153,7 +153,7 @@ static int WriteNBytesToFIFO(struct rfid_asic_transport_handle *rath,
 {
        unsigned char sndbuf[SENDBUF_LEN];
        unsigned char recvbuf[0x7f];
-       unsigned int retlen = sizeof(recvbuf);
+       size_t retlen = sizeof(recvbuf);
 
        sndbuf[0] = 0x20;
        sndbuf[1] = 0x00;
@@ -302,10 +302,9 @@ static int cm5121_enable_rc632(struct rfid_asic_transport_handle *rath)
 {
        unsigned char tx_buf[1] = { 0x01 };     
        unsigned char rx_buf[64];
-       unsigned int rx_len = sizeof(rx_buf);
+       size_t 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;
 }
@@ -381,6 +380,9 @@ const struct rfid_reader rfid_reader_cm5121 = {
        .iso14443b = {
                .init = &cm5121_14443b_init,
        },
+       .iso15693 = {
+               .init = &cm5121_15693_init,
+       },
        .mifare_classic = {
                .setkey = &cm5121_mifare_setkey,
                .auth = &cm5121_mifare_auth,