ThinkPad X61s functions keys

Ian Smith smithi at nimnet.asn.au
Sun Mar 30 04:39:14 PDT 2008


On Sat, 29 Mar 2008, Dan Langille wrote:
 > Ian Smith wrote:
 > > On Sat, 29 Mar 2008, Dan Langille wrote:
 > >  > Alberto Rizzi wrote:
 > >  > > Dan Langille ha scritto:
 > >  > >> Hi,
 > >  > >>
 > >  > >> Running FreeBSD 7.0-RELEASE on a ThinkPad X61s.
 > >  > >>
 > >  > >> Some keys do not work:
 > >  > >>
 > >  > >> - volume adjustment
 > >  > >> - screen brightness (FN HOME, FN END)
 > >  > >>
 > >  > >> The keyboard light does work (FN-PgUp) as does
 > >  > >> Numeric Lock (FN ScrLk).
 > >  > >>
 > >  > >> What can I do to help diagnose the issue so we can get these
 > >  > >> functions working?
 > >  > >>
 > >  > > Have the same problem with a Thinkpad T61
 > >  > > If you read man acpi_ibm there is a partial solution
 > >  > > 
 > >  > > You have to load acpi_ibm at boot. Add
 > >  > > acpi_ibm_load="YES"
 > >  > > to /boot/loader.conf
 > >  > 
 > >  > $ kldstat
 > >  > Id Refs Address            Size     Name
 > >  >   1   10 0xffffffff80100000 ac6c08   kernel
 > >  >   2    1 0xffffffff80bc7000 1a670    snd_hda.ko
 > >  >   3    2 0xffffffff80be2000 673b8    sound.ko
 > >  >   4    1 0xffffffff80c4a000 53d0     acpi_ibm.ko
 > >  >   5    1 0xffffffffb1694000 4b61     i915.ko
 > >  >   6    1 0xffffffffb1699000 d5d8     drm.ko
 > >  > 
 > >  > 
 > >  > > Then activate event passing to devd. Add
 > >  > > dev.acpi_ibm.0.events=1
 > >  > > to /etc/sysctl.conf
 > >  > 
 > >  > $ sysctl dev.acpi_ibm.0.events
 > >  > dev.acpi_ibm.0.events: 1
 > > 
 > > Does needs to be 1, but your loop script below shows it set (reverted?) 
 > > to 0, so devd events would not be invoked.
 > > 
 > >  > > Then tell devd that you want to get events. Add
 > >  > > notify 10 {
 > >  > >     match "system"        "ACPI";
 > >  > >     match "subsystem"     "IBM";
 > >  > >     action "/usr/local/sbin/acpi_oem_exec.sh $notify ibm";
 > >  > 
 > >  > It seems that this script is never invoked.
 > > 
 > > Not without having dev.acpi_ibm.0.events=1 anyway.
 > 
 > Good catch.  Thank you.  It is 1.  The copy/paste was done outside my 
 > testing.  Despite the /etc/sysctl.conf entry, I must set this value 
 > manually as it is always zero after boot.

Seems odd if setting dev.acpi_ibm.0.events=1 in /etc/sysctl.conf doesn't
show up after boot?  Could something(?) be resetting it to 0 afterwards?

 > > Suggest also checking Beto's examples which might help you debug it:
 > > 
 > > http://lists.freebsd.org/mailman/htdig/freebsd-mobile/2006-August/008959.html
 > > 
 > > http://lists.freebsd.org/pipermail/freebsd-mobile/2006-August/008948.html
 > 
 > I'll have a look there.  Thank you.
 > 
 > > and which I notice executes scripts like:
 > >       action "/bin/sh -c /home/betom/bin/do_acpi_suspend.sh";
 > > 
 > > which might help if your script wasn't set executable?  and uses
 > > /usr/local/etc/devd for devd conf files, as an alternative. 
 > 
 > It is chmod +x:
 > 
 > $ ls -l /usr/local/sbin/acpi_oem_exec.sh
 > -rwxr-xr-x  1 root  wheel  640 Mar 28 22:44 /usr/local/sbin/acpi_oem_exec.sh

I'm really clutching at straws then, but a) do you need to restart devd
after (ever) updating devd.conf? and b) could you start off the invoked
script with say '/bin/echo "$PATH $*" >> /tmp/something' to be sure it's
not a script or path problem, like you might see with a cron script?

Do you use the script shown below, or one handling all ACPI/IBM events?

And did you try (presumably after an '/etc/rc.d/devd stop') running
'devd -dD' in foreground, to see what notifies various keys generate,
which may be somewhat different from earlier model thinkpads?

Cheers, Ian

 > > 
 > > HTH, Ian
 > > 
 > > 
 > >  > > }
 > >  > > 
 > >  > > to /etc/devd.conf
 > >  > > 
 > >  > > Now you have to create that script
 > >  > > ----------
 > >  > > #!/bin/sh
 > >  > > NOTIFY=`echo $1`
 > >  > > ECHO="echo"
 > >  > > CALC="bc"
 > >  > > 
 > >  > > case ${NOTIFY} in
 > >  > >     0x10)
 > >  > >         LEVEL=`sysctl -n dev.acpi_ibm.0.lcd_brightness`
 > >  > >         PERCENT=`${ECHO} "${LEVEL} + 1" | ${CALC}`
 > >  > >         MESSAGE="brightness level ${PERCENT}"
 > >  > >         sysctl dev.acpi_ibm.0.lcd_brightness=${PERCENT}
 > >  > >         ;;
 > >  > >     0x11)
 > >  > >         LEVEL=`sysctl -n dev.acpi_ibm.0.lcd_brightness`
 > >  > >         PERCENT=`${ECHO} "${LEVEL} - 1" | ${CALC}`
 > >  > >         MESSAGE="brightness level ${PERCENT}"
 > >  > >         sysctl dev.acpi_ibm.0.lcd_brightness=${PERCENT}
 > >  > >         ;;
 > >  > >     *)
 > >  > >         ;;
 > >  > > esac
 > >  > > echo `date` >> /tmp/prova
 > >  > > ${ECHO} ${LEVEL} ${NOTIFY} ${MESSAGE} >> /tmp/prova
 > >  > > exit 0   
 > >  > > 
 > >  > > -------
 > >  > > If you leave the last two debug line, with a tail -f /tmp/prova you can 
 > >  > > check the events sent to devd.
 > >  > 
 > >  > Nothing hits /tmp/prova
 > >  > 
 > >  > I ran this loop while pressing keys:
 > >  > 
 > >  > while true; do clear; sysctl dev.acpi_ibm.0; date; sleep 1; done
 > >  > 
 > >  > dev.acpi_ibm.0.%desc: IBM ThinkPad ACPI Extras
 > >  > dev.acpi_ibm.0.%driver: acpi_ibm
 > >  > dev.acpi_ibm.0.%location: handle=\_SB_.PCI0.LPC_.EC__.HKEY
 > >  > dev.acpi_ibm.0.%pnpinfo: _HID=IBM0068 _UID=0
 > >  > dev.acpi_ibm.0.%parent: acpi0
 > >  > dev.acpi_ibm.0.initialmask: 2060
 > >  > dev.acpi_ibm.0.availmask: 16777215
 > >  > dev.acpi_ibm.0.events: 0
 > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 > 
 > An unfortunate paste. I assure you, it is 1.
 > 
 > >  > dev.acpi_ibm.0.eventmask: 2060
 > >  > dev.acpi_ibm.0.hotkey: 3491
 > >  > dev.acpi_ibm.0.lcd_brightness: 0
 > >  > dev.acpi_ibm.0.volume: 7
 > >  > dev.acpi_ibm.0.mute: 0
 > >  > dev.acpi_ibm.0.thinklight: 0
 > >  > dev.acpi_ibm.0.bluetooth: 0
 > >  > dev.acpi_ibm.0.wlan: 1
 > >  > dev.acpi_ibm.0.fan_speed: 3815
 > >  > dev.acpi_ibm.0.fan_level: 0
 > >  > dev.acpi_ibm.0.fan: 1
 > >  > dev.acpi_ibm.0.thermal: 41 47 47 38 33 -1 30 -1
 > >  > Sat Mar 29 09:30:09 EDT 2008
 > >  > 
 > >  > 
 > >  > I can get dev.acpi_ibm.0.thinklight to change when turning off/on the think 
 > >  > light.
 > >  > 
 > >  > I can get dev.acpi_ibm.0.hotkey to change between two values: 2467 and 3491
 > >  > 
 > >  > That's it.  Nothing else.
 > >  > 
 > >  > > With this script you can change the brightness both under console and 
 > >  > > under xorg but you are bound to 8 levels (0 - 7)
 > >  > > If you want 100 levels you can use xbacklight under xorg only and modify 
 > >  > > the script to use xbacklight instead of sysctl
 > >  > > 
 > >  > > Mute and volume keys don't send events to devd: I don't know why but if 
 > >  > > I press mute it works and dev.acpi_ibm.0.mute becomes 1
 > >  > > If I press volume up or down, dev.acpi_ibm.0.mute becomes 0



More information about the freebsd-mobile mailing list