+static int
+mfcl_getopt(struct rfid_protocol_handle *ph, int optname, void *optval,
+ unsigned int *optlen)
+{
+ int ret = -EINVAL;
+ u_int16_t atqa;
+ unsigned int atqa_size = sizeof(atqa);
+ unsigned int *size = optval;
+
+ switch (optname) {
+ case RFID_OPT_PROTO_SIZE:
+ if (*optlen < sizeof(*size))
+ return -EINVAL;
+ *optlen = sizeof(*size);
+ ret = 0;
+ rfid_layer2_getopt(ph->l2h, RFID_OPT_14443A_ATQA,
+ (void *) &atqa, &atqa_size);
+ if (atqa == 0x0004)
+ *size = 1024;
+ else if (atqa == 0x0002)
+ *size = 4096;
+ else
+ ret = -EIO;
+ break;
+ }
+
+ return ret;
+}
+