=== modified file 'plugins/media-keys/actions/Makefile.am'
--- gnome-settings-daemon-2.22.old/plugins/media-keys/actions/Makefile.am	2008-03-21 18:17:11 +0000
+++ gnome-settings-daemon-2.22.new/plugins/media-keys/actions/Makefile.am	2008-04-01 01:39:05 +0000
@@ -8,6 +8,8 @@ libacme_la_SOURCES = 		\
 	acme-volume.h 		\
 	acme-volume-dummy.c 	\
 	acme-volume-dummy.h	\
+	acme-volume-thinkpad.c	\
+	acme-volume-thinkpad.h	\
 	$(NULL)
 
 libacme_la_CPPFLAGS = \

=== added file 'plugins/media-keys/actions/acme-volume-thinkpad.c'
--- gnome-settings-daemon-2.22.old/plugins/media-keys/actions/acme-volume-thinkpad.c	1970-01-01 00:00:00 +0000
+++ gnome-settings-daemon-2.22.new/plugins/media-keys/actions/acme-volume-thinkpad.c	2008-04-01 01:39:05 +0000
@@ -0,0 +1,118 @@
+/* acme-volume-thinkpad.c
+   
+   Adds Thinkpad speaker volume reading.
+
+   The Gnome Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The Gnome Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the Gnome Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+
+   By Lorne Applebaum <4lorne@gmail.com>
+*/
+
+#include "config.h"
+#include "acme-volume-thinkpad.h"
+#include <stdio.h>
+
+static GObjectClass *parent_class = NULL;
+
+G_DEFINE_TYPE (AcmeVolumeThinkpad, acme_volume_thinkpad, ACME_TYPE_VOLUME)
+
+/* Parses the ACPI data found at /proc/acpi/ibm/volume.  It typically
+ looks like
+
+level:		3
+mute:		off
+commands:	up, down, mute
+commands:	level <level> (<level> is 0-15)
+
+
+The ibm-acpi kernel driver is required */
+static gboolean
+acme_volume_thinkpad_parse_acpi (int *level, gboolean *mute_status)
+{
+	FILE *fd;
+	char mute_string [4];
+
+	fd = fopen (ACME_VOLUME_THINKPAD_ACPI_PATH, "r");
+	if (fd == 0)
+		return FALSE;
+
+
+	if (fscanf (fd, "level:  %d  mute: %3s", level, mute_string) != 2)
+	{
+		fclose (fd);
+		return FALSE;
+	}
+
+	*mute_status = strcmp (mute_string, "off");
+  
+	fclose(fd);
+	return TRUE;
+}
+
+static void
+acme_volume_thinkpad_set_mute (AcmeVolume *vol, gboolean val)
+{
+	/* No need to set anything.  Hardware takes care of it. */
+}
+
+static gboolean
+acme_volume_thinkpad_get_mute (AcmeVolume *vol)
+{
+	int volume;
+	gboolean mute;
+	if (acme_volume_thinkpad_parse_acpi (&volume, &mute))
+		return mute;
+	return FALSE;
+}
+
+static int
+acme_volume_thinkpad_get_volume (AcmeVolume *vol)
+{
+	int volume;
+	gboolean mute;
+	if (acme_volume_thinkpad_parse_acpi (&volume, &mute))
+	{
+		/* Convert to a volume between 0 and 100.  The ibm-acpi
+		   driver output a value between 0 and 15 */
+		return CLAMP (volume*7, 0, 100);
+	}
+	else
+		return -1;
+}
+
+static void
+acme_volume_thinkpad_set_volume (AcmeVolume *vol, int val)
+{
+	/* No need to set anything.  Hardware takes care of it. */
+}
+
+static void
+acme_volume_thinkpad_init (AcmeVolumeThinkpad *self)
+{
+}
+
+static void
+acme_volume_thinkpad_class_init (AcmeVolumeThinkpadClass *klass)
+{
+	AcmeVolumeClass *volume_class = ACME_VOLUME_CLASS (klass);
+	G_OBJECT_CLASS (klass)->finalize = NULL;
+
+	parent_class = g_type_class_peek_parent (klass);
+
+	volume_class->set_volume = acme_volume_thinkpad_set_volume;
+	volume_class->get_volume = acme_volume_thinkpad_get_volume;
+	volume_class->set_mute = acme_volume_thinkpad_set_mute;
+	volume_class->get_mute = acme_volume_thinkpad_get_mute;
+}

=== added file 'plugins/media-keys/actions/acme-volume-thinkpad.h'
--- gnome-settings-daemon-2.22.old/plugins/media-keys/actions/acme-volume-thinkpad.h	1970-01-01 00:00:00 +0000
+++ gnome-settings-daemon-2.22.new/plugins/media-keys/actions/acme-volume-thinkpad.h	2008-04-01 02:02:12 +0000
@@ -0,0 +1,48 @@
+ /* acme-volume-thinkpad.h
+
+   Adds Thinkpad speaker volume support.
+
+   The Gnome Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The Gnome Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the Gnome Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+   
+   By Lorne Applebaum <4lorne@gmail.com>
+
+ */
+
+#include <glib.h>
+#include <glib-object.h>
+#include "acme-volume.h"
+
+#define ACME_TYPE_VOLUME_THINKPAD	(acme_volume_get_type ())
+#define ACME_VOLUME_THINKPAD(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), ACME_TYPE_VOLUME_THINKPAD, AcmeVolumeThinkpad))
+#define ACME_VOLUME_THINKPAD_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST ((klass), ACME_TYPE_VOLUME_THINKPAD, AcmeVolumeThinkpadClass))
+#define ACME_IS_VOLUME_THINKPAD(obj)	(G_TYPE_CHECK_INSTANCE_TYPE ((obj), ACME_TYPE_VOLUME_THINKPAD))
+#define ACME_VOLUME_THINKPAD_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS ((obj), ACME_TYPE_VOLUME_THINKPAD, AcmeVolumeThinkpadClass))
+
+typedef struct AcmeVolumeThinkpad AcmeVolumeThinkpad;
+typedef struct AcmeVolumeThinkpadClass AcmeVolumeThinkpadClass;
+
+struct AcmeVolumeThinkpad {
+	AcmeVolume parent;
+};
+
+struct AcmeVolumeThinkpadClass {
+	AcmeVolumeClass parent;
+};
+
+GType acme_volume_thinkpad_get_type		(void);
+AcmeVolume* acme_volume_thinkpad_new		(void);
+
+#define ACME_VOLUME_THINKPAD_ACPI_PATH          "/proc/acpi/ibm/volume"

=== modified file 'plugins/media-keys/actions/acme-volume.c'
--- gnome-settings-daemon-2.22.old/plugins/media-keys/actions/acme-volume.c	2008-03-21 18:17:11 +0000
+++ gnome-settings-daemon-2.22.new/plugins/media-keys/actions/acme-volume.c	2008-04-01 02:16:50 +0000
@@ -31,7 +31,9 @@
 #ifdef HAVE_GSTREAMER
 #include "acme-volume-gstreamer.h"
 #endif
-#include "acme-volume-dummy.h"
+#ifdef ENABLE_IBM_THINKPAD
+#include "acme-volume-thinkpad.h"
+#endif
 
 static GObjectClass *parent_class = NULL;
 
@@ -85,7 +87,7 @@ acme_volume_set_mute (AcmeVolume *self, 
 }
 
 void
-acme_volume_mute_toggle (AcmeVolume * self)
+acme_volume_mute_toggle (AcmeVolume *self)
 {
 	gboolean muted;
 
@@ -99,7 +101,20 @@ acme_volume_mute_toggle (AcmeVolume * se
 AcmeVolume *acme_volume_new (void)
 {
 	AcmeVolume *vol;
-
+	
+#ifdef ENABLE_IBM_THINKPAD
+	/* Check if we should be doing ThinkPad speaker volume handling
+	   rather than the software stuff.  Checking for the existance
+	   of /proc/acpi/ibm/volume put in place by the ibm-acpi
+	   kernel driver */
+
+	if (g_file_test (ACME_VOLUME_THINKPAD_ACPI_PATH, G_FILE_TEST_IS_REGULAR))
+	{
+		vol = ACME_VOLUME (g_object_new (acme_volume_thinkpad_get_type (), NULL));
+		return vol;
+	}
+#endif
+	
 #ifdef HAVE_GSTREAMER
 	vol = ACME_VOLUME (g_object_new (acme_volume_gstreamer_get_type (), NULL));
 	return vol;

