Thinkpad ACPI and devd

This forum discusses issues related to running FreeBSD on notebooks, laptops, and other mobile equipment.

Thinkpad ACPI and devd

Postby wildtollwut » 15 May 2011, 21:30

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 [FILE]XF86VolumeUp[/FILE] etc.

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

The module is loaded at boot and the event mask is set properly. I have set up [FILE]/etc/devd.conf[/FILE] as follows:
Code: Select all
notify 10 {
  match "system"      "ACPI";
  match "subsystem" "IBM";
  action "/home/me/print.sh $notify";
};


[file]print.sh[/file] is executable and contains:

Code: Select all
echo "$1" >> foo.txt
xbacklight -10


The first line is being executed and the corresponding event is written to [file]foo.txt[/file]. However, the [cmd=]xbacklight -10[/cmd] command is ignored. When omitting the echo line [FILE]xbacklight[/FILE] 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 [FILE]devd[/FILE] or starting it in debug mode without changing anything else at all.

Any ideas? :) Thanks a lot!
wildtollwut
Junior Member
 
Posts: 42
Joined: 14 May 2011, 13:57

Postby wblock@ » 15 May 2011, 22:52

Commands run by [man=8]devd[/man] run as root. Use [man=1]su[/man] to run a command as a specific user. You may also have to set the [file]DISPLAY[/file] environment variable.

Code: Select all
...
action "su wildtollwut -c '/usr/local/bin/xbacklight -10'";
User avatar
wblock@
Old Fart
 
Posts: 10227
Joined: 07 Sep 2009, 23:23
Location: Milky Way galaxy

Postby wildtollwut » 16 May 2011, 19:27

Ah, setting [file]DISPLAY[/file] 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.
wildtollwut
Junior Member
 
Posts: 42
Joined: 14 May 2011, 13:57


Return to Mobile Computing

Who is online

Users browsing this forum: No registered users and 1 guest