- LED_B_ON();\r
- if (Pages==16) cmd_send(CMD_ACK,isOK,0,0,dataoutbuf,64);\r
- if (Pages==44 && count_Pages==16) cmd_send(CMD_ACK,isOK,0,0,dataoutbuf,64);\r
- if (Pages==44 && count_Pages>16) cmd_send(CMD_ACK,isOK,0,0,dataoutbuf,176);\r
- LED_B_OFF();\r
+ int len = iso14443a_select_card(uid, NULL, &cuid);\r
+ \r
+ if (!len) {\r
+ if (MF_DBGLEVEL >= MF_DBG_ERROR)\r
+ Dbprintf("Can't select card");\r
+ //OnError(1);\r
+ return;\r
+ }\r
+ \r
+ for (int i = 0; i < Pages; i++){\r
+ \r
+ len = mifare_ultra_readblock(cuid, sectorNo * 4 + i, dataout + 4 * i);\r
+ \r
+ if (len) {\r
+ if (MF_DBGLEVEL >= MF_DBG_ERROR)\r
+ Dbprintf("Read block %d error",i);\r
+ //OnError(2);\r
+ return;\r
+ } else {\r
+ count_Pages++;\r
+ }\r
+ }\r
+ \r
+ len = mifare_ultra_halt(cuid);\r
+ if (len) {\r
+ if (MF_DBGLEVEL >= MF_DBG_ERROR)\r
+ Dbprintf("Halt error");\r
+ //OnError(3);\r
+ return;\r
+ }\r
+ \r
+ if (MF_DBGLEVEL >= MF_DBG_ALL) {\r
+ Dbprintf("Pages read %d", count_Pages);\r
+ }\r