- ncount = nvectorcount[i];
- if (ncount > 5) ncount = 5; //!!!!! needs to be 2 packets x 5 pairs (nt,ks1)
-
- // isEOF = 0
- UsbCommand ack = {CMD_ACK, {0, ncount, targetBlockNo}};
- memcpy(ack.d.asBytes, &cuid, 4);
- for (m = 0; m < 5; m++) {
- memcpy(ack.d.asBytes + 4 + m * 8 + 0, &nvector[i][m].nt, 4);
- memcpy(ack.d.asBytes + 4 + m * 8 + 4, &nvector[i][m].ks1, 4);
- }
+ for (j = 0; j < nvectorcount[i]; j += 5) {
+ ncount = nvectorcount[i] - j;
+ if (ncount > 5) ncount = 5;
+
+ ack.arg[0] = 0; // isEOF = 0
+ ack.arg[1] = ncount;
+ ack.arg[2] = targetBlockNo + (targetKeyType * 0x100);
+ memset(ack.d.asBytes, 0x00, sizeof(ack.d.asBytes));
+
+ memcpy(ack.d.asBytes, &cuid, 4);
+ for (m = 0; m < ncount; m++) {
+ memcpy(ack.d.asBytes + 8 + m * 8 + 0, &nvector[i][m + j].nt, 4);
+ memcpy(ack.d.asBytes + 8 + m * 8 + 4, &nvector[i][m + j].ks1, 4);
+ }