[plug] APM, sleep, and extra keyboard buttons

Cameron Patrick cameron at patrick.wattle.id.au
Sun Aug 11 11:46:00 WST 2002


On Sun, 11 Aug 2002 09:49:24 +0800, I am the LinuxAlien wrote:

| When I put it to sleep it immediately wakes up and when i put it into 
| standby i can't wake it up.
| I just tried to put it to sleep and apm exit with the below error
| 
| APIC error on CPU0: 00(40)

Many motherboards (in fact, almost all that I've seen) have completely broken APM support. When you try to put them to suspend or sleep, they either wake up straight away or never come out again. (In a couple of Athlon motherboards, it was necessary to remove power to the machine for a few seconds and then plug it in again before it would wake up.)  This happens in both Linux and Windows.

To get a machine to power down nicely when you run shutdown, normally you have to fiddle with the APM configuration in the kernel. You might also need to have apmd running.  Here's the combination that works on my machine:

CONFIG_PM=y
# CONFIG_ACPI is not set
CONFIG_APM=y
# CONFIG_APM_IGNORE_USER_SUSPEND is not set
CONFIG_APM_DO_ENABLE=y
# CONFIG_APM_CPU_IDLE is not set
# CONFIG_APM_DISPLAY_BLANK is not set
# CONFIG_APM_RTC_IS_GMT is not set
# CONFIG_APM_ALLOW_INTS is not set
# CONFIG_APM_REAL_MODE_POWER_OFF is not set

You might need to turn REAL_MODE_POWER_OFF on. This is what Windows does.

Don't enable ACPI, in my experience it doesn't work at all under Linux. (My machine panicked on boot with ACPI compiled into the kernel.)

A BIOS upgrade /might/ help.  A BIOS upgrade /might/ leave you with a broken machine.

-------------------------------------------------------------------

| I have a power, wakeup and sleep button on my new key board ( i just
| went shopping) how do i get these to work?

It all depends on what you mean by, 'work'. (-: 

You need to tell X that they exist using xmodmap. Fire up an xterm and run xev.  Focus the xev window, and press each key that you want to get working.  It should spit out something like:

KeyPress event, serial 28, synthetic NO, window 0x2c00001,
    root 0x79, subw 0x0, time 2539066450, (380,337), root:(533,448),
    state 0x0, keycode 160 (keysym 0xffcb, F14), same_screen YES,
    XLookupString gives 0 characters:  ""

KeyRelease event, serial 28, synthetic NO, window 0x2c00001,
    root 0x79, subw 0x0, time 2539066564, (380,337), root:(533,448),
    state 0x0, keycode 160 (keysym 0xffcb, F14), same_screen YES,
    XLookupString gives 0 characters:  ""

(In this case, it's the "mail" button on my Logitech 'internet' keyboard, which I've mapped to F14.)  Note the keycode that xev tells you for each button - in that case, 160.  You need to add some stuff to the end of your /etc/X11/Xmodmap to map the keycodes that xev tells you into keys that X understands. I used extra F-keys that X supports but my keyboard doesn't have:

	(for a Logitech keyboard)
keycode 223 = F13
keycode 160 = F14
keycode 174 = F15
keycode 176 = F16
keycode 162 = F17
keycode 164 = F18
keycode 144 = F19
keycode 153 = F20
keycode 236 = F21
keycode 229 = F22
keycode 178 = F23
keycode 230 = F24
	
	(for a Microsoft keyboard)
keycode 234 = F13
keycode 233 = F14
keycode 232 = F15
keycode 236 = F16
keycode 229 = F17
keycode 230 = F18
keycode 178 = F19
keycode 235 = F20
keycode 161 = F21
keycode 223 = F22



More information about the plug mailing list