Subject: enabling the APM_IOC_DEV_CTL ioctl
To: None <port-i386@netbsd.org>
From: Simon Burge <simonb@wasabisystems.com>
List: port-i386
Date: 10/23/2000 02:20:38
Is there any reason not to enable APM_IOC_DEV_CTL?  The code is there,
but "#if 0"d out.

I leave my laptop on most of the time (it's the fastest PC I own), and
it's bugged me that the LCD screen is on all the time (I don't suspect
these things `burn in', but it still bugs me).  Poking around in the
APM stuff showed that if I called APM_IOC_DEV_CTL with a device of
APM_DEV_DISPLAY(0) and a mode of APM_SYS_READY or APM_SYS_STANDBY I can
happily turn the LCD screen off or on.

The next step would be to get wscons to do some blanking, but one step
at a time...  (Didn't pcvt have some sort of screen blanking?)

Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD Sales, Support and Service:  http://www.wasabisystems.com/
Index: apm.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/i386/i386/apm.c,v
retrieving revision 1.53
diff -d -p -u -r1.53 apm.c
--- apm.c	2000/08/13 22:26:27	1.53
+++ apm.c	2000/10/22 14:57:47
@@ -146,9 +146,7 @@ static void	apm_disconnect __P((void *))
 static void	apm_event_handle __P((struct apm_softc *, struct bioscallregs *));
 static int	apm_get_event __P((struct bioscallregs *));
 static int	apm_get_powstat __P((struct bioscallregs *));
-#if 0
 static void	apm_get_powstate __P((u_int));
-#endif
 static void	apm_periodic_check __P((struct apm_softc *));
 static void	apm_create_thread __P((void *));
 static void	apm_thread __P((void *));
@@ -369,7 +367,6 @@ apm_power_print(sc, regs)
 }
 #endif
 
-#if 0 /* currently unused */
 static void
 apm_get_powstate(dev)
 	u_int dev;
@@ -383,7 +380,6 @@ apm_get_powstate(dev)
 		printf("apm dev %04x state %04x\n", dev, regs.CX);
 	}
 }
-#endif
 
 static void
 apm_suspend(sc)
@@ -1482,9 +1482,7 @@ apmioctl(dev, cmd, data, flag, p)
 	struct apm_power_info *powerp;
 	struct apm_event_info *evp;
 	struct bioscallregs regs;
-#if 0
 	struct apm_ctl *actl;
-#endif
 	int i, error = 0;
 
 	APM_LOCK(sc);
@@ -1510,7 +1508,6 @@ apmioctl(dev, cmd, data, flag, p)
 		apm_suspends++;
 		break;
 
-#if 0 /* is this used at all? */
 	case APM_IOC_DEV_CTL:
 		actl = (struct apm_ctl *)data;
 		if ((flag & FWRITE) == 0) {
@@ -1520,7 +1517,6 @@ apmioctl(dev, cmd, data, flag, p)
 		apm_get_powstate(actl->dev); /* XXX */
 		error = apm_set_powstate(actl->dev, actl->mode);
 		break;
-#endif
 
 	case APM_IOC_NEXTEVENT:
 		if (!sc->event_count)