diff options
| author | laforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede> | 2008-02-07 16:17:18 +0000 | 
|---|---|---|
| committer | laforge <laforge@e0336214-984f-0b4b-a45f-81c69e1f0ede> | 2008-02-07 16:17:18 +0000 | 
| commit | 621d27cc64f984e435d3ee66846d29ac5f052ba6 (patch) | |
| tree | f46ed219710047a6a552064ead20b88eab0f5531 /src/rfid_proto_mifare_classic.c | |
| parent | 9a7ba1f0d886fba6fff5da3e3340a986df23db0a (diff) | |
add (preliminary?) SAK based detection of mifare mini.
git-svn-id: https://svn.gnumonks.org/trunk/librfid@2073 e0336214-984f-0b4b-a45f-81c69e1f0ede
Diffstat (limited to 'src/rfid_proto_mifare_classic.c')
| -rw-r--r-- | src/rfid_proto_mifare_classic.c | 15 | 
1 files changed, 11 insertions, 4 deletions
| diff --git a/src/rfid_proto_mifare_classic.c b/src/rfid_proto_mifare_classic.c index 003e8b0..66e4287 100644 --- a/src/rfid_proto_mifare_classic.c +++ b/src/rfid_proto_mifare_classic.c @@ -115,7 +115,9 @@ mfcl_getopt(struct rfid_protocol_handle *ph, int optname, void *optval,  {  	int ret = -EINVAL;  	u_int8_t atqa[2]; +	u_int8_t sak;  	unsigned int atqa_size = sizeof(atqa); +	unsigned int sak_size = sizeof(sak);  	unsigned int *size = optval;  	switch (optname) { @@ -126,10 +128,15 @@ mfcl_getopt(struct rfid_protocol_handle *ph, int optname, void *optval,  		ret = 0;  		rfid_layer2_getopt(ph->l2h, RFID_OPT_14443A_ATQA,  				   atqa, &atqa_size); -		/* FIXME: ATQA of mifare mini */ -		if (atqa[0] == 0x04 && atqa[1] == 0x00) -			*size = 1024; -		else if (atqa[0] == 0x02 && atqa[1] == 0x00) +		rfid_layer2_getopt(ph->l2h, RFID_OPT_14443A_SAK, +				   &sak, &sak_size); +		if (atqa[0] == 0x04 && atqa[1] == 0x00) { +			if (sak == 0x09) { +				/* mifare mini */ +				*size = 320; +			} else +				*size = 1024; +		} else if (atqa[0] == 0x02 && atqa[1] == 0x00)  			*size = 4096;  		else  			ret = -EIO; | 
