# Thinkpad volume buttons don't work; need help tpb setup

## GreenPenInc

I'm trying to get the volume buttons and mute button on my Thinkpad T61 to work.  Been reading around different places, like thinkpad-wiki.  Here's a few links I've been using:

Getting the Special Keys to Work (Thinkwiki)

Tpb page (Thinkwiki)

It seems I need to use tpb in order to get the most out of my thinkpad, so I installed it.  In my tpbrc, I uncommented all of the OSD (on-screen display) lines, and here's the behaviour I get.

If the volume is unmuted (in hardware), pressing mute gives me the OSD correctly telling me it's now muted.  If it's already muted, though, nothing happens.  Same thing for pressing one of the volume buttons: it displays a "mute off" message, along with the volume bar, if it was muted, but further presses (of either volume button) have no effect.

I've figured out how to monitor what I thought was the hardware state of the mixer, by typing 

```
watch cat /proc/acpi/ibm/volume
```

 as root.  It gives me

```

level:          14

mute:           off

commands:       up, down, mute

commands:       level <level> (<level> is 0-15)

```

Pressing mute in this case will turn the 'mute' indicator to 'on', and then pressing a volume button will turn it to 'off'.

Here's another weird thing.  The volume bar OSD used to display a volume level about halfway up.  Now, though, it is all the way down, and nothing I do seems to have any effect on it.  I can change the level which gets displayed in the /proc/... above, by doing things like 

```
echo 'up' > /proc/acpi/ibm/volume
```

.  but the OSD always shows the volume as being all the way down, no matter what.  

I believe the OSD, too, since I can't hear any sounds I play anymore!  Used to be, when the OSD would show something halfway, aplay would play a sound for me to hear.  If I hit 'mute' in the middle of the sound, it would stop being audible, just as one would hope.  So I can change the volume level that the hardware thinks it's at, but I can't seem to change the actual hardware volume level no matter what I try.

Also, I can run tpb in a console to see the output, instead of in daemon mode.  When I do this and press a volume or mute button, no output is given unless it's changing the mute state (i.e. going from muted to unmuted or vice versa).  If there is output, it looks like this:

```

Unable to fork application "/usr/share/doc/tpb-0.6.4/callback.sh".

HINT:

With tpb version 0.6.2 or later you need to specify applications

using the whole path to the executable program.

```

This gets printed every time I press a button which changes the mute state.  I have verified that the path to the script (which is the default script) is correct.

I've given plenty of data here.  Hopefully, someone here who has got this working and has experience will have enough to go on to help me out!

Thanks,

Chip

----------

## smerf

I have T23, so things may work differently, but by default 'Mute' button is 'one-way':

you can turn off sound but to get it back you must press either 'volup' or 'voldown'

I don't know why the latter does not wor wor you, maybe comment out whole

callback thing? What do you need callback for? Post your tpbrc.

----------

## GreenPenInc

 *smerf wrote:*   

> I have T23, so things may work differently, but by default 'Mute' button is 'one-way':
> 
> you can turn off sound but to get it back you must press either 'volup' or 'voldown'
> 
> I don't know why the latter does not wor wor you, maybe comment out whole
> ...

 

Here's my tpbrc:

```

#### TPB CONFIGURATION FILE

### DEVICE SETTINGS

## NVRAM

# Should define the nvram device from where the information about the key

# states is read. Default is to try /dev/nvram, followed by /dev/misc/nvram.

#

#NVRAM       /dev/nvram

## POLLTIME

# Defines the delay between polls in microseconds. Default is 200000.

#

#POLLTIME    200000

### KEYBINDINGS AND CALLBACK

## THINKPAD

# String with command and options that should be executed when ThinkPad

# button is pressed. It is possible to execute any program.

# By default no command is executed.

#

#THINKPAD    /usr/bin/X11/xterm -T ntpctl -e ntpctl

## HOME

# String with command and options that should be executed when Home button is

# pressed (only available on A and S series). By default no command is executed.

#

#HOME        /usr/bin/mozilla 

## SEARCH

# String with command and options that should be executed when Search button is

# pressed (only available on A and S series). By default no command is executed.

#

#SEARCH      /usr/bin/mozilla http://www.google.com

## MAIL

# String with command and options that should be executed when Mail button is

# pressed(only available on A and S series). By default no command is executed.

#

#MAIL        /usr/bin/X11/xterm -T mutt -geometry 140x40 -e mutt

## WIRELESS

# String with command and options that should be executed when Wireless button is

# pressed(only available on A and S series). By default no command is executed.

#

#WIRELESS    /usr/bin/X11/xterm -T wavemon -geometry 140x40 -e wavemon

## FAVORITES

# String with command and options that should be executed when Favorites button is

# pressed (only available on A series). By default no command is executed.

#

#FAVORITES

## RELOAD

# String with command and options that should be executed when Reload button is

# pressed (only available on A series). By default no command is executed.

#

#RELOAD

## ABORT

# String with command and options that should be executed when Abort button is

# pressed (only available on A series). By default no command is executed.

#

#ABORT

## BACKWARD

# String with command and options that should be executed when Backward button is

# pressed (only available on A series). By default no command is executed.

#

#BACKWARD

## FORWARD

# String with command and options that should be executed when Forward button is

# pressed (only available on A series). By default no command is executed.

#

#FORWARD

## FN

# String with command and options that should be executed when Fn button is

# pressed. This is only triggered, when Fn is released again and it was not used for

# a key combination.By default no command is executed.

#

#FN

## CALLBACK

# String with command and options that should be executed each button press and

# state change. tpb passes an identifier as first argument and the new state as

# second argument to the callback. So you can do fancy things :) By default no

# command is executed. Supported identifiers and states are:

#

#  IDENTIFIER        STATES/VALUE            

#  thinkpad          pressed                

#  home              pressed                

#  search            pressed                

#  mail              pressed                

#  favorites         pressed

#  reload            pressed

#  abort             pressed

#  backward          pressed

#  forward           pressed

#  fn                pressed

#  zoom              on, off                

#  thinklight        on, off                

#  display           lcd, crt, both         

#  expand            on, off                

#  brightness        PERCENT                

#  volume            PERCENT                

#  mute              on, off                

#  ac_power          connected, disconnected

#  powermgt_ac       high, auto, manual     

#  powermgt_battery  high, auto, manual     

#

CALLBACK    /usr/share/doc/tpb-0.6.4/callback.sh

### MIXER SETTINGS

## MIXER

# Use OSS mixer to change volume and for mute/unmute. This should be use on

# models with no hardware mixer (volume and mute buttons show no effect). R31

# is reported to have no hardware mixer. To use this you must enable write

# access to the NVRAM device (possibly dangerous). Possible values are on and

# off. Default is off.

#

MIXER      ON

## MIXERSTEPS

# Defines how much steps should be available when using the OSS mixer. Default

# is 14. If an other number of steps is used, tpb needs write access to the

# nvram device.

#

MIXERSTEPS  15

## MIXERDEVICE

# Defines the mixer device to use for OSS mixer support. Default is /dev/mixer.

#

MIXERDEVICE /dev/mixer

### POWERMANAGEMENT SETTINGS

## APM

# Some ThinkPads generate mouse and keyboard events or have a high CPU load when

# polling /proc/apm. You may enable this, if you want the AC connected/AC

# disconnected messages. Default is off.

#

#APM         OFF

## POWERMGT

# The program apmiser (part of tpctl package) switches the power management

# mode according to the needs of the user. This results in lots of changes

# displayed in OSD. To avoid this, the power management messages can be turned

# off. Default is auto.

#

#POWERMGT    AUTO

### X11 SETTINGS

## XEVENTS

# Some of the special keys generate X11 events instead of changing the nvram. TPB

# is able to grab those keys and run an application. However some people like to

# use the X11 events through xmodmap or the like. This option turns off the

# grabbing of the events. Affected keys are HOME, SEARCH, MAIL, FAVORITES,

# RELOAD, ABORT, BACKWARD, FORWARD and FN. Default is on.

#

XEVENTS     OFF

### ON-SCREEN DISPLAY SETTINGS

## OSD

# Global switch for showing on-screen display for volume, mute and brightness.

# Possible values are on and off. Default is on.

#

OSD         ON

## OSDZOOM

# Specific switch for showing on-screen display for zoom button.

# Possible values are on and off. Default is unset, follows the OSD option.

#

#OSDZOOM     OFF

## OSDTHINKLIGHT

# Specific switch for showing on-screen display for thinklight button.

# Possible values are on and off. Default is unset, follows the OSD option.

#

OSDTHINKLIGHT OFF

## OSDDISPLAY

# Specific switch for showing on-screen display for display output button.

# Possible values are on and off. Default is unset, follows the OSD option.

#

OSDDISPLAY OFF

## OSDHVEXPANSIOFF

# Specific switch for showing on-screen display for HV expansion button.

# Possible values are on and off. Default is unset, follows the OSD option.

#

#OSDHVEXPANSION OFF

## OSDBRIGHTNESS

# Specific switch for showing on-screen display for brightness buttons.

# Possible values are on and off. Default is unset, follows the OSD option.

#

OSDBRIGHTNESS ON

## OSDVOLUME

# Specific switch for showing on-screen display for ivolume and mute buttons.

# Possible values are on and off. Default is unset, follows the OSD option.

#

OSDVOLUME ON

## OSDPOWERMGT

# Specific switch for showing on-screen display for ipower management changes.

# Possible values are on and off. Default is unset, follows the OSD option.

#

#OSDPOWERMGT OFF

## OSDFONT

# Defines the font for the on-screen display. You may use "xfontsel" to choose

# one. Default is the default font of the xosd library.

#

OSDFONT     -*-times-*-r-normal-*-24-*-*-*-*-*-*-*

## OSDCOLOR

# Defines the color of the on-screen display. You may use "xcolors" to choose

# one. Default is BLUE.

#

OSDCOLOR    Green

## OSDTIMEOUT

# Defines how long (in seconds) the on-screen display is shown after the last

# keys was pressed. Default is 3.

#

OSDTIMEOUT  1

## OSDOFFSET

# For backward compatibility. Same as OSDVERTICAL.

#

#OSDOFFSET   25

## OSDSHADOW

# Defines the offset of the font shadow in pixels. Default is 2.

#

#OSDSHADOW   2

## OSDSHADOWCOLOR

# Defines the color of the shadow of the on-screen display. You may use

# "xcolors" to choose one. Default is BLACK.

#

#OSDSHADOWCOLOR BLACK

## OSDOUTLINE

# Defines the width of the font outline in pixels. Default is 1.

#

#OSDOUTLINE   1

## OSDOUTLINECOLOR

# Defines the color of the outline of the on-screen display. You may use

# "xcolors" to choose one. Default is BLACK.

#

#OSDOUTLINECOLOR BLACK

## OSDVERTICAL

# Defines the offset from the top or bottom of the screen in pixels. Default is 25.

#

#OSDVERTICAL 25

## OSDHORIZONTAL

# Defines the offset from the left or right of the screen in pixels. Only

# supported by xosd 2.0.0 and above. Default is 25.

#

#OSDHORIZONTAL 25

## OSDPOS

# Defines where the osd is shown. Possible values are top, middle and bottom.

# The value middle is only supported by xosd 2.0.0 and above. Default is bottom.

#

#OSDPOS      BOTTOM

## OSDALIGN

# Defines the alignment of the osd. Possible values are left, center and right.

# Default is left.

#

#OSDALIGN    LEFT

```

However, I've decided that the hardware/tpbrc combo is just not there yet.  My preferred solution is now to write my own on-screen display which is tied to the software, not the hardware, using the xosd library.  Should be pretty fun -- now that I have Linux again I'll relish the opportunity to do some real coding  :Smile: 

By the way, the volume is working now in software.  The hardware interface is still a bit wonky, but as long as it behaves I'm happy with a software (alsa-based) solution for the time being.

----------

## smerf

I'm still wondering, why have you set up callback...

Have you created this script? (really weird location for this)

Maybe you meant example script? (but that one only prints arguments)

BTW: next time please filter your config to strip comments and \n (i.e. sed -e '/^#\|^$/d')

----------

## GreenPenInc

 *smerf wrote:*   

> I'm still wondering, why have you set up callback...
> 
> Have you created this script? (really weird location for this)
> 
> Maybe you meant example script? (but that one only prints arguments)
> ...

 

Hey, that's a handy little one-liner!

I wanted the callback so that I could actually change the volume, instead of just toggling the mute.  Right now, as I verify by doing 'cat /proc/acpi/ibm/volume', the volume buttons don't change the hardware volume level.  I just wanted to use the default callback script to verify that the callback function even worked, which I found it didn't.

Anyway, I'll probably unmerge tpb soon, and when I get a chance I'll start working on a C program using xosd to give me an OSD for the current software volume level.

Thanks for the help, though!

----------

## Mad Merlin

The volume buttons should just work without any fiddling, at least they do on my T60 and T40. I don't have tpb or similar installed, so I don't get an OSD when pressing them, but I don't care about that too much.

----------

## asymptote

 *Mad Merlin wrote:*   

> The volume buttons should just work without any fiddling, at least they do on my T60 and T40. I don't have tpb or similar installed, so I don't get an OSD when pressing them, but I don't care about that too much.

 

Did you do anything special at the installation for your T60?  I keep getting an error that X server fails to initialize or something like that, and then I return to the prompt.

----------

## smerf

As usual: be more specific, post your logs (mainly EE entries are interesting).

Sorry, but "or something like that" is not enough.

----------

## asymptote

Sorry, smerf.  I'm too used to hand-holding Ubuntu and Fedora.  I'll start an installation again and get back to you.  Thanks!

----------

## jmajor1111

i know this is an old post, but make sure to enable the modem in the bios or the sound won't work.  Don't ask, I just know this is a bug or something.

----------

