# Thinkpad ACPI and devd



## wildtollwut (May 15, 2011)

Hi,

A problem I encountered when configuring FreeBSD 8.2 on my Thinkpad X61 is the configuration of extra keys like volume up/down, mute and backlight up/down. So far, I figured that volume up/down and the various multimedia keys are handled by ACPI/Kernel?/X11? directly since they are available for example in [CMD=]xev[/CMD] as XF86VolumeUp etc. 

Strangely enough, the mute key representation is nowhere to be found but seems to trigger an ACPI event nevertheless (dev.acpi_ibm.0.mute is changed when pressing). Trying to make use of other keys light backlight up, I followed the acpi_ibm documentation closely. 

The module is loaded at boot and the event mask is set properly. I have set up /etc/devd.conf as follows:

```
notify 10 {
  match "system"      "ACPI";
  match "subsystem" "IBM";
  action "/home/me/print.sh $notify";
};
```

print.sh is executable and contains:


```
echo "$1" >> foo.txt
xbacklight -10
```

The first line is being executed and the corresponding event is written to foo.txt. However, the [cmd=]xbacklight -10[/cmd] command is ignored. When omitting the echo line xbacklight is ignored as well. I also tried executing a different shell script (again echoing some string) which works. It only doesn't seem to accept my [cmd=]xbacklight -10[/cmd] :|

And even funnier: it all works when restarting devd or starting it in debug mode without changing anything else at all. 

Any ideas?  Thanks a lot!


----------



## wblock@ (May 15, 2011)

Commands run by devd(8) run as root.  Use su(1) to run a command as a specific user.  You may also have to set the DISPLAY environment variable.


```
...
action "su wildtollwut -c '/usr/local/bin/xbacklight -10'";
```


----------



## wildtollwut (May 16, 2011)

Ah, setting DISPLAY fixed it. Thanks!
Now if I only could get some event from the mute button, but I think this is a driver or hardware issue.


----------

