1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Thinkpad ACPI and devd

Discussion in 'Mobile Computing' started by wildtollwut, May 15, 2011.

  1. wildtollwut

    wildtollwut New Member

    Messages:
    49
    Likes Received:
    0
    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 xev 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:
    Code:
    notify 10 {
      match "system"      "ACPI";
      match "subsystem" "IBM";
      action "/home/me/print.sh $notify";
    };
    
    print.sh is executable and contains:

    Code:
    echo "$1" >> foo.txt
    xbacklight -10
    
    The first line is being executed and the corresponding event is written to foo.txt. However, the xbacklight -10 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 xbacklight -10 :|

    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!
     
  2. wblock@

    wblock@ Administrator Staff Member Administrator Moderator Developer

    Messages:
    11,200
    Likes Received:
    14
    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.

    Code:
    ...
    action "su wildtollwut -c '/usr/local/bin/xbacklight -10'";
    
     
  3. wildtollwut

    wildtollwut New Member

    Messages:
    49
    Likes Received:
    0
    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.