2 * Copyright 2010-2011 Christian Lamparter <chunkeey@googlemail.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation version 2 of the License.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include <sys/types.h>
31 static void checksum_help(void)
33 fprintf(stderr, "Usage:\n");
34 fprintf(stderr, "\tchecksum FW-FILE\n");
36 fprintf(stderr, "\nDescription:\n");
37 fprintf(stderr, "\tThis simple utility adds/updates various "
40 fprintf(stderr, "\nParameteres:\n");
41 fprintf(stderr, "\t 'FW-FILE' = firmware name\n");
42 fprintf(stderr, "\n");
45 int main(int argc, char *args[])
47 struct carlfw *fw = NULL;
55 fw = carlfw_load(args[1]);
56 if (IS_ERR_OR_NULL(fw)) {
58 fprintf(stderr, "Failed to open file \"%s\" (%d).\n",
64 * No magic here, The checksum descriptor is added/update
65 * automatically in a subroutine of carlfw_store().
67 * This tools serves as a skeleton/example.
69 err = carlfw_store(fw);
71 fprintf(stderr, "Failed to apply checksum (%d).\n", err);
78 fprintf(stdout, "checksum applied.\n");
88 return err ? EXIT_FAILURE : EXIT_SUCCESS;