# HG changeset patch # User chainsaw # Date 1165112234 28800 # Node ID f3f77cbd58f320330511962930243e281d5fb951 # Parent 90a843d02970479222cb5995a3fda3e1913b129e [svn] Add support for Apple PMU front LED to Rocklight. Tested on PowerBook 5,9; works but is rather slow to update. diff -r 90a843d02970 -r f3f77cbd58f3 ChangeLog --- a/ChangeLog Sat Dec 02 14:43:27 2006 -0800 +++ b/ChangeLog Sat Dec 02 18:17:14 2006 -0800 @@ -1,3 +1,12 @@ +2006-12-02 22:43:27 +0000 William Pitcock + revision [716] + - some OSes use macros for some f*() functions, therefore make sure we + properly cast our opaque data to a FILE* struct. + + trunk/src/stdio/stdio.c | 57 ++++++++++++++++++++++++++++++++++++++---------- + 1 file changed, 46 insertions(+), 11 deletions(-) + + 2006-12-01 08:03:10 +0000 William Pitcock revision [714] - disable the playlist when loading = false. diff -r 90a843d02970 -r f3f77cbd58f3 configure.ac --- a/configure.ac Sat Dec 02 14:43:27 2006 -0800 +++ b/configure.ac Sat Dec 02 18:17:14 2006 -0800 @@ -341,9 +341,13 @@ AC_SUBST(LIBNMS_SRC) fi -dnl *** ThinkLight support +dnl *** Rocklight -AC_CHECK_FILE([/proc/acpi/ibm/light], [VISUALIZATION_PLUGINS="$VISUALIZATION_PLUGINS rocklight"]) +AC_CHECK_FILE([/proc/acpi/ibm/light], [VISUALIZATION_PLUGINS="$VISUALIZATION_PLUGINS rocklight" + LEDCODE=thinklight.c]) +AC_CHECK_FILE([/sys/class/leds/pmu-front-led/brightness], [VISUALIZATION_PLUGINS="$VISUALIZATION_PLUGINS rocklight" + LEDCODE=apple_pmu.c]) +AC_SUBST(LEDCODE) dnl *** LIRC client libraries diff -r 90a843d02970 -r f3f77cbd58f3 mk/rules.mk.in --- a/mk/rules.mk.in Sat Dec 02 14:43:27 2006 -0800 +++ b/mk/rules.mk.in Sat Dec 02 18:17:14 2006 -0800 @@ -194,6 +194,7 @@ JACK_CFLAGS ?= @JACK_CFLAGS@ JACK_LIBS ?= @JACK_LIBS@ LDFLAGS ?= @LDFLAGS@ +LEDCODE ?= @LEDCODE@ LIBBEEP_MAJOR_VERSION ?= @LIBBEEP_MAJOR_VERSION@ LIBBEEP_MICRO_VERSION ?= @LIBBEEP_MICRO_VERSION@ LIBBEEP_MINOR_VERSION ?= @LIBBEEP_MINOR_VERSION@ diff -r 90a843d02970 -r f3f77cbd58f3 src/rocklight/Makefile --- a/src/rocklight/Makefile Sat Dec 02 14:43:27 2006 -0800 +++ b/src/rocklight/Makefile Sat Dec 02 18:17:14 2006 -0800 @@ -7,7 +7,7 @@ LIBADD = $(GTK_LIBS) -SOURCES = rocklight.c thinklight.c +SOURCES = rocklight.c $(LEDCODE) OBJECTS = ${SOURCES:.c=.o} diff -r 90a843d02970 -r f3f77cbd58f3 src/rocklight/apple_pmu.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/rocklight/apple_pmu.c Sat Dec 02 18:17:14 2006 -0800 @@ -0,0 +1,50 @@ +/*************************************************************************** + * apple_pmu.c + * + * Sun Dec 03 01:07:42 2006 + * Copyright 2006 Tony 'Chainsaw' Vroon + * chainsaw@gentoo.org + ****************************************************************************/ + +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include +#include +#include +#include + +int thinklight_open(void) { + return open("/sys/class/leds/pmu-front-led/brightness",O_RDWR); +} + +void thinklight_close(int fd) { + close(fd); +} + +int thinklight_set(int fd, int state) { + return write(fd,state?"255\n":"0\n",state?2:4); +} + +int thinklight_get(int fd) { + char buf[256]; + int ret=read(fd,&buf,sizeof(buf)); + + if(atoi(buf) == 255) + return 1; + else + return 0; +}