I noticed a mention of the lid switch on boot, and dmegs had this to say:
Code: Select all
ACPI: Lid Switch [LID]Any Ideas?
Thank you
Code: Select all
ACPI: Lid Switch [LID]

Code: Select all
#!/bin/sh
set $*
group=${1/\/*/}
action=${1/*\//}
case "$group" in
button)
case "$action" in
power) ACTION
;;
sleep) ACTION
;;
lid) ACTION
;;
*) logger "ACPI group button / action $action is not defined"
;;
esac
;;
battery)
case "$action" in
battery) ACTION
;;
*) logger "ACPI group battery / action $action is not defined"
;;
esac
;;
ac_adapter)
case "$action" in
ac_adapter) ACTION
;;
*) logger "ACPI group ac_adapter / action $action is not defined"
;;
esac
;;
*)
logger "ACPI group $group / action $action is not defined"
;;
esac
Code: Select all
setterm -powersave powerdownCode: Select all
cannot (un)set powersave mode
Code: Select all
xset dpms force off
Code: Select all
Option "DPMS" "true"Code: Select all
Option "DPMS" "true"Code: Select all
case "$action" in
power) /sbin/init 0
;;
lid) /usr/X11R6/bin/xset dpms force off
;;
*) logger "ACPI action $action is not defined"
;;
esac

That explains a lotAll those acpid scripts you can throw out the window, acpid is dependant on /proc/acpi/events working
Code: Select all
xset dpms force offCode: Select all
xset dpms 10 10 10
Code: Select all
Keyboard Control:
auto repeat: on key click percent: 0 LED mask: 00000000
auto repeat delay: 660 repeat rate: 25
auto repeating keys: 00ffffffdffffbbf
fadfffffffdffdff
ffffffffffffffff
ffffffffffffffff
bell percent: 50 bell pitch: 400 bell duration: 100
Pointer Control:
acceleration: 2/1 threshold: 4
Screen Saver:
prefer blanking: yes allow exposures: yes
timeout: 0 cycle: 0
Colors:
default colormap: 0x20 BlackPixel: 0 WhitePixel: 16777215
Font Path:
/usr/X11R6/lib/X11/fonts/local/,/usr/X11R6/lib/X11/fonts/misc/,/usr/X11R6/lib/X11/fonts/75dpi/:unscaled,/usr/X11R6/lib/X11/fonts/100dpi/:unscaled,/usr/X11R6/lib/X11/fonts/Speedo/,/usr/X11R6/lib/X11/fonts/Type1/,/usr/X11R6/lib/X11/fonts/75dpi/,/usr/X11R6/lib/X11/fonts/100dpi/
Bug Mode: compatibility mode is disabled
DPMS (Energy Star):
Standby: 7200 Suspend: 7200 Off: 14400
DPMS is Enabled
Monitor is On
Font cache:
hi-mark (KB): 5120 low-mark (KB): 3840 balance (%): 70
File paths:
Config file: /etc/X11/XF86Config
Modules path: /usr/X11R6/lib/modules
Log file: /var/log/XFree86.0.lognot entirely true. I have a dell inspiron 5100 and I know that the lids states are changed in the file. It might be because your bios isn't a newer one. I had to upgrade mine to at least a23 to get acpi to work. However I have not been able to get the screen to turn off when shutting the lid but that is most likely due to some error on my part.Dell Inspiron 1100 and 5100 series laptops' BIOS does not work with the Linux ACPI implementation currently, the biggest problem is the /proc/acpi/events does not generate any events (from what I can see) ever. I have had both an 1100 and a 5100 and neither will do this. You can get the status of everything from /proc/acpi/[device] but no realtime event generation.
DPMS in X will blank the screen and or power down the backlight also when you have DPMS on. If it is not turning off the backlight it probably isn't actually DPMS doing it. Mess with the xset dpms command sometime. I put an xset dpms 300 300 300 in my flux rc file to turn off the screen totally after 5 minutes and it works. All those acpid scripts you can throw out the window, acpid is dependant on /proc/acpi/events working


Yes, sigh, I knew that, my point is that the /proc/acpi/event interface does not work and you will not get realtime events. If you want to do anything with the status of the lid, you would have to have a daemon poll the lid state file. I never said this didn't work.not entirely true. I have a dell inspiron 5100 and I know that the lids states are changed in the file. It might be because your bios isn't a newer one. I had to upgrade mine to at least a23 to get acpi to work. However I have not been able to get the screen to turn off when shutting the lid but that is most likely due to some error on my part.
Code: Select all
/*
Change the dpms mode of your graphics controller.
Version: 0.1
Date: 12.06.2004
This program is derived from the public domain
code of 'vbetest.c' from the 'lrmi' package
available at http://sourceforge.net/projects/lrmi
and is also in the public domain.
Furthermore, this program comes with no warranty for
fitness for any purpose whatsoever and if it reduces
your computer to a smoldering heap I shall not be
held responsible.
To build it, you'll need said lrmi package.
I used version 0.8, the environment is Linux,
the machine is a Dell 510m laptop with Intel's
82852/855GM graphics bloody controller.
Andreas Eckstein, 2004
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
#if defined(__linux__)
#include <sys/io.h>
#include <sys/kd.h>
#include <sys/stat.h>
#elif defined(__NetBSD__)
#include <time.h>
#include <dev/wscons/wsconsio.h>
#include <machine/sysarch.h>
#elif defined(__FreeBSD__)
#include <machine/console.h>
#include <machine/sysarch.h>
#endif
#include <lrmi.h>
#include <vbe.h>
#define DPMS_ON ((unsigned int)0x00000000)
#define DPMS_STANDBY ((unsigned int)0x00000100)
#define DPMS_SUSPEND ((unsigned int)0x00000200)
#define DPMS_OFF ((unsigned int)0x00000400)
#define VESA_DPMS ((unsigned int)0x00004F10)
#define DPMS_SET_MODE ((unsigned int)0x00000001)
#define DPMS_GET_MODE ((unsigned int)0x00000002)
#define MASK_LBYTE ((unsigned int)0x000000FF)
#define MASK_HBYTE ((unsigned int)0x0000FF00)
struct {
struct vbe_info_block *info;
struct vbe_mode_info_block *mode;
char *win; /* this doesn't point directly at the window, see update_window() */
int win_low, win_high;
} vbe;
void
usage_and_quit(int error)
{
fputs("Usage: dpmsctl {on|standby|suspend|off|status}\n",
error ? stderr : stdout);
exit(error);
}
int
main(int argc, char *argv[])
{
int retval=0;
struct LRMI_regs r;
#if defined(__NetBSD__)
unsigned long iomap[32];
#endif
unsigned int dpms_mode=-1;
unsigned int dpms_action=DPMS_SET_MODE;
if(argc>1) {
if (strcmp(argv[1], "on") == 0) {
dpms_mode=DPMS_ON;
} else if (strcmp(argv[1], "standby") == 0) {
dpms_mode=DPMS_STANDBY;
} else if (strcmp(argv[1], "suspend") == 0) {
dpms_mode=DPMS_SUSPEND;
} else if (strcmp(argv[1], "off") == 0) {
dpms_mode=DPMS_OFF;
} else if (strcmp(argv[1], "status") == 0) {
dpms_action=DPMS_GET_MODE;
dpms_mode=0;
} else {
usage_and_quit(1);
}
}
if(dpms_mode==-1)
usage_and_quit(1);
//printf("dpms_mode: %d\n", dpms_mode);
if (!LRMI_init()){
fprintf(stderr, "Can't initialize LRMI environment\n");
return 1;
}
vbe.info = LRMI_alloc_real(sizeof(struct vbe_info_block)
+ sizeof(struct vbe_mode_info_block));
if (vbe.info == NULL) {
fprintf(stderr, "Can't alloc real mode memory\n");
return 1;
}
vbe.mode = (struct vbe_mode_info_block *)(vbe.info + 1);
#if 0
/*
Allow read/write to video IO ports
*/
ioperm(0x2b0, 0x2df - 0x2b0, 1);
ioperm(0x3b0, 0x3df - 0x3b0, 1);
#else
/*
Allow read/write to ALL io ports
*/
#if defined(__linux__)
ioperm(0, 1024, 1);
iopl(3);
#elif defined(__NetBSD__)
memset(&iomap[0], 0xff, sizeof(iomap));
i386_set_ioperm(iomap);
i386_iopl(3);
#elif defined(__FreeBSD__)
i386_set_ioperm(0, 0x10000, 1);
#endif
#endif
memset(&r, 0, sizeof(r));
r.eax = 0x4f00;
r.es = (unsigned int)vbe.info >> 4;
r.edi = 0;
memcpy(vbe.info->vbe_signature, "VBE2", 4);
if (!LRMI_int(0x10, &r)) {
fprintf(stderr, "Can't get VESA info (vm86 failure)\n");
return 1;
}
if ((r.eax & 0xffff) != 0x4f || strncmp(vbe.info->vbe_signature, "VESA", 4) != 0) {
fprintf(stderr, "No VESA bios\n");
return 1;
}
r.eax=VESA_DPMS;
r.ebx= dpms_action | dpms_mode;
LRMI_int(0x10, &r);
if(dpms_action==DPMS_SET_MODE)
{
}
if(dpms_action==DPMS_GET_MODE)
{
dpms_mode = (r.ebx & MASK_HBYTE);
printf("active dpms mode: ");
switch(dpms_mode)
{
case DPMS_ON:
printf("on\n");
break;
case DPMS_STANDBY:
printf("standby\n");
break;
case DPMS_SUSPEND:
printf("suspend\n");
break;
case DPMS_OFF:
printf("off\n");
break;
default:
printf("error: received non VESA-compliant DPMS state\n");
printf("but if you can read this, DPMS state should be 'on'\n");
retval = 1;
}
}
int dpms_return = (r.eax & MASK_HBYTE) >> 8;
if(dpms_return!=0)
printf("error code: %d\n", dpms_return);
LRMI_free_real(vbe.info);
return retval;
}Code: Select all
gcc -o dpmsctl dpmsctl.c -llrmi