diff options
Diffstat (limited to 'commands/drvinfo.c')
-rw-r--r-- | commands/drvinfo.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/commands/drvinfo.c b/commands/drvinfo.c index 4a4b957537..e13b04870e 100644 --- a/commands/drvinfo.c +++ b/commands/drvinfo.c @@ -1,31 +1,25 @@ -/* - * Copyright (C) 2013 Sascha Hauer, Pengutronix - * Copyright (C) 2014 Holger Schurig - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ +// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: © 2013 Sascha Hauer, Pengutronix +// SPDX-FileCopyrightText: © 2014 Holger Schurig #include <common.h> #include <command.h> #include <driver.h> +#include <complete.h> +#include <fnmatch.h> static int do_drvinfo(int argc, char *argv[]) { - struct driver_d *drv; - struct device_d *dev; + char *pattern = argv[1]; + struct driver *drv; + struct device *dev; printf("Driver\tDevice(s)\n"); printf("--------------------\n"); for_each_driver(drv) { + if (pattern && fnmatch(pattern, drv->name, 0)) + continue; + printf("%s\n",drv->name); for_each_device(dev) { if (dev->driver == drv) @@ -43,5 +37,7 @@ static int do_drvinfo(int argc, char *argv[]) BAREBOX_CMD_START(drvinfo) .cmd = do_drvinfo, BAREBOX_CMD_DESC("list compiled-in device drivers") + BAREBOX_CMD_OPTS("[DRIVER]") BAREBOX_CMD_GROUP(CMD_GRP_INFO) + BAREBOX_CMD_COMPLETE(driver_complete) BAREBOX_CMD_END |