-int l3_init(int protocol)
-{
- ph = rfid_protocol_init(l2h, protocol);
- if (!ph) {
- fprintf(stderr, "error during protocol_init\n");
- return -1;
- }
- if (rfid_protocol_open(ph) < 0) {
- fprintf(stderr, "error during protocol_open\n");
- return -1;
- }
-
- return 0;
-}
-
-static int mifare_cl_auth(unsigned char *key, int page)
-{
- int rc;
-
- rc = mfcl_set_key(ph, key);
- if (rc < 0) {
- fprintf(stderr, "key format error\n");
- return rc;
- }
- rc = mfcl_auth(ph, RFID_CMD_MIFARE_AUTH1A, page);
- if (rc < 0) {
- fprintf(stderr, "mifare auth error\n");
- return rc;
- } else
-// printf("mifare auth succeeded!\n");
-
- return 0;
-}
-
-static void mifare_l3(void)
-{
- while (l2_init(RFID_LAYER2_ISO14443A) < 0) ;
+ l2h = rfid_layer2_init(rh, layer2);
+ if (!l2h) {
+ fprintf(stderr, "error during layer2(%d)_init (0=14a,1=14b,3=15)\n",layer2);
+ return -1;
+ }