if (transferToEml) {\r
uint8_t sectortrailer;\r
if (trgBlockNo < 32*4) { // 4 block sector\r
- sectortrailer = (trgBlockNo & 0x03) + 3;\r
+ sectortrailer = trgBlockNo | 0x03;\r
} else { // 16 block sector\r
- sectortrailer = (trgBlockNo & 0x0f) + 15;\r
+ sectortrailer = trgBlockNo | 0x0f;\r
}\r
mfEmlGetMem(keyBlock, sectortrailer, 1);\r
\r
}\r
\r
// 1 - blocks count\r
- UsbCommand c = {CMD_MIFARE_EML_MEMSET, {blockNo, 1, 0}};\r
- memcpy(c.d.asBytes, memBlock, 16);\r
- SendCommand(&c);\r
- return 0;\r
+ return mfEmlSetMem(memBlock, blockNo, 1);\r
}\r
\r
\r
default: numSectors = 16;\r
}\r
\r
- printf("--params: numSectors: %d, keyType:%d", numSectors, keyType);\r
+ printf("--params: numSectors: %d, keyType:%d\n", numSectors, keyType);\r
UsbCommand c = {CMD_MIFARE_EML_CARDLOAD, {numSectors, keyType, 0}};\r
SendCommand(&c);\r
return 0;\r