2 * This file is part of the ectool project.
4 * Copyright (C) 2008-2009 coresystems GmbH
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 #define ECTOOL_VERSION "0.1"
30 void print_version(void)
32 printf("ectool v%s -- ", ECTOOL_VERSION);
33 printf("Copyright (C) 2008-2009 coresystems GmbH\n\n");
35 "This program is free software: you can redistribute it and/or modify\n"
36 "it under the terms of the GNU General Public License as published by\n"
37 "the Free Software Foundation, version 2 of the License.\n\n"
38 "This program is distributed in the hope that it will be useful,\n"
39 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
40 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
41 "GNU General Public License for more details.\n\n"
42 "You should have received a copy of the GNU General Public License\n"
43 "along with this program. If not, see <http://www.gnu.org/licenses/>.\n\n");
46 void print_usage(const char *name)
48 printf("usage: %s [-vh?Vi]\n", name);
50 " -v | --version: print the version\n"
51 " -h | --help: print this help\n\n"
52 " -V | --verbose: print debug information\n"
53 " -i | --idx: print IDX RAM\n"
58 int verbose = 0, dump_idx = 0;
60 int main(int argc, char *argv[])
62 int i, opt, option_index = 0;
64 static struct option long_options[] = {
65 {"version", 0, 0, 'v'},
67 {"verbose", 0, 0, 'V'},
72 while ((opt = getopt_long(argc, argv, "vh?Vi",
73 long_options, &option_index)) != EOF) {
95 printf("You need to be root.\n");
100 for (i = 0; i < 0x100; i++) {
102 printf("\n%02x: ", i);
103 printf("%02x ", ec_read(i));
108 printf("EC IDX RAM:\n");
109 for (i = 0; i < 0x10000; i++) {
111 printf("\n%04x: ", i);
112 printf("%02x ", ec_idx_read(i));
116 printf("Not dumping EC IDX RAM.\n");