{
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) {
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;
return ph->l2h->rh->reader->mifare_classic.setkey(ph->l2h->rh, key);
}
+int mfcl_set_key_ee(struct rfid_protocol_handle *ph, unsigned int addr)
+{
+ if (!ph->l2h->rh->reader->mifare_classic.setkey_ee)
+ return -ENODEV;
+
+ return ph->l2h->rh->reader->mifare_classic.setkey_ee(ph->l2h->rh, addr);
+}
+
int mfcl_auth(struct rfid_protocol_handle *ph, u_int8_t cmd, u_int8_t block)
{
u_int32_t serno = *((u_int32_t *)ph->l2h->uid);