]>
Commit | Line | Data |
---|---|---|
1 | #include <stdio.h> | |
2 | #include <string.h> | |
3 | #include "proxusb.h" | |
4 | #include "cmdparser.h" | |
5 | #include "cmdhflegic.h" | |
6 | ||
7 | static int CmdHelp(const char *Cmd); | |
8 | ||
9 | int CmdLegicRFRead(const char *Cmd) | |
10 | { | |
11 | int byte_count=0,offset=0; | |
12 | sscanf(Cmd, "%i %i", &offset, &byte_count); | |
13 | if(byte_count == 0) byte_count = 256; | |
14 | if(byte_count + offset > 256) byte_count = 256 - offset; | |
15 | UsbCommand c={CMD_READER_LEGIC_RF, {offset, byte_count, 0}}; | |
16 | SendCommand(&c); | |
17 | return 0; | |
18 | } | |
19 | ||
20 | static command_t CommandTable[] = | |
21 | { | |
22 | {"help", CmdHelp, 1, "This help"}, | |
23 | {"reader", CmdLegicRFRead, 0, "[offset [length]] -- read bytes from a LEGIC card"}, | |
24 | {NULL, NULL, 0, NULL} | |
25 | }; | |
26 | ||
27 | int CmdHFLegic(const char *Cmd) | |
28 | { | |
29 | CmdsParse(CommandTable, Cmd); | |
30 | return 0; | |
31 | } | |
32 | ||
33 | int CmdHelp(const char *Cmd) | |
34 | { | |
35 | CmdsHelp(CommandTable); | |
36 | return 0; | |
37 | } |