- UsbCommand c = {CMD_MIFAREUC_READCARD, {0,Pages}};
- if ( hasPwd ) {
- c.arg[2] = 1;
- memcpy(c.d.asBytes, key, 16);
- }
- SendCommand(&c);
- UsbCommand resp;
- if (!WaitForResponseTimeout(CMD_ACK, &resp,1500)) {
- PrintAndLog("Command execute time-out");
- return 1;
- }
- PrintAndLog ("%u,%u",resp.arg[0],resp.arg[1]);
- uint8_t isOK = resp.arg[0] & 0xff;
- if (isOK) {
- memcpy(data, resp.d.asBytes, resp.arg[1]);
+ if (!hasPwd || (tagtype & UL_C)){
+ UsbCommand c = {CMD_MIFAREUC_READCARD, {startPage,Pages}};
+ if ( hasPwd ) {
+ c.arg[2] = 1;
+ memcpy(c.d.asBytes, key, 16);
+ }
+ SendCommand(&c);
+ UsbCommand resp;
+ if (!WaitForResponseTimeout(CMD_ACK, &resp,1500)) {
+ PrintAndLog("Command execute time-out");
+ return 1;
+ }
+ PrintAndLog ("%u,%u",resp.arg[0],resp.arg[1]);
+ uint8_t isOK = resp.arg[0] & 0xff;
+ if (isOK) {
+ memcpy(data, resp.d.asBytes, resp.arg[1]);
+ } else {
+ PrintAndLog("Failed reading block: (%02x)", i);
+ return 1;
+ }