#include "printf.h"
#include "string.h"
#include "legicrf.h"
+#include "legicrfsim.h"
#include "hitag2.h"
#include "hitagS.h"
#include "lfsampling.h"
#ifdef WITH_LCD
#include "LCD.h"
#endif
+#ifdef WITH_SMARTCARD
+ #include "i2c.h"
+#endif
+
// Craig Young - 14a stand-alone code
#ifdef WITH_ISO14443a
{
BigBuf_print_status();
Fpga_print_status();
+#ifdef WITH_SMARTCARD
+ I2C_print_status();
+#endif
printConfig(); //LF Sampling config
printUSBSpeed();
Dbprintf("Various");
- Dbprintf(" MF_DBGLEVEL......%d", MF_DBGLEVEL);
- Dbprintf(" ToSendMax........%d",ToSendMax);
- Dbprintf(" ToSendBit........%d",ToSendBit);
+ Dbprintf(" MF_DBGLEVEL........%d", MF_DBGLEVEL);
+ Dbprintf(" ToSendMax..........%d", ToSendMax);
+ Dbprintf(" ToSendBit..........%d", ToSendBit);
cmd_send(CMD_ACK,1,0,0,0,0);
}
StandAloneMode();
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
- int high[OPTS], low[OPTS];
+ int tops[OPTS], high[OPTS], low[OPTS];
int selected = 0;
int playing = 0;
int cardRead = 0;
/* need this delay to prevent catching some weird data */
SpinDelay(500);
- CmdHIDdemodFSK(1, &high[selected], &low[selected], 0);
- Dbprintf("Recorded %x %x%08x", selected, high[selected], low[selected]);
+ CmdHIDdemodFSK(1, &tops[selected], &high[selected], &low[selected], 0);
+ if (tops[selected] > 0)
+ Dbprintf("Recorded %x %x%08x%08x", selected, tops[selected], high[selected], low[selected]);
+ else
+ Dbprintf("Recorded %x %x%08x", selected, high[selected], low[selected]);
LEDsoff();
LED(selected + 1, 0);
LED(LED_ORANGE, 0);
// record
- Dbprintf("Cloning %x %x%08x", selected, high[selected], low[selected]);
+ if (tops[selected] > 0)
+ Dbprintf("Cloning %x %x%08x%08x", selected, tops[selected], high[selected], low[selected]);
+ else
+ Dbprintf("Cloning %x %x%08x", selected, high[selected], low[selected]);
// wait for button to be released
while(BUTTON_PRESS())
/* need this delay to prevent catching some weird data */
SpinDelay(500);
- CopyHIDtoT55x7(0, high[selected], low[selected], 0);
- Dbprintf("Cloned %x %x%08x", selected, high[selected], low[selected]);
+ CopyHIDtoT55x7(tops[selected] & 0x000FFFFF, high[selected], low[selected], (tops[selected] != 0 && ((high[selected]& 0xFFFFFFC0) != 0)));
+ if (tops[selected] > 0)
+ Dbprintf("Cloned %x %x%08x%08x", selected, tops[selected], high[selected], low[selected]);
+ else
+ Dbprintf("Cloned %x %x%08x", selected, high[selected], low[selected]);
LEDsoff();
LED(selected + 1, 0);
// wait for button to be released
while(BUTTON_PRESS())
WDT_HIT();
- Dbprintf("%x %x%08x", selected, high[selected], low[selected]);
- CmdHIDsimTAG(high[selected], low[selected], 0);
+ if (tops[selected] > 0)
+ Dbprintf("%x %x%08x%08x", selected, tops[selected], high[selected], low[selected]);
+ else
+ Dbprintf("%x %x%08x", selected, high[selected], low[selected]);
+
+ CmdHIDsimTAG(tops[selected], high[selected], low[selected], 0);
DbpString("Done playing");
if (BUTTON_HELD(1000) > 0)
{
cmd_send(CMD_ACK,SnoopLF(),0,0,0,0);
break;
case CMD_HID_DEMOD_FSK:
- CmdHIDdemodFSK(c->arg[0], 0, 0, 1);
+ CmdHIDdemodFSK(c->arg[0], 0, 0, 0, 1);
break;
case CMD_HID_SIM_TAG:
- CmdHIDsimTAG(c->arg[0], c->arg[1], 1);
+ CmdHIDsimTAG(c->arg[0], c->arg[1], c->arg[2], 1);
break;
case CMD_FSK_SIM_TAG:
CmdFSKsimTAG(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes);
#ifdef WITH_LEGICRF
case CMD_SIMULATE_TAG_LEGIC_RF:
- LegicRfSimulate(c->arg[0], c->arg[1], c->arg[2]);
+ LegicRfSimulate(c->arg[0]);
break;
case CMD_WRITER_LEGIC_RF:
HfSnoop(c->arg[0], c->arg[1]);
break;
#endif
+#ifdef WITH_SMARTCARD
+ case CMD_SMART_ATR: {
+ SmartCardAtr();
+ break;
+ }
+ case CMD_SMART_SETCLOCK:{
+ SmartCardSetClock(c->arg[0]);
+ break;
+ }
+ case CMD_SMART_RAW: {
+ SmartCardRaw(c->arg[0], c->arg[1], c->d.asBytes);
+ break;
+ }
+ case CMD_SMART_UPLOAD: {
+ // upload file from client
+ uint8_t *mem = BigBuf_get_addr();
+ memcpy( mem + c->arg[0], c->d.asBytes, USB_CMD_DATA_SIZE);
+ cmd_send(CMD_ACK,1,0,0,0,0);
+ break;
+ }
+ case CMD_SMART_UPGRADE: {
+ SmartCardUpgrade(c->arg[0]);
+ break;
+ }
+#endif
case CMD_BUFF_CLEAR:
BigBuf_Clear();