Handle -b/-u after default display device is added, otherwise

change_state() is called while ds_list is still empty (unless a
display device was specificed with -f).

This makes -b/-u actually work.
This commit is contained in:
uwe 2006-09-24 01:57:03 +00:00
parent a6a54c10d8
commit d2af0aadf3

View File

@ -1,4 +1,4 @@
/* $NetBSD: screenblank.c,v 1.25 2006/09/23 20:26:25 wiz Exp $ */ /* $NetBSD: screenblank.c,v 1.26 2006/09/24 01:57:03 uwe Exp $ */
/*- /*-
* Copyright (c) 1996-2002 The NetBSD Foundation, Inc. * Copyright (c) 1996-2002 The NetBSD Foundation, Inc.
@ -45,7 +45,7 @@
__COPYRIGHT( __COPYRIGHT(
"@(#) Copyright (c) 1996-2002 \ "@(#) Copyright (c) 1996-2002 \
The NetBSD Foundation, Inc. All rights reserved."); The NetBSD Foundation, Inc. All rights reserved.");
__RCSID("$NetBSD: screenblank.c,v 1.25 2006/09/23 20:26:25 wiz Exp $"); __RCSID("$NetBSD: screenblank.c,v 1.26 2006/09/24 01:57:03 uwe Exp $");
#endif #endif
#include <sys/types.h> #include <sys/types.h>
@ -201,24 +201,28 @@ main(int argc, char *argv[])
#endif #endif
/* /*
* Handle -b and -u modes. * Add the default framebuffer device if necessary.
* We _always_ check the console device.
*/
add_dev(_PATH_CONSOLE, 0);
if (!fflag)
add_dev(display, 1);
/*
* If this is an one-off blank/unblank request, handle it now.
* We don't need to open keyboard/mouse device for that.
*/ */
if (bflag || uflag) { if (bflag || uflag) {
change_state(bflag ? videooff : videoon); change_state(bflag ? videooff : videoon);
exit(0); exit(0);
} }
/*
* Add the keyboard, mouse, and default framebuffer devices /* Add the keyboard and mouse devices as necessary. */
* as necessary. We _always_ check the console device.
*/
add_dev(_PATH_CONSOLE, 0);
if (!kflag) if (!kflag)
add_dev(kbd, 0); add_dev(kbd, 0);
if (!mflag) if (!mflag)
add_dev(mouse, 0); add_dev(mouse, 0);
if (!fflag)
add_dev(display, 1);
/* Ensure that the framebuffer is on. */ /* Ensure that the framebuffer is on. */
state = videoon; state = videoon;