]> git.zerfleddert.de Git - proxmark3-svn/blob - client/cmdhfdes.c
FIX: minor variable fixes when compiling on linux.
[proxmark3-svn] / client / cmdhfdes.c
1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2012 nuit
3 //
4 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
5 // at your option, any later version. See the LICENSE.txt file for the text of
6 // the license.
7 //-----------------------------------------------------------------------------
8 // High frequency MIFARE DESfire commands
9 //-----------------------------------------------------------------------------
10
11 #include "cmdhfdes.h"
12 #include "proxmark3.h"
13 #include "cmdmain.h"
14
15 static int CmdHelp(const char *Cmd);
16
17 int CmdHFDESReader(const char *Cmd)
18 {
19 UsbCommand c ={CMD_MIFARE_DES_READER, {3, 0x60, 0}};
20 SendCommand(&c);
21
22 UsbCommand resp;
23 WaitForResponseTimeout(CMD_ACK,&resp,2000);
24 return 0;
25 }
26
27 int CmdHFDESDbg(const char *Cmd)
28 {
29 int dbgMode = param_get32ex(Cmd, 0, 0, 10);
30 if (dbgMode > 4) {
31 PrintAndLog("Max debud mode parameter is 4 \n");
32 }
33
34 if (strlen(Cmd) < 1 || !param_getchar(Cmd, 0) || dbgMode > 4) {
35 PrintAndLog("Usage: hf des dbg <debug level>");
36 PrintAndLog(" 0 - no debug messages");
37 PrintAndLog(" 1 - error messages");
38 PrintAndLog(" 2 - all messages");
39 PrintAndLog(" 4 - extended debug mode");
40 return 0;
41 }
42
43 UsbCommand c = {CMD_MIFARE_SET_DBGMODE, {dbgMode, 0, 0}};
44 SendCommand(&c);
45
46 return 0;
47 }
48
49 static command_t CommandTable[] =
50 {
51 {"help", CmdHelp, 1, "This help"},
52 {"dbg", CmdHFDESDbg, 0, "Set default debug mode"},
53 {"reader", CmdHFDESReader, 0, "Reader"},
54 {NULL, NULL, 0, NULL}
55 };
56
57 int CmdHFDES(const char *Cmd)
58 {
59 //flush
60 WaitForResponseTimeout(CMD_ACK,NULL,100);
61 CmdsParse(CommandTable, Cmd);
62 return 0;
63 }
64
65 int CmdHelp(const char *Cmd)
66 {
67 CmdsHelp(CommandTable);
68 return 0;
69 }
Impressum, Datenschutz