You are not logged in.

#1 2012-02-27 19:24:17

axion419
Member
Registered: 2007-04-12
Posts: 185

Thinkpad T61 / ACPID Script Trouble

Hello,  I am having trouble wrapping my head around getting acpi events to run scripts.  I have 8 scripts defined, with 3 working.  I have the sleep button, and the Brightness up and down buttons running.  I am running Kernel 3.2.7-1 x64,  Acpid 2.0 and cpufrequtils 008-2. I know if I can make batt-in work, I can make batt-out work.  Or the same with the volume keys.

[justin@tux-top acpi]$ ls -l events/
total 32
-rw-r--r-- 1 root root 164 Feb 24 21:14 batt-in
-rw-r--r-- 1 root root 167 Feb 24 21:20 batt-out
-rw-r--r-- 1 root root 146 Feb 22 22:58 bright-down
-rw-r--r-- 1 root root 164 Feb 22 22:54 bright-up
-rw-r--r-- 1 root root  82 Feb 22 23:31 sleep-btn
-rw-r--r-- 1 root root  95 Feb 24 22:24 vol-down
-rw-r--r-- 1 root root  87 Feb 24 22:13 vol-mute
-rw-r--r-- 1 root root  88 Feb 24 22:12 vol-up
[justin@tux-top acpi]$ ls -l actions/
total 32
-rwxr-xr-x 1 root root 53 Feb 24 21:35 batt-in.sh
-rwxr-xr-x 1 root root 57 Feb 24 21:35 batt-out.sh
-rwxr-xr-x 1 root root 32 Feb 22 22:59 bright-down.sh
-rwxr-xr-x 1 root root 32 Feb 22 22:56 bright-up.sh
-rwxr-xr-x 1 root root 33 Feb 22 23:36 sleep-btn.sh
-rwxr-xr-x 1 root root 38 Feb 24 22:15 vol-down.sh
-rwxr-xr-x 1 root root 38 Feb 24 22:18 vol-mute.sh
-rwxr-xr-x 1 root root 38 Feb 24 22:15 vol-up.sh
[justin@tux-top acpi]$ 

For the batt-in/batt-out I am checking for the ac adapter being plugged in our out, and then trying to change the cpu governor with cpufreq-utils.  I have allowed members of the wheel group to run the command without a password, and I can run the 'action' as my user and it changes the govenor.   So I know I must not be catching the ACPI event correctly.  But what I am checking for is what is returned by acpi_list.

[root@tux-top acpi]# cat events/batt-in 
# Catch the Battery being plugged in 
# ac_adapter ACPI0003:00 00000080 00000001
event=ac_adapter ACPI0003:00 00000080 00000001
action=/etc/acpi/actions/batt-in.sh
[root@tux-top acpi]# cat actions/batt-in.sh 
#!/bin/bash
sudo /usr/bin/cpufreq-set -r -g ondemand
[root@tux-top acpi]# grep NOPASSWD /etc/sudoers
# %wheel ALL=(ALL) NOPASSWD: ALL
%wheel ALL = NOPASSWD: /usr/sbin/pm-suspend 
%wheel ALL = NOPASSWD: /usr/bin/cpufreq-set 
[root@tux-top acpi]# 

Same type of problems with my volume script.

[justin@tux-top acpi]$ cat events/vol-up 
# Watch for Volume Up
# 
event=button/volumeup VOLUP
action=/etc/acpi/actions/vol-up.sh
[justin@tux-top acpi]$ cat actions/vol-up.sh 
#!/bin/bash
amixer -- sset Master 5%+
[justin@tux-top acpi]$ amixer get Master 
Simple mixer control 'Master',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined penum
  Playback channels: Mono
  Limits: Playback 0 - 39
  Mono: Playback 33 [85%] [-9.00dB] [on]
[justin@tux-top acpi]$ amixer -- sset Master 5%+
Simple mixer control 'Master',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined penum
  Playback channels: Mono
  Limits: Playback 0 - 39
  Mono: Playback 35 [90%] [-6.00dB] [on]

Any help would be great.
Thanks,

Offline

#2 2012-02-27 20:11:54

David Batson
Member
Registered: 2011-10-13
Posts: 640

Re: Thinkpad T61 / ACPID Script Trouble

I believe that arch uses the /etc/acpi/'handler.sh script for this.  Haven't really figured out how to edit that correctly myself.  Note that the ThinkPad acpi events changed not too long ago.  Run acpi_listen (acpitool) to see how they are registered.

https://wiki.archlinux.org/index.php/AC … ring_ACPID

Offline

#3 2012-02-27 23:28:30

axion419
Member
Registered: 2007-04-12
Posts: 185

Re: Thinkpad T61 / ACPID Script Trouble

Those are the events registered from acpi_listen.  The wiki states we can remove the handler.sh script, and define our own events and actions, which is what I am trying to do. 

Thanks,

Offline

Board footer

Powered by FluxBB