Jump to content

Thinkpad T61 volume keys and KDE


coverup
 Share

Recommended Posts

I would like to define global KDE shortcuts associated with ThinkPad volume keys. Apparently, unlike previous thinkpads, in T61 volume is software controlled. The volume up and volume down keys generate keycodes 176 (Up) and 174 (Down), so it should be possible to use them as any other keyboard keys.

 

PS: The trick to get the mute button to work on T61 is to use kernel option "acpi_osi=!Linux" . The exclamation mark is not a typo, it should be there :D

Link to comment
Share on other sites

You can install

tpb (tinkpadbuttons)

and edit the file /etc/tpbrc and you can use all the thinkpad buttons. I have a R31 and it works perfectly.

You need to give

nvram

in /dev read/write acces for the user.

Make also a new group called

nvram

with no users, otherwise you got a error while booting.

Link to comment
Share on other sites

Here is my TPBRC, the lines that are uncommend are for my 4 buttons of my R31.

I have four buttons: thinkpad, volume up-down, and mute

#### 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		  /usr/bin/mozilla-firefox				
#  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/callback_example.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  20

## 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
APM	on

## 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 OFF

## 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 OFF

## 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	 -*-Nimbus Sans L-*-*-*-*-*-240-*-*-*-*-*-*
#OSDFONT	 -adobe-helvetica-bold-r-normal-*-*-240-*-*-p-*-iso8859-15

## OSDCOLOR
# Defines the color of the on-screen display. You may use "xcolors" to choose
# one. Default is BLUE.
#
#OSDCOLOR	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  3

## OSDOFFSET
# For backward compatibility. Same as OSDVERTICAL.
#
#OSDOFFSET   25

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

## 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
OSDPOS	  middle

## OSDALIGN
# Defines the alignment of the osd. Possible values are left, center and right.
# Default is left.
#
#OSDALIGN	LEFT
OSDALIGN	center

Link to comment
Share on other sites

Thanks hips. Will try it sometime.

 

Meantime I have found a different solution using xmodmap. I mapped volume keycodes to XF86Audio events. After that, I was able to use the latter to define global shortcuts in Kmix. The drawback of this solution is that I have to have kmix in the system tray for this to work. Also, the volume changes in uneven steps, sometimes 5%, sometimes 10% or 12% at a time. Also, kmilo does not show anything on the screen. On the bright side this way I can also use Fn+Arrowkeys to control playback in Rhythmbox (and probably in Kaffeine too, but I will need to redefine the kaffeine shortcuts).

 

Amaizingly, now I have all important keys working in Mandriva, and it took only few weeks! What an achievement :jester: , given that in Ubuntu they worked out of the box!

Link to comment
Share on other sites

Have you give NVRAM read/write permisions voor user.

In /etc/security/console.perms.d (for 2006 it is /etc/security/console.perms) you find a file called 50-mandriva.perms there you find a line

<console>  0400 <misc>	   0600 root

change that line in

<console>  0600 <misc>	   0660 root.nvram

make sure you have a group called nvram (no users neccessary) This is the only way to give NVRAM permanend the neccessary rights (chmod 660 /dev/nvram doesn't make the permissions permanent).

 

If that does'nt work change 0600 also in 0660.

Edited by willie
Link to comment
Share on other sites

I changed /dev/nvram permissions after I boot into X, from x terminal running as user /chmod a+rwx /dev/nvram. After logout/login, I could see tpb's green OSD when pressing the brightness keys, but volume buttons did not work.

 

I wonder if kmilo could interfere with tpb? I was trying to get rid of this junk but urpmi wanted to uninstall a whole lot of kde utils with it (those I need), so I left it in peace.

Link to comment
Share on other sites

I changed /dev/nvram permissions after I boot into X, from x terminal running as user /chmod a+rwx /dev/nvram.

You must change the permisions in

/etc/security/console.perms.d/50-mandriva.perms (for 2006 it is /etc/security/console.perms)

As i mentioned before.

With "chmod" the permissions in /dev will be set back to standaard after restart

Edited by willie
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...