[PATCH 3/3] GUI: Add fbtest command

Sascha Hauer s.hauer at pengutronix.de
Wed Jun 22 23:22:37 PDT 2016


On Tue, Jun 21, 2016 at 09:39:29PM -0700, Andrey Smirnov wrote:
> Add 'fbtest' - a command to produce test patterns on a screen
> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov at gmail.com>
> Signed-off-by: Andrey Gusakov <andrey.gusakov at cogentembedded.com>
> ---
>  commands/Kconfig  |   9 +++
>  commands/Makefile |   1 +
>  commands/fbtest.c | 187 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 197 insertions(+)
>  create mode 100644 commands/fbtest.c
> 
> diff --git a/commands/Kconfig b/commands/Kconfig
> index 880cd45..107cc3e 100644
> --- a/commands/Kconfig
> +++ b/commands/Kconfig
> @@ -1417,6 +1417,15 @@ config CMD_SPLASH
>  		  -b COLOR	background color in 0xttrrggbb
>  		  -o		render offscreen
>  

> +
> +static int do_fbtest(int argc, char *argv[])
> +{
> +	struct screen *sc;
> +	int opt, i;
> +	const char *pattern_name = NULL;
> +	char *fbdev = "/dev/fb0";
> +	void (*pattern) (struct screen *sc, u32 color) = NULL;
> +	u32 color = 0xffffff;
> +
> +	struct {
> +		const char *name;
> +		void (*func) (struct screen *sc, u32 color);
> +	} patterns[] = {
> +		{ "geometry", fbtest_pattern_geometry },
> +		{ "bars",     fbtest_pattern_bars     }
> +	};
> +
> +	while((opt = getopt(argc, argv, "d:p:c:")) > 0) {
> +		switch(opt) {
> +		case 'd':
> +			fbdev = optarg;
> +			break;
> +		case 'p':
> +			pattern_name = optarg;
> +			break;
> +		case 'c':
> +			color = simple_strtoul(optarg, NULL, 16);
> +			break;
> +		}
> +	}
> +
> +	if (!pattern_name) {
> +		printf("No pattern name specified\n");
> +		return -EINVAL;
> +	}

Maybe we can iterate over the patterns if no pattern is given like the
Linux variant does?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list