Skip to content

Commit 20d795c

Browse files
committed
depinfo: Add option to show missing firmware
Signed-off-by: Alexey Gladkov <[email protected]>
1 parent cc260b1 commit 20d795c

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

utils/depinfo/kmod-depinfo.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ enum alias_need {
2727
};
2828

2929
enum show_flags {
30-
SHOW_DEPS = (1 << 1),
31-
SHOW_MODULES = (1 << 2),
32-
SHOW_FIRMWARE = (1 << 3),
33-
SHOW_PREFIX = (1 << 4),
34-
SHOW_BUILTIN = (1 << 5),
30+
SHOW_DEPS = (1 << 1),
31+
SHOW_MODULES = (1 << 2),
32+
SHOW_FIRMWARE = (1 << 3),
33+
SHOW_PREFIX = (1 << 4),
34+
SHOW_BUILTIN = (1 << 5),
35+
SHOW_MISSING_FIRMWARE = (1 << 6),
3536
};
3637

3738
static int show_tree = 0;
@@ -364,6 +365,9 @@ process_firmware(const char *firmware)
364365
break;
365366
begin = end + 1;
366367
}
368+
369+
if (opts & SHOW_MISSING_FIRMWARE && !found)
370+
show_with_prefix(show_tree, "missing-firmware", firmware);
367371
}
368372

369373
static int
@@ -385,7 +389,6 @@ __process_depends(struct kmod_ctx *ctx, const char *depends, const char *delim,
385389
return ret;
386390
}
387391

388-
389392
static int
390393
process_depends(struct kmod_ctx *ctx, const char *depends)
391394
{
@@ -653,6 +656,7 @@ read_names(struct kmod_ctx *ctx, const char *file)
653656
static const char cmdopts_s[] = "k:b:f:i:tDMFPBVh";
654657
static const struct option cmdopts[] = {
655658
{ "use-blacklist", no_argument, 0, 1, },
659+
{ "missing-firmware", no_argument, 0, 2 },
656660
{ "tree", no_argument, 0, 't' },
657661
{ "no-deps", no_argument, 0, 'D' },
658662
{ "no-modules", no_argument, 0, 'M' },
@@ -687,7 +691,8 @@ print_help(const char *progname)
687691
" -b, --base-dir=DIR Use DIR as filesystem root for /lib/modules;\n"
688692
" -f, --firmware-dir=DIR Use DIR as colon-separated list of firmware directories\n"
689693
" (default: %s);\n"
690-
" --use-blacklist Apply blacklist commands in the configuration files.\n"
694+
" --use-blacklist Apply blacklist commands in the configuration files;\n"
695+
" --missing-firmware Show firmware that could not be found;\n"
691696
" -i, --input=FILE Read names from FILE;\n"
692697
" -V, --version Show version of program and exit;\n"
693698
" -h, --help Show this text and exit.\n"
@@ -725,6 +730,9 @@ main(int argc, char **argv)
725730
case 1:
726731
use_blacklist = 1;
727732
break;
733+
case 2:
734+
opts |= SHOW_MISSING_FIRMWARE;
735+
break;
728736
case 'D':
729737
opts ^= SHOW_DEPS;
730738
break;

0 commit comments

Comments
 (0)