mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-26 05:02:18 +00:00
Add tpb 0.6.3, An On-Screen-Display for hotkeys of IBM ThinkPads and the first
consumer of the updated acpi_ibm(4) driver: With TPB it is possible to bind a program to the ThinkPad, Mail, Home and Search button. TPB can also run a callback program on each state change with the changed state and the new state as options. So it is possible to trigger several actions on different events. TPB has an on-screen display (OSD) to show volume, mute, brightness and some other information. Furthermore TPB supports a software mixer, as the R series ThinkPads have no hardware mixer to change the volume. WWW: http://www.nongnu.org/tpb/
This commit is contained in:
parent
e1c5ff855d
commit
cb49cc5d83
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=137129
@ -133,6 +133,7 @@
|
||||
SUBDIR += teapot
|
||||
SUBDIR += timer-applet
|
||||
SUBDIR += tomboy
|
||||
SUBDIR += tpb
|
||||
SUBDIR += treeline
|
||||
SUBDIR += tuxcards
|
||||
SUBDIR += vym
|
||||
|
58
deskutils/tpb/Makefile
Normal file
58
deskutils/tpb/Makefile
Normal file
@ -0,0 +1,58 @@
|
||||
# New ports collection makefile for: tpb
|
||||
# Date created: Fri Jun 10 00:38:03 CEST 2005
|
||||
# Whom: Markus Brueffer <markus@FreeBSD.org>
|
||||
#
|
||||
# $FreeBSD$
|
||||
|
||||
PORTNAME= tpb
|
||||
PORTVERSION= 0.6.3
|
||||
CATEGORIES= deskutils
|
||||
MASTER_SITES= ${MASTER_SITE_SAVANNAH}
|
||||
MASTER_SITE_SUBDIR= ${PORTNAME}
|
||||
|
||||
MAINTAINER= markus@FreeBSD.org
|
||||
COMMENT= On-Screen-Display for hotkeys of IBM ThinkPads
|
||||
|
||||
LIB_DEPENDS= xosd.4:${PORTSDIR}/misc/xosd
|
||||
|
||||
ONLY_FOR_ARCHS= i386 amd64
|
||||
|
||||
USE_GMAKE= yes
|
||||
GNU_CONFIGURE= yes
|
||||
USE_REINPLACE= yes
|
||||
USE_ICONV= yes
|
||||
USE_BISON= yes
|
||||
USE_REINPLACE= yes
|
||||
|
||||
CONFIGURE_TARGET= --build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
|
||||
CONFIGURE_ARGS= --with-libiconv-prefix=${LOCALBASE}
|
||||
|
||||
MAN1= tpb.1
|
||||
|
||||
.ifndef(WITHOUT_NLS)
|
||||
USE_GETTEXT= yes
|
||||
PLIST_SUB+= NLS=""
|
||||
.else
|
||||
CONFIGURE_ARGS+=--disable-nls
|
||||
PLIST_SUB+= NLS="@comment "
|
||||
.endif
|
||||
|
||||
post-patch:
|
||||
@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \
|
||||
${WRKSRC}/src/cfg.h \
|
||||
${WRKSRC}/man/tpb.1
|
||||
|
||||
post-install:
|
||||
${INSTALL_DATA} ${WRKSRC}/doc/tpbrc ${PREFIX}/etc/tpbrc.default
|
||||
.ifndef(NOPORTDOCS)
|
||||
${MKDIR} ${DOCSDIR}
|
||||
${INSTALL_SCRIPT} ${WRKSRC}/doc/callback_example.sh ${DOCSDIR}
|
||||
.endif
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
.if ${OSVERSION} < 600030
|
||||
IGNORE=is not supported on FreeBSD < 6.0
|
||||
.endif
|
||||
|
||||
.include <bsd.port.post.mk>
|
2
deskutils/tpb/distinfo
Normal file
2
deskutils/tpb/distinfo
Normal file
@ -0,0 +1,2 @@
|
||||
MD5 (tpb-0.6.3.tar.gz) = fc11a0af992178e4013fd9c041dbaa7e
|
||||
SIZE (tpb-0.6.3.tar.gz) = 277058
|
11
deskutils/tpb/files/patch-Makefile.in
Normal file
11
deskutils/tpb/files/patch-Makefile.in
Normal file
@ -0,0 +1,11 @@
|
||||
--- Makefile.in.orig Thu Jun 9 01:19:36 2005
|
||||
+++ Makefile.in Thu Jun 9 01:19:52 2005
|
||||
@@ -92,7 +92,7 @@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
|
||||
-SUBDIRS = doc intl po src man
|
||||
+SUBDIRS = intl po src man
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = config.h
|
43
deskutils/tpb/files/patch-man-tpb.1
Normal file
43
deskutils/tpb/files/patch-man-tpb.1
Normal file
@ -0,0 +1,43 @@
|
||||
--- man/tpb.1.orig Mon Aug 23 13:01:45 2004
|
||||
+++ man/tpb.1 Thu Jun 9 23:49:03 2005
|
||||
@@ -7,7 +7,7 @@
|
||||
With TPB it is possible to bind a program to the ThinkPad, Mail, Home and Search button.
|
||||
TPB can also run a callback program on each state change with the changed state and the new state as options.
|
||||
So it is possible to trigger several actions on different events.
|
||||
-TPB has a on-screen display (OSD) to show volume, mute, brightness and some other informations.
|
||||
+TPB has an on-screen display (OSD) to show volume, mute, brightness and some other information.
|
||||
Furthermore TPB supports a software mixer, as the R series ThinkPads have no hardware mixer to change the volume.
|
||||
.SH OPTIONS
|
||||
.TP 8
|
||||
@@ -86,7 +86,7 @@
|
||||
builtin defaults
|
||||
.TP
|
||||
\(bu
|
||||
-configuration in /etc/tpbrc
|
||||
+configuration in %%PREFIX%%/etc/tpbrc
|
||||
.TP
|
||||
\(bu
|
||||
configuration in $HOME/.tpbrc
|
||||
@@ -112,7 +112,8 @@
|
||||
.TP 8
|
||||
.B 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.
|
||||
+is read. Default is to try /dev/nvram, followed by /dev/misc/nvram. This has no
|
||||
+effect on FreeBSD, since it uses the acpi_ibm(4) driver instead.
|
||||
.TP 8
|
||||
.B POLLTIME
|
||||
Defines the delay between polls in microseconds. Default is 200000.
|
||||
@@ -266,9 +267,11 @@
|
||||
.B OSDALIGN
|
||||
Defines the alignment of the osd. Possible values are left, center and right. Default is left.
|
||||
.SH "NOTES"
|
||||
-Requires NVRAM device /dev/nvram. This must be enabled in your kernel.
|
||||
+Requires NVRAM device /dev/nvram on Linux. This must be enabled in your kernel.
|
||||
Although the device file must exist. The device file could be created with
|
||||
\'mknod /dev/nvram c 10 144\'
|
||||
+
|
||||
+On FreeBSD you have to load the acpi_ibm(4) driver prior to using TPB.
|
||||
|
||||
This program was developed on a Thinkpad Model T21. I don't know if it works on
|
||||
other models.
|
11
deskutils/tpb/files/patch-src-Makefile.in
Normal file
11
deskutils/tpb/files/patch-src-Makefile.in
Normal file
@ -0,0 +1,11 @@
|
||||
--- src/Makefile.in.orig Thu Jun 9 00:42:42 2005
|
||||
+++ src/Makefile.in Thu Jun 9 00:45:44 2005
|
||||
@@ -106,7 +106,7 @@
|
||||
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
-LIBS = @LIBS@
|
||||
+LIBS = @LIBS@ $(INTLLIBS)
|
||||
X_CFLAGS = @X_CFLAGS@
|
||||
X_LIBS = @X_LIBS@
|
||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
11
deskutils/tpb/files/patch-src-cfg.h
Normal file
11
deskutils/tpb/files/patch-src-cfg.h
Normal file
@ -0,0 +1,11 @@
|
||||
--- src/cfg.h.orig Mon May 30 00:06:16 2005
|
||||
+++ src/cfg.h Mon May 30 00:06:32 2005
|
||||
@@ -67,7 +67,7 @@
|
||||
#ifdef SYSCONFDIR
|
||||
#define GLOBAL_CONFIG_FILE SYSCONFDIR "/tpbrc"
|
||||
#else /* SYSCONFDIR */
|
||||
-#define GLOBAL_CONFIG_FILE "/etc/tpbrc"
|
||||
+#define GLOBAL_CONFIG_FILE "%%PREFIX%%/etc/tpbrc"
|
||||
#endif /* SYSCONFDIR */
|
||||
#define PRIVATE_CONFIG_FILE ".tpbrc"
|
||||
|
121
deskutils/tpb/files/patch-src-tpb.c
Normal file
121
deskutils/tpb/files/patch-src-tpb.c
Normal file
@ -0,0 +1,121 @@
|
||||
--- src/tpb.c.orig Sun Aug 22 15:45:11 2004
|
||||
+++ src/tpb.c Fri Jun 10 00:11:56 2005
|
||||
@@ -34,6 +34,10 @@
|
||||
#include <unistd.h>
|
||||
#include "config.h"
|
||||
|
||||
+#ifdef __FreeBSD__
|
||||
+#include <sys/sysctl.h>
|
||||
+#endif
|
||||
+
|
||||
#if ENABLE_NLS
|
||||
#include <libintl.h>
|
||||
#endif /* ENABLE_NLS */
|
||||
@@ -163,6 +167,9 @@
|
||||
/* to initialize struct */
|
||||
memset(&last_thinkpad_state, 0x00, sizeof(t_thinkpad_state));
|
||||
if(get_nvram_state(&thinkpad_state) != 0) {
|
||||
+#ifdef __FreeBSD__
|
||||
+ fprintf(stderr, _("acpi_ibm(4) driver not loaded. Exiting..."));
|
||||
+#endif
|
||||
_exit(1);
|
||||
}
|
||||
if(cfg.apm == STATE_ON) {
|
||||
@@ -972,6 +979,7 @@
|
||||
/* get the current state from the nvram */
|
||||
int get_nvram_state(t_thinkpad_state *thinkpad_state) /* {{{ */
|
||||
{
|
||||
+#ifndef __FreeBSD__
|
||||
static int fdsc = -1; /* -1 -> file not opened */
|
||||
unsigned char buffer[114];
|
||||
struct {
|
||||
@@ -1030,13 +1038,50 @@
|
||||
thinkpad_state->mute_toggle = (thinkpad_state->mute_toggle & ~0x01) | (( buffer[0x60] & 0x40) >> 6);
|
||||
thinkpad_state->powermgt_ac = (( buffer[0x39] & 0x07) );
|
||||
thinkpad_state->powermgt_battery = (( buffer[0x39] & 0x38) >> 3);
|
||||
+#else
|
||||
+ u_int n = 0;
|
||||
+ size_t len = sizeof(n);
|
||||
+ if ( sysctlbyname("dev.acpi_ibm.0.hotkey", &n, &len, NULL, 0) == -1 )
|
||||
+ return -1;
|
||||
+
|
||||
+ thinkpad_state->thinkpad_toggle = (thinkpad_state->thinkpad_toggle & ~0x01) | (( n & (1<<3)) >> 3);
|
||||
+ thinkpad_state->zoom_toggle = (thinkpad_state->zoom_toggle & ~0x01) | (( n & (1<<4)) >> 4);
|
||||
+ thinkpad_state->display_toggle = (thinkpad_state->display_toggle & ~0x01) | (( n & (1<<6)) >> 6);
|
||||
+ thinkpad_state->home_toggle = (thinkpad_state->home_toggle & ~0x01) | (( n & (1<<0)) );
|
||||
+ thinkpad_state->search_toggle = (thinkpad_state->search_toggle & ~0x01) | (( n & (1<<1)) >> 1);
|
||||
+ thinkpad_state->mail_toggle = (thinkpad_state->mail_toggle & ~0x01) | (( n & (1<<2)) >> 2);
|
||||
+ thinkpad_state->hibernate_toggle = (thinkpad_state->hibernate_toggle & ~0x01) | (( n & (1<<7)) >> 7);
|
||||
+ thinkpad_state->expand_toggle = (thinkpad_state->expand_toggle & ~0x01) | (( n & (1<<9)) >> 9);
|
||||
+ thinkpad_state->brightness_toggle = (thinkpad_state->brightness_toggle & ~0x01) | (( n & (1<<10)) >> 10);
|
||||
+ thinkpad_state->volume_toggle = (thinkpad_state->volume_toggle & ~0x01) | (( n & (1<<11)) >> 11);
|
||||
+
|
||||
+ if ( sysctlbyname("dev.acpi_ibm.0.wlan", &n, &len, NULL, 0) == -1 )
|
||||
+ return -1;
|
||||
+ thinkpad_state->wireless_toggle = (thinkpad_state->wireless_toggle & ~0x01) | n;
|
||||
+
|
||||
+ if ( sysctlbyname("dev.acpi_ibm.0.thinklight", &n, &len, NULL, 0) == -1 )
|
||||
+ return -1;
|
||||
+ thinkpad_state->thinklight_toggle = (thinkpad_state->thinklight_toggle & ~0x01) | n;
|
||||
+
|
||||
+ if ( sysctlbyname("dev.acpi_ibm.0.lcd_brightness", &n, &len, NULL, 0) == -1 )
|
||||
+ return -1;
|
||||
+ thinkpad_state->brightness_level = n;
|
||||
+
|
||||
+ if ( sysctlbyname("dev.acpi_ibm.0.volume", &n, &len, NULL, 0) == -1 )
|
||||
+ return -1;
|
||||
+ thinkpad_state->volume_level = n;
|
||||
|
||||
+ if ( sysctlbyname("dev.acpi_ibm.0.mute", &n, &len, NULL, 0) == -1 )
|
||||
+ return -1;
|
||||
+ thinkpad_state->mute_toggle = (thinkpad_state->mute_toggle & ~0x01) | n;
|
||||
+#endif
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
/* get the current state from the apm subsystem */
|
||||
int get_apm_state(t_thinkpad_state *thinkpad_state) /* {{{ */
|
||||
{
|
||||
+#ifndef __FreeBSD__
|
||||
unsigned int i;
|
||||
static int fdsc = -1; /* -1 -> file not opened */
|
||||
char buffer[38];
|
||||
@@ -1114,7 +1159,15 @@
|
||||
thinkpad_state->ac_state = STATE_ON;
|
||||
break;
|
||||
}
|
||||
+#else
|
||||
+ u_long addr;
|
||||
+ size_t len = sizeof(addr);
|
||||
|
||||
+ if ( sysctlbyname("hw.acpi.acline", &addr, &len, NULL, 0) == -1 )
|
||||
+ return -1;
|
||||
+
|
||||
+ thinkpad_state->ac_state = (addr == 1) ? STATE_ON : STATE_OFF;
|
||||
+#endif
|
||||
return 0;
|
||||
} /* }}} */
|
||||
|
||||
@@ -1276,6 +1329,12 @@
|
||||
|
||||
/* only use writeback to nvram when cfg.mixersteps is different from DEFAULT_MIXERSTEPS */
|
||||
if(cfg.mixersteps != DEFAULT_MIXERSTEPS) {
|
||||
+#ifdef __FreeBSD__
|
||||
+ u_int n = 0;
|
||||
+
|
||||
+ if (sysctlbyname("dec.acpi_ibm.0.volume", NULL, NULL, &n, sizeof(n)))
|
||||
+ fprintf(stderr, _("Unable to set volume sysctl"));
|
||||
+#else
|
||||
/* open nvram */
|
||||
if((fdsc = open(cfg.nvram, O_RDWR|O_NONBLOCK)) == -1) {
|
||||
fprintf(stderr, _("Unable to open device %s: "), cfg.nvram);
|
||||
@@ -1317,8 +1376,8 @@
|
||||
}
|
||||
|
||||
close(fdsc);
|
||||
+#endif
|
||||
}
|
||||
-
|
||||
return;
|
||||
|
||||
} /* }}} */
|
10
deskutils/tpb/pkg-descr
Normal file
10
deskutils/tpb/pkg-descr
Normal file
@ -0,0 +1,10 @@
|
||||
With TPB it is possible to bind a program to the ThinkPad, Mail, Home and
|
||||
Search button. TPB can also run a callback program on each state change with
|
||||
the changed state and the new state as options. So it is possible to trigger
|
||||
several actions on different events.
|
||||
|
||||
TPB has an on-screen display (OSD) to show volume, mute, brightness and some
|
||||
other information. Furthermore TPB supports a software mixer, as the R series
|
||||
ThinkPads have no hardware mixer to change the volume.
|
||||
|
||||
WWW: http://www.nongnu.org/tpb/
|
6
deskutils/tpb/pkg-plist
Normal file
6
deskutils/tpb/pkg-plist
Normal file
@ -0,0 +1,6 @@
|
||||
bin/tpb
|
||||
etc/tpbrc.default
|
||||
%%PORTDOCS%%%%DOCSDIR%%/callback_example.sh
|
||||
%%NLS%%share/locale/da/LC_MESSAGES/tpb.mo
|
||||
%%NLS%%share/locale/de/LC_MESSAGES/tpb.mo
|
||||
%%NLS%%share/locale/ru/LC_MESSAGES/tpb.mo
|
Loading…
Reference in New Issue
Block a user