X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=fwcutter%2Ffwcutter.c;h=0d828067e26cecb0e63a90d6b3bbb2bdda2fee77;hb=2cb9ee566f035acad146dc2c3c0b2de675469f02;hp=ae1c63a48c18c40416a0b3104f3a8fd54e0729ee;hpb=712f2d241d3447ebc7b97abd591afe9737ac7fa8;p=b43-tools.git diff --git a/fwcutter/fwcutter.c b/fwcutter/fwcutter.c index ae1c63a..0d82806 100644 --- a/fwcutter/fwcutter.c +++ b/fwcutter/fwcutter.c @@ -439,6 +439,8 @@ static void print_file(const struct file *file) printf("%s\t", file->ucode_version); if (strlen(file->ucode_version) < 8) printf("\t"); + printf("%s\t", file->id); + printf("%s\n", file->md5); } @@ -448,16 +450,22 @@ static void print_supported_files(void) print_banner(); printf("\nExtracting firmware is possible " - "from these binary driver files:\n\n"); + "from these binary driver files.\n" + "The column shows the unique identifier string " + "for your firmware.\nYou must select the firmware with the " + "same ID as printed by the kernel driver on modprobe.\n" + "Note that only recent drivers print such a message on modprobe.\n" + "Please read http://linuxwireless.org/en/users/Drivers/b43#devicefirmware\n\n"); printf("\t" "\t\t" "\t" + "\t" "\n\n"); /* print for legacy driver first */ - for (i = 0; i < FILES; i++) + for (i = 0; i < ARRAY_SIZE(files); i++) if (file_ok(&files[i]) && !(files[i].flags & FW_FLAG_V4)) print_file(&files[i]); - for (i = 0; i < FILES; i++) + for (i = 0; i < ARRAY_SIZE(files); i++) if (file_ok(&files[i]) && files[i].flags & FW_FLAG_V4) print_file(&files[i]); printf("\n"); @@ -483,10 +491,11 @@ static const struct file *find_file(FILE *fd) signature[8], signature[9], signature[10], signature[11], signature[12], signature[13], signature[14], signature[15]); - for (i = 0; i < FILES; ++i) { + for (i = 0; i < ARRAY_SIZE(files); i++) { if (file_ok(&files[i]) && strcasecmp(md5sig, files[i].md5) == 0) { printf("This file is recognised as:\n"); + printf(" ID : %s\n", files[i].id); printf(" filename : %s\n", files[i].name); printf(" version : %s\n", files[i].ucode_version); printf(" MD5 : %s\n", files[i].md5); @@ -503,7 +512,9 @@ static const struct file *find_file(FILE *fd) static void print_usage(int argc, char *argv[]) { print_banner(); - printf("\nUsage: %s [OPTION] [driver.sys]\n", argv[0]); + printf("\nA tool to extract firmware for a Broadcom 43xx device\n"); + printf("from a proprietary Broadcom 43xx device driver file.\n"); + printf("\nUsage: %s [OPTION] [proprietary-driver-file]\n", argv[0]); printf(" --unsupported " "Allow working on extractable but unsupported drivers\n"); printf(" -l|--list " @@ -516,8 +527,9 @@ static void print_usage(int argc, char *argv[]) "Print b43-fwcutter version\n"); printf(" -h|--help " "Print this help\n"); - printf("\nExample: %s bcmwl5.sys\n" - " to extract the firmware blobs from bcmwl5.sys\n", + printf("\nExample: %s -w /lib/firmware wl_apsta.o\n" + " to extract the firmware blobs from wl_apsta.o and store\n" + " the resulting firmware in /lib/firmware\n", argv[0]); } @@ -553,7 +565,7 @@ static int do_cmp_arg(char **argv, int *pos, if (param) { /* Skip the parameter on the next iteration. */ (*pos)++; - if (*param == 0) { + if (!*param) { printf("%s needs a parameter\n", arg); return ARG_ERROR; } @@ -591,34 +603,34 @@ static int parse_args(int argc, char *argv[]) if (argc < 2) goto out_usage; for (i = 1; i < argc; i++) { - res = cmp_arg(argv, &i, "--list", "-l", 0); + res = cmp_arg(argv, &i, "--list", "-l", NULL); if (res == ARG_MATCH) { cmdargs.mode = FWCM_LIST; continue; } else if (res == ARG_ERROR) goto out; - res = cmp_arg(argv, &i, "--version", "-v", 0); + res = cmp_arg(argv, &i, "--version", "-v", NULL); if (res == ARG_MATCH) { print_banner(); return 1; } else if (res == ARG_ERROR) goto out; - res = cmp_arg(argv, &i, "--help", "-h", 0); + res = cmp_arg(argv, &i, "--help", "-h", NULL); if (res == ARG_MATCH) goto out_usage; else if (res == ARG_ERROR) goto out; - res = cmp_arg(argv, &i, "--identify", "-i", 0); + res = cmp_arg(argv, &i, "--identify", "-i", NULL); if (res == ARG_MATCH) { cmdargs.mode = FWCM_IDENTIFY; continue; } else if (res == ARG_ERROR) goto out; - res = cmp_arg(argv, &i, "--unsupported", NULL, 0); + res = cmp_arg(argv, &i, "--unsupported", NULL, NULL); if (res == ARG_MATCH) { cmdargs.unsupported = 1; continue;