Add RFID_OPT_14443A_WUPA to request WUPA instead of REQA (Rainer Keller <mail@rainerk...
authorHenryk Ploetz <ploetz@informatik.hu-berlin.de>
Tue, 20 Mar 2007 00:47:12 +0000 (00:47 +0000)
committerHenryk Ploetz <ploetz@informatik.hu-berlin.de>
Tue, 20 Mar 2007 00:47:12 +0000 (00:47 +0000)
git-svn-id: https://svn.gnumonks.org/trunk/librfid@1985 e0336214-984f-0b4b-a45f-81c69e1f0ede

include/librfid/rfid_layer2_iso14443a.h
src/rfid_layer2_iso14443a.c
src/rfid_layer2_iso14443b.c
src/rfid_proto_mifare_ul.c

index b9ef954..9a795c2 100644 (file)
@@ -5,6 +5,7 @@ enum rfid_14443a_opt {
        RFID_OPT_14443A_SPEED_RX        = 0x00010001,
        RFID_OPT_14443A_SPEED_TX        = 0x00010002,
        RFID_OPT_14443A_ATQA            = 0x00010003,
+       RFID_OPT_14443A_WUPA            = 0x00010004,
 };
 
 enum rfid_14443_opt_speed {
index 429577c..4716018 100644 (file)
@@ -280,6 +280,13 @@ iso14443a_setopt(struct rfid_layer2_handle *handle, int optname,
                speed = *(unsigned int *)optval;
                ret = rdr->iso14443a.set_speed(handle->rh, 1, speed);
                break;
+       case RFID_OPT_14443A_WUPA:
+               if((unsigned int*)optval)
+                       handle->flags |= RFID_OPT_LAYER2_WUP;
+               else
+                       handle->flags &= ~RFID_OPT_LAYER2_WUP;
+               ret = 0;
+               break;
        };
 
        return ret;
@@ -287,17 +294,22 @@ iso14443a_setopt(struct rfid_layer2_handle *handle, int optname,
 
 static int
 iso14443a_getopt(struct rfid_layer2_handle *handle, int optname,
-                void *optval, unsigned int optlen)
+                void *optval, unsigned int *optlen)
 {
        int ret = -EINVAL;
        struct iso14443a_handle *h = &handle->priv.iso14443a;
        struct iso14443a_atqa *atqa = optval;
+       int *wupa = optval;
 
        switch (optname) {
        case RFID_OPT_14443A_ATQA:
                *atqa = h->atqa;
                ret = 0;
                break;
+       case RFID_OPT_14443A_WUPA:
+               *wupa = ((handle->flags & RFID_OPT_LAYER2_WUP) != 0);
+               ret = 0;
+               break;
        };
 
        return ret;
index 34575c5..e5fb151 100644 (file)
@@ -337,7 +337,7 @@ iso14443b_transceive(struct rfid_layer2_handle *handle,
 
 static int
 iso14443b_getopt(struct rfid_layer2_handle *handle,
-                int optname, void *optval, unsigned int optlen)
+                int optname, void *optval, unsigned int *optlen)
 {
        unsigned int *opt_ui = optval;
 
index 65347b1..7243c89 100644 (file)
@@ -110,7 +110,7 @@ mful_transceive(struct rfid_protocol_handle *ph,
 
 static int 
 mful_getopt(struct rfid_protocol_handle *ph, int optname, void *optval,
-           unsigned int optlen)
+           unsigned int *optlen)
 {
        int ret = -EINVAL;
        u_int16_t atqa;
@@ -139,7 +139,7 @@ mful_init(struct rfid_layer2_handle *l2h)
        
        /* According to "Type Identification Procedure Rev. 1.3" */
        rfid_layer2_getopt(l2h, RFID_OPT_14443A_ATQA,
-                          &atqa, atqa_len);
+                          &atqa, &atqa_len);
        if (atqa != 0x0044)
                return NULL;