-int ice_legic_select_card()
-{
- //int cmd_size=0, card_size=0;
- uint8_t wakeup[] = { 0x7F };
- uint8_t getid[] = {0x19};
-
- //legic_prng_init(SESSION_IV);
-
- // first, wake up the tag, 7bits
- CodeAndTransmitLegicAsReader(wakeup, sizeof(wakeup), 7);
-
- GetSamplesForLegicDemod(1000, TRUE);
-
- //frame_receiveAsReader(¤t_frame, 6, 1);
-
- legic_prng_forward(1); /* we wait anyways */
-
- //while(timer->TC_CV < 387) ; /* ~ 258us */
- //frame_sendAsReader(0x19, 6);
- CodeAndTransmitLegicAsReader(getid, sizeof(getid), 8);
- GetSamplesForLegicDemod(1000, TRUE);
-
- //if (Demod.len < 14) return 2;
- Dbprintf("CARD TYPE: %02x LEN: %d", Demod.output[0], Demod.len);
-
- switch(Demod.output[0]) {
- case 0x1d:
- DbpString("MIM 256 card found");
- // cmd_size = 9;
- // card_size = 256;
- break;
- case 0x3d:
- DbpString("MIM 1024 card found");
- // cmd_size = 11;
- // card_size = 1024;
- break;
- default:
- return -1;
- }
-
- // if(bytes == -1)
- // bytes = card_size;
-
- // if(bytes + offset >= card_size)
- // bytes = card_size - offset;
-
- FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
- set_tracing(FALSE);
- return 1;
-}
-