static void CmdEM410xsim(char *str)\r
{\r
int i, n, j, h, binary[4], parity[4];\r
- char *s = "0";\r
\r
/* clock is 64 in EM410x tags */\r
int clock = 64;\r
}\r
\r
/* modulate that biatch */\r
- Cmdmanchestermod(s);\r
+ Cmdmanchestermod("");\r
\r
/* booyah! */\r
RepaintGraphWindow();\r
+ \r
+ CmdLosim("");\r
+}\r
+\r
+/* simulate an LF Manchester encoded tag with specified bitstream, clock rate and inter-id gap */\r
+static void CmdLosimManchester(char *str)\r
+{\r
+ static int clock, gap;\r
+ static char data[1024], gapstring[8];\r
+ int i;\r
\r
- CmdLosim(s);\r
+ /* get settings/bits */\r
+ sscanf(str, "%i %s %i", &clock, &data[0], &gap);\r
+\r
+ /* clear our graph */\r
+ CmdClearGraph(0);\r
+\r
+ /* fill it with our bitstream */\r
+ for (i= 0; i < strlen(data) ; ++i)\r
+ CmdAppendGraph(0, clock, data[i]- '0');\r
+\r
+ /* modulate */\r
+ Cmdmanchestermod("");\r
+\r
+ /* show what we've done */\r
+ RepaintGraphWindow();\r
+\r
+ /* simulate */\r
+ sprintf(&gapstring[0], "%i", gap);\r
+ CmdLosim(gapstring);\r
}\r
\r
static void ChkBitstream(char *str)\r
static void CmdLosim(char *str)\r
{\r
int i;\r
+ static int gap;\r
+\r
+ sscanf(str,"%i",&gap);\r
\r
/* convert to bitstream if necessary */\r
ChkBitstream(str);\r
SendCommand(&c);\r
}\r
\r
- UsbCommand c={CMD_SIMULATE_TAG_125K, {GraphTraceLen, 0, 0}};\r
+ UsbCommand c={CMD_SIMULATE_TAG_125K, {GraphTraceLen, gap, 0}};\r
SendCommand(&c);\r
}\r
\r
{"hi15sim", CmdHi15tag, 0, "Fake an ISO15693 tag"},\r
{"hidsimtag", CmdHIDsimTAG, 0, "<ID> -- HID tag simulator"},\r
{"hisimlisten", CmdHisimlisten, 0, "Get HF samples as fake tag"},\r
- {"losim", CmdLosim, 0, "Simulate LF tag"},\r
+ {"losim", CmdLosim, 0, "[GAP] -- Simulate LF tag from buffer with optional GAP (in microseconds)"},\r
+ {"losimman", CmdLosimManchester, 0, "<Clock> <Bitstream> [GAP] Simulate arbitrary Manchester LF tag"},\r
{"losimbidir", CmdLosimBidir, 0, "Simulate LF tag (with bidirectional data transmission between reader and tag)"},\r
\r
/* card reading functions */\r
void CommandReceived(char *cmd)\r
{\r
int i;\r
- char line[256];\r
+ char line[512];\r
\r
PrintToScrollback("> %s", cmd);\r
\r