# power management guide problem

## senzacionale

```

Dont forget to run chmod +x /etc/acpi/actions/pmg_switch_runlevel.sh to make the script executable. The last thing that needs to be done is calling the script whenever the power source changes. That's done by catching ACPI events with the help of acpid. First you need to know which events are generated when the power source changes. The events are called ac_adapter and battery on most laptops, but it might be different on yours.

Code Listing 2.6: Determining ACPI events for changing the power source

# tail -f /var/log/acpid | grep "received event"

Run the command above and pull the power cable. You should see something like this:

Code Listing 2.7: Sample output for power source changes

[Tue Sep 20 17:39:06 2005] received event "ac_adapter AC 00000080 00000000"

[Tue Sep 20 17:39:06 2005] received event "battery BAT0 00000080 00000001"

The interesting part is the quoted string after received event. It will be matched by the event line in the files you are going to create below. Don't worry if your system generates multiple events or always the same. As long as any event is generated, runlevel changing will work. 

```

and i try

```

tail -f /var/log/acpid | grep "ac_adapter"

and

tail -f /var/log/acpid | grep "battery"

```

and i unplugged power cable but i don't get anything? Why? I have everything compiled into kernel waht i need.

----------

## senzacionale

anyone has any idea about this?

----------

## s0lar

tail -f /var/log/acpid | grep "ac_adapter" 

and 

tail -f /var/log/acpid | grep "battery" NOT CORRECT!!!! 

use tail -f /var/log/acpid | grep "received event" and then check the messages after lugging in or out your adapter.

----------

## senzacionale

nothing, no message!

----------

## Earthwings

Make sure required modules are either loaded or compiled into the kernel. 

```
modprobe battery

modprobe ac
```

Missing events may also be caused by a broken DSDT. Look at the output of dmesg and see if there are errors reported.

----------

## senzacionale

i have battery and ac compiled in to kernel and not as module so i can't use modprobe.

This is my dmesg

```

dmesg

Linux version 2.6.14-gentoo-r2 (root@mitjab) (gcc version 3.3.6 (Gentoo 3.3.6, ssp-3.3.6-1.0, pie-8.7.8)) #8 SMP PREEMPT Mon Dec 5 09:34:48 GMT 2005

BIOS-provided physical RAM map:

 BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)

 BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)

 BIOS-e820: 00000000000e0000 - 0000000000100000 (reserved)

 BIOS-e820: 0000000000100000 - 000000001ffd0000 (usable)

 BIOS-e820: 000000001ffd0000 - 000000001ffdf000 (ACPI data)

 BIOS-e820: 000000001ffdf000 - 0000000020000000 (ACPI NVS)

511MB LOWMEM available.

On node 0 totalpages: 131024

  DMA zone: 4096 pages, LIFO batch:1

  Normal zone: 126928 pages, LIFO batch:31

  HighMem zone: 0 pages, LIFO batch:1

DMI 2.3 present.

ACPI: RSDP (v000 ACPIAM                                ) @ 0x000f58e0

ACPI: RSDT (v001 A M I  OEMRSDT  0x06000428 MSFT 0x00000097) @ 0x1ffd0000

ACPI: FADT (v002 A M I  OEMFACP  0x06000428 MSFT 0x00000097) @ 0x1ffd0200

ACPI: OEMB (v001 A M I  AMI_OEM  0x06000428 MSFT 0x00000097) @ 0x1ffdf040

ACPI: SSDT (v001    AMI   CPU1PM 0x00000001 INTL 0x02002026) @ 0x1ffd3e50

ACPI: DSDT (v001   1003 10032400 0x00002400 INTL 0x02002026) @ 0x00000000

ACPI: PM-Timer IO Port: 0x408

Allocating PCI resources starting at 30000000 (gap: 20000000:e0000000)

Built 1 zonelists

Kernel command line: quiet real_root=/dev/hda7 video=vesafb:ywrap,mtrr,1400x1050-32@60 splash=silent,theme:NewLinux CONSOLE=/dev/tty1

Found and enabled local APIC!

mapped APIC to ffffd000 (fee00000)

Initializing CPU#0

PID hash table entries: 2048 (order: 11, 32768 bytes)

Detected 1700.083 MHz processor.

Using pmtmr for high-res timesource

Console: colour VGA+ 80x25

Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)

Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)

Memory: 513684k/524096k available (3208k kernel code, 9860k reserved, 991k data, 256k init, 0k highmem)

Checking if this processor honours the WP bit even in supervisor mode... Ok.

Calibrating delay using timer specific routine.. 3402.90 BogoMIPS (lpj=6805815)

Mount-cache hash table entries: 512

CPU: After generic identify, caps: afe9fbbf 00000000 00000000 00000000 00000180 00000000 00000000

CPU: After vendor identify, caps: afe9fbbf 00000000 00000000 00000000 00000180 00000000 00000000

CPU: L1 I cache: 32K, L1 D cache: 32K

CPU: L2 cache: 2048K

CPU: After all inits, caps: afe9fbbf 00000000 00000000 00000040 00000180 00000000 00000000

Intel machine check architecture supported.

Intel machine check reporting enabled on CPU#0.

mtrr: v2.0 (20020519)

Enabling fast FPU save and restore... done.

Enabling unmasked SIMD FPU exception support... done.

Checking 'hlt' instruction... OK.

ACPI: setting ELCR to 0200 (from 0e38)

CPU0: Intel(R) Pentium(R) M processor 1.70GHz stepping 06

SMP motherboard not detected.

Brought up 1 CPUs

NET: Registered protocol family 16

ACPI: bus type pci registered

PCI: PCI BIOS revision 2.10 entry at 0xf0031, last bus=3

PCI: Using configuration type 1

ACPI: Subsystem revision 20050902

ACPI: Interpreter enabled

ACPI: Using PIC for interrupt routing

ACPI: PCI Root Bridge [PCI0] (0000:00)

PCI: Probing PCI hardware (bus 00)

PCI quirk: region 0400-047f claimed by ICH4 ACPI/GPIO/TCO

PCI quirk: region 0500-053f claimed by ICH4 GPIO

PCI: Ignoring BAR0-3 of IDE controller 0000:00:1f.1

Boot video device is 0000:01:00.0

PCI: Transparent bridge - 0000:00:1e.0

ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]

ACPI: Embedded Controller [EC] (gpe 28)

ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.P0P2._PRT]

ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.P0P1._PRT]

ACPI: PCI Interrupt Link [LNKA] (IRQs *3)

ACPI: PCI Interrupt Link [LNKB] (IRQs *9)

ACPI: PCI Interrupt Link [LNKC] (IRQs 9 10 *11 12)

ACPI: PCI Interrupt Link [LNKD] (IRQs *10)

ACPI: PCI Interrupt Link [LNKE] (IRQs 11) *0, disabled.

ACPI: PCI Interrupt Link [LNKF] (IRQs 3 *4 5 6 7 9 10 11 12 14 15)

ACPI: PCI Interrupt Link [LNKG] (IRQs 3 4 *5 6 7 9 10 11 12 14 15)

ACPI: PCI Interrupt Link [LNKH] (IRQs *9 10 11 12)

Linux Plug and Play Support v0.97 (c) Adam Belay

pnp: PnP ACPI init

pnp: PnP ACPI: found 10 devices

SCSI subsystem initialized

usbcore: registered new driver usbfs

usbcore: registered new driver hub

PCI: Using ACPI for IRQ routing

PCI: If a device doesn't work, try "pci=routeirq".  If it helps, post a report

pnp: 00:06: ioport range 0x600-0x67f has been reserved

pnp: 00:08: ioport range 0x680-0x6c2 has been reserved

pnp: 00:08: ioport range 0x1100-0x113f has been reserved

pnp: 00:08: ioport range 0x1254-0x1254 has been reserved

pnp: 00:08: ioport range 0x12d4-0x12d4 has been reserved

pnp: 00:08: ioport range 0x1377-0x137f has been reserved

PCI: Bridge: 0000:00:01.0

  IO window: 9000-bfff

  MEM window: ffc00000-ffcfffff

  PREFETCH window: ceb00000-deafffff

PCI: Bus 3, cardbus bridge: 0000:02:04.0

  IO window: 0000c000-0000c0ff

  IO window: 0000c400-0000c4ff

  PREFETCH window: 30000000-31ffffff

  MEM window: 36000000-37ffffff

PCI: Bus 7, cardbus bridge: 0000:02:04.1

  IO window: 0000cc00-0000ccff

  IO window: 00001000-000010ff

  PREFETCH window: 32000000-33ffffff

  MEM window: 38000000-39ffffff

PCI: Bridge: 0000:00:1e.0

  IO window: c000-cfff

  MEM window: ffd00000-ffdfffff

  PREFETCH window: 30000000-34ffffff

PCI: Setting latency timer of device 0000:00:1e.0 to 64

ACPI: PCI Interrupt Link [LNKD] enabled at IRQ 10

PCI: setting IRQ 10 as level-triggered

ACPI: PCI Interrupt 0000:02:04.0[A] -> Link [LNKD] -> GSI 10 (level, low) -> IRQ 10

PCI: Setting latency timer of device 0000:02:04.0 to 64

ACPI: PCI Interrupt Link [LNKE] enabled at IRQ 11

PCI: setting IRQ 11 as level-triggered

ACPI: PCI Interrupt 0000:02:04.1[B] -> Link [LNKE] -> GSI 11 (level, low) -> IRQ 11

PCI: Setting latency timer of device 0000:02:04.1 to 64

Machine check exception polling timer started.

apm: BIOS not found.

audit: initializing netlink socket (disabled)

audit(1133821721.552:1): initialized

VFS: Disk quotas dquot_6.5.1

Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)

Installing knfsd (copyright (C) 1996 okir@monad.swb.de).

NTFS driver 2.1.24 [Flags: R/O].

Initializing Cryptographic API

lp: driver loaded but no devices found

vesafb: unrecognized option mtrr

vesafb: ATI Technologies Inc., P11 , 01.00 (OEM: ATI MOBILITY RADEON 9600   )

vesafb: VBE version: 2.0

vesafb: protected mode interface info at c000:5573

vesafb: pmi: set display start = c00c55e1, set palette = c00c561b

vesafb: pmi: ports = b010 b016 b054 b038 b03c b05c b000 b004 b0b0 b0b2 b0b4

vesafb: no monitor limits have been set

vesafb: scrolling: ywrap using protected mode interface, yres_virtual=2100

Console: switching to colour frame buffer device 175x65

vesafb: framebuffer at 0xd0000000, mapped to 0xe0880000, using 11484k, total 131072k

fb0: VESA VGA frame buffer device

ACPI: AC Adapter [ADP1] (on-line)

ACPI: Battery Slot [BAT1] (battery present)

ACPI: Power Button (FF) [PWRF]

ACPI: Power Button (CM) [PWRB]

ACPI: Lid Switch [LID0]

ACPI: Sleep Button (CM) [SLPB]

ACPI: CPU0 (power states: C1[C2] C2[C3])

ACPI: Processor [CPU1] (supports 8 throttling states)

ACPI: Thermal Zone [THRM] (52 C)

isapnp: Scanning for PnP cards...

isapnp: No Plug & Play device found

PNP: PS/2 Controller [PNP0303:PS2K] at 0x60,0x64 irq 1

PNP: PS/2 controller doesn't have AUX irq; using default 12

i8042.c: Detected active multiplexing controller, rev 1.1.

serio: i8042 AUX0 port at 0x60,0x64 irq 12

serio: i8042 AUX1 port at 0x60,0x64 irq 12

serio: i8042 AUX2 port at 0x60,0x64 irq 12

serio: i8042 AUX3 port at 0x60,0x64 irq 12

serio: i8042 KBD port at 0x60,0x64 irq 1

Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled

ACPI: PCI Interrupt Link [LNKB] enabled at IRQ 9

PCI: setting IRQ 9 as level-triggered

ACPI: PCI Interrupt 0000:00:1f.6[B] -> Link [LNKB] -> GSI 9 (level, low) -> IRQ 9

ACPI: PCI interrupt for device 0000:00:1f.6 disabled

parport: PnPBIOS parport detected.

parport0: PC-style at 0x378, irq 7 [PCSPP(,...)]

lp0: using parport0 (interrupt-driven).

mice: PS/2 mouse device common for all mice

io scheduler noop registered

io scheduler anticipatory registered

io scheduler deadline registered

io scheduler cfq registered

RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize

loop: loaded (max 8 devices)

8139too Fast Ethernet driver 0.9.27

ACPI: PCI Interrupt Link [LNKG] enabled at IRQ 5

PCI: setting IRQ 5 as level-triggered

ACPI: PCI Interrupt 0000:02:03.0[A] -> Link [LNKG] -> GSI 5 (level, low) -> IRQ 5

eth0: RealTek RTL8139 at 0xc800, 00:0c:76:f8:66:c0, IRQ 5

eth0:  Identified 8139 chip type 'RTL-8101'

Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2

ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx

ICH4: IDE controller at PCI slot 0000:00:1f.1

PCI: Enabling device 0000:00:1f.1 (0005 -> 0007)

ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 11

ACPI: PCI Interrupt 0000:00:1f.1[A] -> Link [LNKC] -> GSI 11 (level, low) -> IRQ 11

ICH4: chipset revision 3

ICH4: not 100% native mode: will probe irqs later

    ide0: BM-DMA at 0xffa0-0xffa7, BIOS settings: hda:DMA, hdb:pio

    ide1: BM-DMA at 0xffa8-0xffaf, BIOS settings: hdc:DMA, hdd:pio

Probing IDE interface ide0...

input: AT Translated Set 2 keyboard on isa0060/serio0

logips2pp: Detected unknown logitech mouse model 99

hda: TOSHIBA MK8026GAX, ATA DISK drive

input: ImPS/2 Logitech Wheel Mouse on isa0060/serio1

ide0 at 0x1f0-0x1f7,0x3f6 on irq 14

Probing IDE interface ide1...

hdc: QSI DVDRW SDW-042, ATAPI CD/DVD-ROM drive

ide1 at 0x170-0x177,0x376 on irq 15

hda: max request size: 128KiB

hda: 156301488 sectors (80026 MB), CHS=65535/16/63, UDMA(100)

hda: cache flushes supported

 hda: hda1 hda2 < hda5 hda6 hda7 >

hdc: ATAPI 24X DVD-ROM DVD-R CD-R/RW drive, 2048kB Cache, UDMA(33)

Uniform CD-ROM driver Revision: 3.20

libata version 1.12 loaded.

ohci1394: $Rev: 1313 $ Ben Collins <bcollins@debian.org>

ACPI: PCI Interrupt Link [LNKF] enabled at IRQ 4

PCI: setting IRQ 4 as level-triggered

ACPI: PCI Interrupt 0000:02:04.2[C] -> Link [LNKF] -> GSI 4 (level, low) -> IRQ 4

ohci1394: fw-host0: OHCI-1394 1.0 (PCI): IRQ=[4]  MMIO=[ffdff000-ffdff7ff]  Max Packet=[2048]

ieee1394: raw1394: /dev/raw1394 device initialized

usbmon: debugfs is not available

ACPI: PCI Interrupt Link [LNKH] enabled at IRQ 9

ACPI: PCI Interrupt 0000:00:1d.7[D] -> Link [LNKH] -> GSI 9 (level, low) -> IRQ 9

PCI: Setting latency timer of device 0000:00:1d.7 to 64

ehci_hcd 0000:00:1d.7: EHCI Host Controller

ehci_hcd 0000:00:1d.7: debug port 1

ehci_hcd 0000:00:1d.7: new USB bus registered, assigned bus number 1

ehci_hcd 0000:00:1d.7: irq 9, io mem 0xffeffc00

PCI: cache line size of 32 is not supported by device 0000:00:1d.7

ehci_hcd 0000:00:1d.7: USB 2.0 initialized, EHCI 1.00, driver 10 Dec 2004

hub 1-0:1.0: USB hub found

hub 1-0:1.0: 6 ports detected

USB Universal Host Controller Interface driver v2.3

ACPI: PCI Interrupt Link [LNKA] enabled at IRQ 3

PCI: setting IRQ 3 as level-triggered

ACPI: PCI Interrupt 0000:00:1d.0[A] -> Link [LNKA] -> GSI 3 (level, low) -> IRQ 3

PCI: Setting latency timer of device 0000:00:1d.0 to 64

uhci_hcd 0000:00:1d.0: UHCI Host Controller

uhci_hcd 0000:00:1d.0: new USB bus registered, assigned bus number 2

uhci_hcd 0000:00:1d.0: irq 3, io base 0x0000e800

hub 2-0:1.0: USB hub found

hub 2-0:1.0: 2 ports detected

ACPI: PCI Interrupt 0000:00:1d.1[B] -> Link [LNKD] -> GSI 10 (level, low) -> IRQ 10

PCI: Setting latency timer of device 0000:00:1d.1 to 64

uhci_hcd 0000:00:1d.1: UHCI Host Controller

uhci_hcd 0000:00:1d.1: new USB bus registered, assigned bus number 3

uhci_hcd 0000:00:1d.1: irq 10, io base 0x0000e880

hub 3-0:1.0: USB hub found

hub 3-0:1.0: 2 ports detected

ACPI: PCI Interrupt 0000:00:1d.2[C] -> Link [LNKC] -> GSI 11 (level, low) -> IRQ 11

PCI: Setting latency timer of device 0000:00:1d.2 to 64

uhci_hcd 0000:00:1d.2: UHCI Host Controller

uhci_hcd 0000:00:1d.2: new USB bus registered, assigned bus number 4

uhci_hcd 0000:00:1d.2: irq 11, io base 0x0000ec00

hub 4-0:1.0: USB hub found

hub 4-0:1.0: 2 ports detected

usb 3-1: new low speed USB device using uhci_hcd and address 2

usbcore: registered new driver usblp

drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver

Initializing USB Mass Storage driver...

usbcore: registered new driver usb-storage

USB Mass Storage support registered.

input: USB HID v1.10 Mouse [Logitech USB Receiver] on usb-0000:00:1d.1-1

usbcore: registered new driver usbhid

drivers/usb/input/hid-core.c: v2.6:USB HID core driver

Advanced Linux Sound Architecture Driver Version 1.0.10rc1 (Mon Sep 12 08:13:09 2005 UTC).

ACPI: PCI Interrupt 0000:00:1f.5[B] -> Link [LNKB] -> GSI 9 (level, low) -> IRQ 9

PCI: Setting latency timer of device 0000:00:1f.5 to 64

ieee1394: Host added: ID:BUS[0-00:1023]  GUID[0010dc00006d1228]

intel8x0_measure_ac97_clock: measured 55509 usecs

intel8x0: clocking to 48000

ALSA device list:

  #0: Intel 82801DB-ICH4 with ALC655 at 0xffeff800, irq 9

oprofile: using NMI interrupt.

NET: Registered protocol family 2

IP route cache hash table entries: 8192 (order: 3, 32768 bytes)

TCP established hash table entries: 32768 (order: 6, 393216 bytes)

TCP bind hash table entries: 32768 (order: 6, 393216 bytes)

TCP: Hash tables configured (established 32768 bind 32768)

TCP reno registered

ip_conntrack version 2.3 (4094 buckets, 32752 max) - 216 bytes per conntrack

ip_tables: (C) 2000-2002 Netfilter core team

ipt_recent v0.3.1: Stephen Frost <sfrost@snowman.net>.  http://snowman.net/projects/ipt_recent/

arp_tables: (C) 2002 David S. Miller

TCP bic registered

NET: Registered protocol family 1

NET: Registered protocol family 17

Using IPI Shortcut mode

EXT3-fs: mounted filesystem with ordered data mode.

VFS: Mounted root (ext3 filesystem) readonly.

Freeing unused kernel memory: 256k freed

kjournald starting.  Commit interval 5 seconds

Adding 722884k swap on /dev/hda6.  Priority:-1 extents:1 across:722884k

EXT3 FS on hda7, internal journal

device-mapper: 4.4.0-ioctl (2005-01-12) initialised: dm-devel@redhat.com

cdrom: open failed.

device-mapper: dm-linear: Device lookup failed

device-mapper: error adding target to table

device-mapper: dm-linear: Device lookup failed

device-mapper: error adding target to table

device-mapper: dm-linear: Device lookup failed

device-mapper: error adding target to table

device-mapper: dm-linear: Device lookup failed

device-mapper: error adding target to table

device-mapper: dm-linear: Device lookup failed

device-mapper: error adding target to table

device-mapper: dm-linear: Device lookup failed

device-mapper: error adding target to table

device-mapper: dm-linear: Device lookup failed

device-mapper: error adding target to table

device-mapper: dm-linear: Device lookup failed

device-mapper: error adding target to table

device-mapper: dm-linear: Device lookup failed

device-mapper: error adding target to table

device-mapper: dm-linear: Device lookup failed

device-mapper: error adding target to table

device-mapper: dm-linear: Device lookup failed

device-mapper: error adding target to table

device-mapper: dm-linear: Device lookup failed

device-mapper: error adding target to table

device-mapper: dm-linear: Device lookup failed

device-mapper: error adding target to table

device-mapper: dm-linear: Device lookup failed

device-mapper: error adding target to table

device-mapper: dm-linear: Device lookup failed

device-mapper: error adding target to table

device-mapper: dm-linear: Device lookup failed

device-mapper: error adding target to table

NTFS volume version 3.1.

hw_random hardware driver 1.0.0 loaded

ACPI: PCI Interrupt 0000:02:04.0[A] -> Link [LNKD] -> GSI 10 (level, low) -> IRQ 10

Yenta: CardBus bridge found at 0000:02:04.0 [1462:0031]

Yenta: ISA IRQ mask 0x0000, PCI irq 10

Socket status: 30000006

pcmcia: parent PCI bridge I/O window: 0xc000 - 0xcfff

cs: IO port probe 0xc000-0xcfff: clean.

pcmcia: parent PCI bridge Memory window: 0xffd00000 - 0xffdfffff

pcmcia: parent PCI bridge Memory window: 0x30000000 - 0x34ffffff

ACPI: PCI Interrupt 0000:02:04.1[B] -> Link [LNKE] -> GSI 11 (level, low) -> IRQ 11

Yenta: CardBus bridge found at 0000:02:04.1 [1462:0031]

Yenta: ISA IRQ mask 0x0000, PCI irq 11

Socket status: 30000006

pcmcia: parent PCI bridge I/O window: 0xc000 - 0xcfff

cs: IO port probe 0xc000-0xcfff: clean.

pcmcia: parent PCI bridge Memory window: 0xffd00000 - 0xffdfffff

pcmcia: parent PCI bridge Memory window: 0x30000000 - 0x34ffffff

ieee80211_crypt: registered algorithm 'NULL'

ieee80211: 802.11 data/management/control stack, 1.1.6

ieee80211: Copyright (C) 2004-2005 Intel Corporation <jketreno@linux.intel.com>

ipw2200: Intel(R) PRO/Wireless 2200/2915 Network Driver, 1.0.8

ipw2200: Copyright(c) 2003-2005 Intel Corporation

ACPI: PCI Interrupt 0000:02:09.0[A] -> Link [LNKB] -> GSI 9 (level, low) -> IRQ 9

ipw2200: Detected Intel PRO/Wireless 2200BG Network Connection

ipw2200: Radio Frequency Kill Switch is On:

Kill switch must be turned off for wireless networking to work.

pcmcia: Detected deprecated PCMCIA ioctl usage.

pcmcia: This interface will soon be removed from the kernel; please expect breakage unless you upgrade to new tools.

pcmcia: see http://www.kernel.org/pub/linux/utils/kernel/pcmcia/pcmcia.html for details.

cs: IO port probe 0xc00-0xcff: clean.

cs: IO port probe 0xc00-0xcff: clean.

cs: IO port probe 0x800-0x8ff: clean.

cs: IO port probe 0x800-0x8ff: clean.

cs: IO port probe 0x100-0x4ff: excluding 0x4d0-0x4d7

cs: IO port probe 0x100-0x4ff: excluding 0x4d0-0x4d7

cs: IO port probe 0xa00-0xaff: clean.

cs: IO port probe 0xa00-0xaff: clean.

eth0: link up, 100Mbps, full-duplex, lpa 0x41E1

eth0: link up, 100Mbps, full-duplex, lpa 0x41E1

fbsplash: console 0 using theme 'NewLinux'

fbsplash: switched splash state to 'on' on console 0

fbsplash: console 1 using theme 'NewLinux'

fbsplash: switched splash state to 'on' on console 1

fbsplash: console 2 using theme 'NewLinux'

fbsplash: switched splash state to 'on' on console 2

fbsplash: console 3 using theme 'NewLinux'

fbsplash: switched splash state to 'on' on console 3

fbsplash: console 4 using theme 'NewLinux'

fbsplash: switched splash state to 'on' on console 4

fbsplash: console 5 using theme 'NewLinux'

fbsplash: switched splash state to 'on' on console 5

fbsplash: console 6 using theme 'NewLinux'

fbsplash: switched splash state to 'on' on console 6

fbsplash: console 7 using theme 'NewLinux'

fbsplash: switched splash state to 'on' on console 7

fbsplash: console 8 using theme 'NewLinux'

fbsplash: switched splash state to 'on' on console 8

fbsplash: console 9 using theme 'NewLinux'

fbsplash: switched splash state to 'on' on console 9

fbsplash: console 10 using theme 'NewLinux'

fbsplash: switched splash state to 'on' on console 10

Linux agpgart interface v0.101 (c) Dave Jones

fglrx: module license 'Proprietary. (C) 2002 - ATI Technologies, Starnberg, GERMANY' taints kernel.

[fglrx] Maximum main memory to use for locked dma buffers: 430 MBytes.

ACPI: PCI Interrupt 0000:01:00.0[A] -> Link [LNKA] -> GSI 3 (level, low) -> IRQ 3

[fglrx] module loaded - fglrx 8.14.13 [Jun  8 2005] on minor 0

Fire GL built-in AGP-support

Based on agpgart interface v0.99 (c) Jeff Hartmann

agpgart: Maximum main memory to use for agp memory: 439M

agpgart: Detected an Intel 855PM Chipset, no integrated grapics found.

agpgart: Detected Intel i855PM chipset

agpgart: AGP aperture is 256M @ 0xe0000000

Power management callback for AGP chipset installed

[fglrx] AGP detected, AgpState   = 0x1f000217 (hardware caps of chipset)

AGP: Found 2 AGPv2 devices

AGP: Doing enable for AGPv2

[fglrx] AGP enabled,  AgpCommand = 0x1f000314 (selected caps)

[fglrx] free  AGP = 256126976

[fglrx] max   AGP = 256126976

[fglrx] free  LFB = 114274304

[fglrx] max   LFB = 114274304

[fglrx] free  Inv = 0

[fglrx] max   Inv = 0

[fglrx] total Inv = 0

[fglrx] total TIM = 0

[fglrx] total FB  = 0

[fglrx] total AGP = 65536

eth0: link down

eth0: link up, 10Mbps, half-duplex, lpa 0x0000

eth0: link down

eth0: link up, 100Mbps, full-duplex, lpa 0x41E1

eth0: link down

```

i don't get any message after unplugged the power cable.

----------

## Earthwings

Looks ok as far as I can tell. Just to make sure, acpid is running, right? ps -C acpid

What laptop brand/model is that? Did you google to see whether someone reported the same problem with that laptop?

Sometimes a BIOS update is available that fixes problems like this.

----------

## senzacionale

```

 ps -C acpid

  PID TTY          TIME CMD

 5927 ?        00:00:00 acpid

```

I google for this but no one has that problem or no one try this yet with gericom ego 1.7 notebook. Maybe i am the first one but i don't think so. I am using the last bios for my notebook.

----------

## s0lar

It works here but not completely like I want it to work:

Installed laptop-mode-tools to control my cpu frequency, when I plug out my adapter my cpu clocks back to 800Mhz. 

Only it does that after I outplug it twice instead of once. Meaning I have to plug it out, plug it in and then plug it out again. Very stupid. 

cat /proc/sys/vm/laptop_mode says 2 and 

this are my acpi events: tail -f /var/log/sys/acpid | grep "received event" says this when I plug my adapter in and it says 

"ac_adapter AC 00000080 00000001" 

"processor CPU0 00000080 000000" and 

"battery BAT0 00000080 00000001" 

This is what I get when I plug my adapter out 

"ac_adapter AC 00000080 00000000" 

"processor CPU0 00000080 000000" and 

"battery BAT0 00000080 00000001". 

I have made the files /etc/acpi/events/pmg_ac_adapter containing the AC 00000080 00000001 

and the /etc/..../pmg_battery containing BAT0 00000080 00000001. 

Do I have to change those files, should I change or add some other files not in the guide? 

Thanks in advance.

----------

## senzacionale

s0lar which howto do you use. In my howto there is no laptop-mode-tools.

Thnx

----------

## Earthwings

It should work then (in case the numbers in the end stay the same and are not increased). It takes some time here to recognize the event and do all the stuff like runlevel changing (something like five seconds) - did you wait long enough?

@senzacionale: I took a quick search on google and didn't find much information on this laptop running on linux. Can you go through the acpid log file to see whether any events (like lid or whatever) have been generated over time?

----------

## s0lar

 *senzacionale wrote:*   

> s0lar which howto do you use. In my howto there is no laptop-mode-tools.
> 
> Thnx

 

I just used the powermanagement howto http://www.gentoo.org/doc/en/power-management-guide.xml and then I installed laptop-mode-tools and in the config I have set it so it can control the cpu frequency and the governer is powersave.

----------

## senzacionale

I will look into the acpid log Earthwings.

s0lar you use the same howto.

----------

## s0lar

 *senzacionale wrote:*   

> 
> 
> s0lar you use the same howto.

 

Yes I did, it worked for me. I have fixed it, well not really but I have changed some config stuff. I installed powernowd and set it to clock it back using the userspace governer. Meaning it clocks back when I am not using it full load. It works and I am happy. It clocks back on default and on battery runlevel, why, yeah just because I don't mind my cpu clocking back when I am not stressing it  :Wink: .

----------

## senzacionale

 *Quote:*   

> 
> 
> @senzacionale: I took a quick search on google and didn't find much information on this laptop running on linux. Can you go through the acpid log file to see whether any events (like lid or whatever) have been generated over time?
> 
> 

 

i go through acpid log files and i didn't find any events.

----------

## senzacionale

anyone else has this problemms, why

```
tail -f /var/log/acpid | grep "received event"
```

not working for me. If i try

```
tail -f /var/log/sys/acpid | grep "received event"
```

said that file doesn't exist

when i try

```
 on_ac_power && echo AC available || echo Running on batteries
```

it said

```
AC available
```

and when i pluged out the adapter and run

```

on_ac_power && echo AC available || echo Running on batteries

```

it said

```
Running on batteries
```

what can be still wrong here?

Is this scrip ok

```

#!/bin/bash

# BEGIN configuration

RUNLEVEL_AC="default"

RUNLEVEL_BATTERY="battery"

# END configuration

if [ ! -d "/etc/runlevels/${RUNLEVEL_AC}" ]

then

        logger "${0}: Runlevel ${RUNLEVEL_AC} does not exist. Aborting."

        exit 1

fi

if [ ! -d "/etc/runlevels/${RUNLEVEL_BATTERY}" ]

then

        logger "${0}: Runlevel ${RUNLEVEL_BATTERY} does not exist. Aborting."

        exit 1

fi

if on_ac_power

then

    if [[ "$(cat /var/lib/init.d/softlevel)" != "${RUNLEVEL_AC}" ]]

  then

            logger "Switching to ${RUNLEVEL_AC} runlevel"

            /sbin/rc ${RUNLEVEL_AC}

        fi

elif [[ "$(cat /var/lib/init.d/softlevel)" != "${RUNLEVEL_BATTERY}" ]]

then

        logger "Switching to ${RUNLEVEL_BATTERY} runlevel"

        /sbin/rc ${RUNLEVEL_BATTERY}

fi

```

i save it in

```
/etc/acpi/actions/pmg_switch_runlevel.sh
```

First i must create action directory then i can save it in it.

log file of acpid is empty.

Just this is in it

```

[Mon Dec 26 22:52:41 2005] starting up

[Mon Dec 26 22:52:41 2005] 1 rule loaded

[Mon Dec 26 22:52:44 2005] exiting

[Mon Dec 26 22:52:48 2005] starting up

[Mon Dec 26 22:52:48 2005] 1 rule loaded

[Mon Dec 26 23:02:11 2005] exiting

[Tue Dec 27 09:35:39 2005] starting up

[Tue Dec 27 09:35:40 2005] 1 rule loaded

[Tue Dec 27 09:41:13 2005] exiting

[Tue Dec 27 10:12:21 2005] starting up

[Tue Dec 27 10:12:21 2005] 1 rule loaded

[Tue Dec 27 10:16:37 2005] exiting

[Tue Dec 27 10:17:26 2005] starting up

[Tue Dec 27 10:17:26 2005] 1 rule loaded

[Tue Dec 27 10:22:58 2005] exiting

[Tue Dec 27 10:22:59 2005] starting up

[Tue Dec 27 10:22:59 2005] 1 rule loaded

```

Can someone help me becouse this obviously not working in my laptop!!!

----------

## cynric

I'm currently working on this myself and am in essentially the same place as senzacionale. There are two diffences. When running 

```
tail -f /var/log/acpid | grep "received event"
```

I receive the following for both instances (AC plugged in and pulled out):  *Quote:*   

> <date here> received event "battery BAT1 00000080 00000001"

 

The other difference is when running 

```
on_ac_power && echo AC available || echo Running on batteries
```

.

With AC plugged in, it prints "AC available". However, when it's running off batteries, the machine hardlocks.

I'm running a Compaq Presario V2000. Any help would be greatly appreciated.

----------

## cynric

I'm still working on this without success. I have noticed that when /etc/acpi/actions/pmg_switch_runlevel.sh runs, I get the message "${0}: Runlevel ${RUNLEVEL_AC} does not exist. Aborting." (note: following the power-management-guide). Every minute I get another entry in /var/log/acpid saying "{0} ACPI group battery / action battery is not defined" (yes, {0} is expanded to date, time, host).

Everything is compiled in like the above manual suggests. Anyone have any ideas? I'd really like to get this part behind me.

----------

## thunderblade

 *cynric wrote:*   

> I receive the following for both instances (AC plugged in and pulled out):  *Quote:*   <date here> received event "battery BAT1 00000080 00000001" 
> 
> 

 

getting nearly the same message - but wit ac_adapter instead of battery

no matter if AC plugged in or not

but when trying with:

```
on_ac_power && echo AC available || echo Running on batteries
```

I'm receiving correct messages when running in AC/BAT-mode...

so it seems that there is no battery-module, but its compiled in kernel

anyone any ideas?

----------

## firephoto

Same problem here with a thinkpad t20 on ~x86.

```

[Fri Jan 13 12:49:54 2006] completed event "battery BAT0 00000080 00000001"

```

 I get that event when plugging or unplugging the ac power.

----------

## thunderblade

fixed the problem with a HOTKEY-event my Asus notebook sends along with the AC/BAT-event when plugging/unplugging AC

----------

## je_fro

did you ever resolve this?

I also have a T20 and the only acpi event I recieve is :

[Mon Mar  6 18:34:11 2006] received event "battery BAT0 00000080 00000001"

[Mon Mar  6 18:34:15 2006] received event "battery BAT0 00000080 00000001"

[Mon Mar  6 18:34:28 2006] received event "battery BAT0 00000080 00000001"

[Mon Mar  6 18:34:45 2006] received event "battery BAT0 00000080 00000001"

whether I'm plugging or unplugging the power cord...

----------

## firephoto

Even though I was only getting that one event type the actual handoff as described in the howto does work for going from ac to battery or vice versa.

I don't have it on at the moment but if you need some help I'll look at the configs.

----------

## je_fro

I'm not switching runlevels, it seems....

No matter whether the AC is plugged in or not, I always stay in the default runlevel

```
jeff@laptop ~ $ rc-status

Runlevel: default

 xdm                                                                                     [ started ] ntp-client                                                                              [ started ] dbus                                                                                    [ started ] hald                                                                                    [ started ] sshd                                                                                    [ started ] acpid                                                                                   [ started ] local                                                                                   [ started ] vixie-cron                                                                              [ started ] syslog-ng                                                                               [ started ] net.eth1                                                                                [ started ] pcmcia                                                                                  [ started ] netmount                                                                                [ started ] cpufreqd                                                                                [ started ] hotplug                                                                                 [ started ] alsasound  
```

Here's a cycle of messages when I unplug and replug in the AC cord.

```
# tail -f /var/log/acpid 

==> /var/log/acpid <==

[Mon Mar  6 19:57:55 2006] received event "battery BAT0 00000080 00000001"

[Mon Mar  6 19:57:55 2006] notifying client 7519[102:408]

[Mon Mar  6 19:57:55 2006] executing action "/etc/acpi/default.sh battery BAT0 00000080 00000001"

[Mon Mar  6 19:57:55 2006] BEGIN HANDLER MESSAGES

[Mon Mar  6 19:57:55 2006] END HANDLER MESSAGES

[Mon Mar  6 19:57:55 2006] action exited with status 0

[Mon Mar  6 19:57:55 2006] executing action "/etc/acpi/actions/pmg_switch_runlevel.sh battery BAT0 0 0000080 00000001"

[Mon Mar  6 19:57:55 2006] BEGIN HANDLER MESSAGES

 * Unmounting network filesystems ...                                     [ ok ]

 * Stopping sshd ...                                                      [ ok ]

 * Stopping eth1

 *   Bringing down eth1

 *     Stopping dhcpcd on eth1 ...                                        [ ok ]

 *     Shutting down eth1 ...                                             [ ok ]

 * Mounting network filesystems ...SMB connection failed

 * Could not mount all network filesystems!

                                                                          [ !! ]

 * Setting clock via the NTP client 'ntpdate' ...Error : Temporary failure in name resolution

 6 Mar 19:57:58 ntpdate[10896]: can't find host pool.ntp.org

 6 Mar 19:57:58 ntpdate[10896]: no servers can be used, exiting

 * Failed to set clock

                                                                          [ !! ]

 * Starting sshd ...                                                      [ ok ]

[Mon Mar  6 19:57:59 2006] END HANDLER MESSAGES

[Mon Mar  6 19:57:59 2006] action exited with status 0

[Mon Mar  6 19:57:59 2006] completed event "battery BAT0 00000080 00000001"

[Mon Mar  6 19:57:59 2006] received event "battery BAT0 00000080 00000001"

[Mon Mar  6 19:57:59 2006] notifying client 7519[102:408]

[Mon Mar  6 19:57:59 2006] executing action "/etc/acpi/default.sh battery BAT0 00000080 00000001"

[Mon Mar  6 19:57:59 2006] BEGIN HANDLER MESSAGES

[Mon Mar  6 19:57:59 2006] END HANDLER MESSAGES

[Mon Mar  6 19:57:59 2006] action exited with status 0

[Mon Mar  6 19:57:59 2006] executing action "/etc/acpi/actions/pmg_switch_runlevel.sh battery BAT0 0 0000080 00000001"

[Mon Mar  6 19:57:59 2006] BEGIN HANDLER MESSAGES

[Mon Mar  6 19:57:59 2006] END HANDLER MESSAGES

[Mon Mar  6 19:57:59 2006] action exited with status 0

[Mon Mar  6 19:57:59 2006] completed event "battery BAT0 00000080 00000001"

[Mon Mar  6 19:58:04 2006] received event "battery BAT0 00000080 00000001"

[Mon Mar  6 19:58:04 2006] notifying client 7519[102:408]

[Mon Mar  6 19:58:04 2006] executing action "/etc/acpi/default.sh battery BAT0 00000080 00000001"

[Mon Mar  6 19:58:04 2006] BEGIN HANDLER MESSAGES

[Mon Mar  6 19:58:04 2006] END HANDLER MESSAGES

[Mon Mar  6 19:58:04 2006] action exited with status 0

[Mon Mar  6 19:58:04 2006] executing action "/etc/acpi/actions/pmg_switch_runlevel.sh battery BAT0 0 0000080 00000001"

[Mon Mar  6 19:58:04 2006] BEGIN HANDLER MESSAGES

 * Starting eth1

 *   Configuring wireless network for eth1

 *     eth1 connected to "000D0BAEC712" at 00:0D:0B:AE:C7:13

 *     in managed mode (WEP enabled - open)

 *   Bringing up eth1

 *     dhcp

 *       Running dhcpcd ...                                               [ ok ]

 *       eth1 received address 192.168.11.5

 * Setting clock via the NTP client 'ntpdate' ...                         [ ok ]

[Mon Mar  6 19:58:21 2006] END HANDLER MESSAGES

[Mon Mar  6 19:58:21 2006] action exited with status 0

[Mon Mar  6 19:58:21 2006] completed event "battery BAT0 00000080 00000001"

[Mon Mar  6 19:58:21 2006] received event "battery BAT0 00000080 00000001"

[Mon Mar  6 19:58:21 2006] notifying client 7519[102:408]

[Mon Mar  6 19:58:21 2006] executing action "/etc/acpi/default.sh battery BAT0 00000080 00000001"

[Mon Mar  6 19:58:21 2006] BEGIN HANDLER MESSAGES

[Mon Mar  6 19:58:21 2006] END HANDLER MESSAGES

[Mon Mar  6 19:58:21 2006] action exited with status 0

[Mon Mar  6 19:58:21 2006] executing action "/etc/acpi/actions/pmg_switch_runlevel.sh battery BAT0 0 0000080 00000001"

[Mon Mar  6 19:58:21 2006] BEGIN HANDLER MESSAGES

[Mon Mar  6 19:58:21 2006] END HANDLER MESSAGES

[Mon Mar  6 19:58:21 2006] action exited with status 0

[Mon Mar  6 19:58:21 2006] completed event "battery BAT0 00000080 00000001"

```

So it seems (from rc-status) that I never get out of the default runlevel...

```
jeff@laptop ~ $ cat /etc/acpi/events/pmg_ac_adapter

# replace "ac_adapter" below with the event generated on your laptop

# See /var/log/acpid

event=ac_adapter.*

action=/etc/acpi/actions/pmg_switch_runlevel.sh %e

jeff@laptop ~ $ cat /etc/acpi/events/pmg_battery

# replace "battery" below with the event generated on your laptop

# See /var/log/acpid

event=battery.*

action=/etc/acpi/actions/pmg_switch_runlevel.sh %e

$ cat /etc/acpi/actions/pmg_switch_runlevel.sh

#!/bin/bash

# BEGIN configuration

RUNLEVEL_AC="default"

RUNLEVEL_BATTERY="battery"

# END configuration

if [ ! -d "/etc/runlevels/${RUNLEVEL_AC}" ]

then

    logger "${0}: Runlevel ${RUNLEVEL_AC} does not exist. Aborting."

    exit 1

fi

if [ ! -d "/etc/runlevels/${RUNLEVEL_BATTERY}" ]

then

    logger "${0}: Runlevel ${RUNLEVEL_BATTERY} does not exist. Aborting."

    exit 1

fi

if on_ac_power

then

    if [[ "$(cat /var/lib/init.d/softlevel)" != "${RUNLEVEL_AC}" ]]

    then

        logger "Switching to ${RUNLEVEL_AC} runlevel"

         /sbin/rc ${RUNLEVEL_AC}

    fi

elif [[ "$(cat /var/lib/init.d/softlevel)" != "${RUNLEVEL_BATTERY}" ]]

then

    logger "Switching to ${RUNLEVEL_BATTERY} runlevel"

    /sbin/rc ${RUNLEVEL_BATTERY}

fi

```

----------

## firephoto

Make them both look the same, it will work (don't ask me how but it does)  :Wink: 

```

# cat /etc/acpi/events/pmg_ac_adapter

event=battery.*

action=/etc/acpi/actions/pmg_switch_runlevel.sh %e

# cat /etc/acpi/events/pmg_battery

event=battery.*

action=/etc/acpi/actions/pmg_switch_runlevel.sh %e

```

----------

## je_fro

so does your rc-status show "battery" when the power cord is unplugged and "default" when it isn't?

----------

## firephoto

 *je_fro wrote:*   

> so does your rc-status show "battery" when the power cord is unplugged and "default" when it isn't?

 

Yes.

Yes it's somewhat perplexing.

Strange stuff.

----------

## senzacionale

can someone help me with my old problem

 *Quote:*   

> 
> 
> anyone else has this problemms, why
> 
> ```
> ...

 

i still didn't solve it

----------

## je_fro

The only problem I can see you're having is acpid events aren't getting logged.

I have no idea why, but with the power in, try rc-status. See if it says "default"

then pull the plug and see if it changes to "battery". My rc-status always shows whatever power status I booted with. Whether the power is attached or not.

----------

## demoon

Hi everybody, 

I have Laptop Acer Extensa 3002, and i have the following porblem with ACPI.

when i type on_ac_power && echo AC || echo Battery, it allways print me Battery in any case and the of cource i get no event abbout powersupply changes. I followed to the APM Guide here on www.gentoo.org. May somebody can help me?

I compiled this in kernel, not as modules

this is my dmesg. But i saw nothing that "Battery slot found" or something like this.

 *Quote:*   

> 
> 
> Linux version 2.6.16-gentoo-r13 (root@SkzKnight) (gcc version 3.4.4 (Gentoo 3.4$
> 
> BIOS-provided physical RAM map:
> ...

 

----------

## elKano

 *demoon wrote:*   

> Hi everybody, 
> 
> I have Laptop Acer Extensa 3002, and i have the following porblem with ACPI.
> 
> when i type on_ac_power && echo AC || echo Battery, it allways print me Battery in any case and the of cource i get no event abbout powersupply changes. I followed to the APM Guide here on www.gentoo.org. May somebody can help me?
> ...

 

I have the same problem, but my pc is an Acer Travelmate 4002 Laptop.

Actually, on_ac_power is returning 255, which, acording to the man page, means 'Power status could not be determined'. There are no events logged anywhere.

I've looked into the on_ac_power script, and apparently it looks into the '/proc/acpi/ac_adapter' dir for devices or something; my directory is empty, as well as '/proc/acpi/battery', but both exist.

After some googling, I have discovered that the problem is that Acer uses 'Smart Batteries', which aren't supported by the default acpi. Apparently, kernel 2.6.18 will include support for them, but on the meanwhile we can use SBS-linux patches, or some other ways involving 'iasl' compiler from intel (howto for Ubuntu in spanish). I am gonna try the patching way...

----------

## Euphemism

I'm getting the same error as senzacionale - that is, /var/log/acpid isn't getting any messages at all when the power cord is plugged or unplugged, but 

```
on_ac_power && echo AC available || echo Running on batteries
```

 does work. The annoying part about this is that this used to work for me just two weeks ago - then I had a hard drive crash and had to reinstall everything...

So I think this isn't a hardware problem.

----------

