mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-23 04:23:08 +00:00
- Add Bluetooth support
- Don't fail if wlan, bluetooth or thinklight sysctls are not present. They are generated dynamically by the driver - Bump PORTREVISION
This commit is contained in:
parent
c1bd3a408a
commit
646eef5398
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=137404
@ -6,7 +6,7 @@
|
||||
|
||||
PORTNAME= tpb
|
||||
PORTVERSION= 0.6.3
|
||||
PORTREVISION= 1
|
||||
PORTREVISION= 2
|
||||
CATEGORIES= deskutils
|
||||
MASTER_SITES= ${MASTER_SITE_SAVANNAH}
|
||||
MASTER_SITE_SUBDIR= ${PORTNAME}
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- src/tpb.c.orig Sun Aug 22 15:45:11 2004
|
||||
+++ src/tpb.c Fri Jun 10 15:03:42 2005
|
||||
+++ src/tpb.c Mon Jun 13 17:31:34 2005
|
||||
@@ -34,6 +34,10 @@
|
||||
#include <unistd.h>
|
||||
#include "config.h"
|
||||
@ -21,7 +21,33 @@
|
||||
_exit(1);
|
||||
}
|
||||
if(cfg.apm == STATE_ON) {
|
||||
@@ -972,6 +979,7 @@
|
||||
@@ -449,6 +456,25 @@
|
||||
#endif /* HAVE_LIBXOSD */
|
||||
} /* }}} */
|
||||
|
||||
+ /* determine the state of Bluetooth {{{ */
|
||||
+ if(thinkpad_state.bluetooth_toggle != last_thinkpad_state.bluetooth_toggle) {
|
||||
+ if(cfg.verbose == STATE_ON) {
|
||||
+ printf(_("Bluetooth is %s\n"), thinkpad_state.bluetooth_toggle == 1 ? _("on") : _("off"));
|
||||
+ }
|
||||
+ if(cfg.callback != NULL) {
|
||||
+ snprintf(callback_cmd, sizeof(callback_cmd), "%s bluetooth %s", cfg.callback, thinkpad_state.bluetooth_toggle == 1 ? "on" : "off");
|
||||
+ if(fork_app(callback_cmd) != 0) {
|
||||
+ _exit(0);
|
||||
+ }
|
||||
+ }
|
||||
+#ifdef HAVE_LIBXOSD
|
||||
+ if(osd_ptr != NULL) {
|
||||
+ xosd_display(osd_ptr, 0, XOSD_string, thinkpad_state.bluetooth_toggle == 1 ? _("Bluetooth enabled") : _("Bluetooth disabled"));
|
||||
+ xosd_display(osd_ptr, 1, XOSD_string, "");
|
||||
+ }
|
||||
+#endif /* HAVE_LIBXOSD */
|
||||
+ } /* }}} */
|
||||
+
|
||||
/* determine the state of display {{{ */
|
||||
if((thinkpad_state.display_toggle != last_thinkpad_state.display_toggle ||
|
||||
thinkpad_state.display_state != last_thinkpad_state.display_state) &&
|
||||
@@ -972,6 +998,7 @@
|
||||
/* get the current state from the nvram */
|
||||
int get_nvram_state(t_thinkpad_state *thinkpad_state) /* {{{ */
|
||||
{
|
||||
@ -29,7 +55,7 @@
|
||||
static int fdsc = -1; /* -1 -> file not opened */
|
||||
unsigned char buffer[114];
|
||||
struct {
|
||||
@@ -1030,13 +1038,50 @@
|
||||
@@ -1030,13 +1057,52 @@
|
||||
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);
|
||||
@ -38,7 +64,7 @@
|
||||
+ 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);
|
||||
@ -50,25 +76,27 @@
|
||||
+ 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;
|
||||
+ /* Don't fail if the wlan, bluetooth or thinklight sysctls are not present. They are generated dynamically */
|
||||
+ if ( sysctlbyname("dev.acpi_ibm.0.wlan", &n, &len, NULL, 0) != -1 )
|
||||
+ thinkpad_state->wireless_toggle = 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.bluetooth", &n, &len, NULL, 0) != -1 )
|
||||
+ thinkpad_state->bluetooth_toggle = n;
|
||||
+
|
||||
+ if ( sysctlbyname("dev.acpi_ibm.0.thinklight", &n, &len, NULL, 0) != -1 )
|
||||
+ thinkpad_state->thinklight_toggle = n;
|
||||
+
|
||||
+ if ( sysctlbyname("dev.acpi_ibm.0.lcd_brightness", &n, &len, NULL, 0) == -1 )
|
||||
+ return -1;
|
||||
+ thinkpad_state->brightness_level = n;
|
||||
+ thinkpad_state->brightness_level = n;
|
||||
+
|
||||
+ if ( sysctlbyname("dev.acpi_ibm.0.volume", &n, &len, NULL, 0) == -1 )
|
||||
+ return -1;
|
||||
+ thinkpad_state->volume_level = n;
|
||||
|
||||
+ 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;
|
||||
+ thinkpad_state->mute_toggle = n;
|
||||
+#endif
|
||||
return 0;
|
||||
} /* }}} */
|
||||
@ -80,23 +108,23 @@
|
||||
unsigned int i;
|
||||
static int fdsc = -1; /* -1 -> file not opened */
|
||||
char buffer[38];
|
||||
@@ -1114,7 +1159,15 @@
|
||||
@@ -1114,7 +1180,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 @@
|
||||
@@ -1276,6 +1350,12 @@
|
||||
|
||||
/* only use writeback to nvram when cfg.mixersteps is different from DEFAULT_MIXERSTEPS */
|
||||
if(cfg.mixersteps != DEFAULT_MIXERSTEPS) {
|
||||
@ -109,7 +137,7 @@
|
||||
/* 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 @@
|
||||
@@ -1317,8 +1397,8 @@
|
||||
}
|
||||
|
||||
close(fdsc);
|
||||
|
10
deskutils/tpb/files/patch-src-tpb.h
Normal file
10
deskutils/tpb/files/patch-src-tpb.h
Normal file
@ -0,0 +1,10 @@
|
||||
--- src/tpb.h.orig Mon Jun 13 14:32:31 2005
|
||||
+++ src/tpb.h Mon Jun 13 14:44:47 2005
|
||||
@@ -70,6 +70,7 @@
|
||||
unsigned int ac_state; /* ac connected */
|
||||
unsigned int powermgt_ac; /* power management mode ac */
|
||||
unsigned int powermgt_battery; /* power management mode battery */
|
||||
+ unsigned int bluetooth_toggle; /* bluetooth toggle */
|
||||
} t_thinkpad_state;
|
||||
|
||||
#endif /* __TPB_H__*/
|
Loading…
Reference in New Issue
Block a user