summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rfid_proto_mifare_classic.c9
-rw-r--r--src/rfid_proto_mifare_ul.c16
2 files changed, 7 insertions, 18 deletions
diff --git a/src/rfid_proto_mifare_classic.c b/src/rfid_proto_mifare_classic.c
index e98dc28..004e002 100644
--- a/src/rfid_proto_mifare_classic.c
+++ b/src/rfid_proto_mifare_classic.c
@@ -79,7 +79,6 @@ static int
mfcl_write(struct rfid_protocol_handle *ph, unsigned int page,
unsigned char *tx_data, unsigned int tx_len)
{
- unsigned int i;
unsigned char tx[18];
unsigned char rx[1];
unsigned int rx_len = sizeof(rx);
@@ -145,7 +144,7 @@ mfcl_getopt(struct rfid_protocol_handle *ph, int optname, void *optval,
unsigned int *optlen)
{
int ret = -EINVAL;
- u_int16_t atqa;
+ u_int8_t atqa[2];
unsigned int atqa_size = sizeof(atqa);
unsigned int *size = optval;
@@ -156,10 +155,10 @@ mfcl_getopt(struct rfid_protocol_handle *ph, int optname, void *optval,
*optlen = sizeof(*size);
ret = 0;
rfid_layer2_getopt(ph->l2h, RFID_OPT_14443A_ATQA,
- (void *) &atqa, &atqa_size);
- if (atqa == 0x0004)
+ atqa, &atqa_size);
+ if (atqa[0] == 0x04 && atqa[1] == 0x00)
*size = 1024;
- else if (atqa == 0x0002)
+ else if (atqa[0] == 0x02 && atqa[1] == 0x00)
*size = 4096;
else
ret = -EIO;
diff --git a/src/rfid_proto_mifare_ul.c b/src/rfid_proto_mifare_ul.c
index 7243c89..e1fe3b9 100644
--- a/src/rfid_proto_mifare_ul.c
+++ b/src/rfid_proto_mifare_ul.c
@@ -99,21 +99,11 @@ mful_write(struct rfid_protocol_handle *ph, unsigned int page,
return ret;
}
-static int
-mful_transceive(struct rfid_protocol_handle *ph,
- const unsigned char *tx_data, unsigned int tx_len,
- unsigned char *rx_data, unsigned int *rx_len,
- unsigned int timeout, unsigned int flags)
-{
- return -EINVAL;
-}
-
static int
mful_getopt(struct rfid_protocol_handle *ph, int optname, void *optval,
unsigned int *optlen)
{
int ret = -EINVAL;
- u_int16_t atqa;
unsigned int *size = optval;
switch (optname) {
@@ -131,7 +121,7 @@ static struct rfid_protocol_handle *
mful_init(struct rfid_layer2_handle *l2h)
{
struct rfid_protocol_handle *ph;
- u_int16_t atqa;
+ u_int8_t atqa[2];
unsigned int atqa_len = sizeof(atqa);
if (l2h->l2->id != RFID_LAYER2_ISO14443A)
@@ -139,8 +129,8 @@ 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);
- if (atqa != 0x0044)
+ atqa, &atqa_len);
+ if (atqa[0] != 0x44 || atqa[1] != 0x00)
return NULL;
/* according to "Functional Specification Rev. 3.0 */
personal git repositories of Harald Welte. Your mileage may vary