mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-24 04:33:24 +00:00
Add battstat (ACPI only) support for amd64.
Submitted by: Jung-uk Kim <jkim@niksun.com>
This commit is contained in:
parent
d5b7d0ec10
commit
bf836a2509
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=131282
@ -7,6 +7,7 @@
|
||||
|
||||
PORTNAME= gnomeapplets2
|
||||
PORTVERSION= 2.10.0
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= x11 gnome
|
||||
MASTER_SITES= ${MASTER_SITE_GNOME}
|
||||
MASTER_SITE_SUBDIR= sources/gnome-applets/2.10
|
||||
@ -45,7 +46,7 @@ FREEBSD_SYS?= /usr/src/sys
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
.if ${ARCH} != "i386"
|
||||
.if ${ARCH} != "i386" && ${ARCH} != "amd64"
|
||||
CONFIGURE_ENV+= CFLAGS="${CFLAGS} -fPIC"
|
||||
PLIST_SUB= BATTERY="@comment "
|
||||
.else
|
||||
@ -53,6 +54,7 @@ GCONF_SCHEMAS+= battstat.schemas
|
||||
PLIST_SUB= BATTERY=""
|
||||
|
||||
.if ${OSVERSION} < 600019
|
||||
.if ${OSVERSION} < 503105 || ${OSVERSION} >= 600000
|
||||
pre-everything::
|
||||
@${ECHO_MSG} ""
|
||||
@${ECHO_MSG} " W A R N I N G"
|
||||
@ -66,6 +68,7 @@ pre-everything::
|
||||
@${ECHO_MSG} ""
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if ${ARCH} != "i386" && ${ARCH} != "amd64"
|
||||
PLIST_SUB+= CPUFREQ="@comment "
|
||||
|
@ -32,7 +32,7 @@
|
||||
;;
|
||||
# list of supported OS cores that do not use libapm
|
||||
- *-*-freebsd*|*-*-netbsd*|*-*-openbsd*)
|
||||
+ i386-*-freebsd*|*-*-netbsd*|*-*-openbsd*)
|
||||
+ i386-*-freebsd*|amd64-*-freebsd*|*-*-netbsd*|*-*-openbsd*)
|
||||
+ if [ -n "${FREEBSD_SYS}" ]; then
|
||||
+ ACPIINC="-I${FREEBSD_SYS}"
|
||||
+ else
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- battstat/acpi-freebsd.h.orig Mon Sep 27 18:39:30 2004
|
||||
+++ battstat/acpi-freebsd.h Mon Sep 27 18:39:30 2004
|
||||
@@ -0,0 +1,45 @@
|
||||
@@ -0,0 +1,56 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2004 by Joe Marcus Clarke <marcus@FreeBSD.org>
|
||||
+ *
|
||||
@ -32,6 +32,17 @@
|
||||
+#define ACPI_LIFE "hw.acpi.battery.life"
|
||||
+#define ACPI_STATE "hw.acpi.battery.state"
|
||||
+
|
||||
+/* XXX: AMD64 does not have machine/apm_bios.h. */
|
||||
+#if !defined(__i386__)
|
||||
+struct apm_info {
|
||||
+ guint ai_acline;
|
||||
+ guint ai_batt_stat;
|
||||
+ guint ai_batt_life;
|
||||
+ int ai_batt_time;
|
||||
+ guint ai_status;
|
||||
+};
|
||||
+#endif
|
||||
+
|
||||
+struct acpi_info {
|
||||
+ gboolean ac_online;
|
||||
+ int acpifd;
|
||||
@ -106,11 +117,17 @@
|
||||
};
|
||||
|
||||
--- battstat/power-management.c.orig Thu Jan 13 23:06:40 2005
|
||||
+++ battstat/power-management.c Wed Feb 16 02:58:10 2005
|
||||
@@ -76,6 +76,14 @@
|
||||
#ifdef __FreeBSD__
|
||||
+++ battstat/power-management.c Mon Mar 14 19:53:13 2005
|
||||
@@ -73,9 +73,18 @@
|
||||
* the problem might be. This error message is not to be freed.
|
||||
*/
|
||||
|
||||
-#ifdef __FreeBSD__
|
||||
-
|
||||
+#if defined(__FreeBSD__)
|
||||
+#if defined(__i386__)
|
||||
#include <machine/apm_bios.h>
|
||||
+#endif
|
||||
+#include "acpi-freebsd.h"
|
||||
+
|
||||
+struct acpi_info acpiinfo;
|
||||
@ -122,7 +139,7 @@
|
||||
|
||||
#define APMDEVICE "/dev/apm"
|
||||
|
||||
@@ -86,32 +94,48 @@
|
||||
@@ -86,32 +95,51 @@
|
||||
FreeBSD. Each time this functions is called (once every second)
|
||||
the APM device is opened, read from and then closed.
|
||||
*/
|
||||
@ -145,6 +162,7 @@
|
||||
+ acpi_count--;
|
||||
}
|
||||
+ else {
|
||||
+#if defined(__i386__)
|
||||
+ fd = open(APMDEVICE, O_RDONLY);
|
||||
+ if (fd == -1) {
|
||||
+ return ERR_OPEN_APMDEV;
|
||||
@ -157,14 +175,16 @@
|
||||
|
||||
- close(fd);
|
||||
+ close(fd);
|
||||
+
|
||||
+ if(apminfo.ai_status == 0)
|
||||
+ return ERR_APM_E;
|
||||
+#else
|
||||
+ return ERR_OPEN_APMDEV;
|
||||
+#endif
|
||||
+ }
|
||||
|
||||
- if(apminfo.ai_status == 0)
|
||||
- return ERR_APM_E;
|
||||
+ if(apminfo.ai_status == 0)
|
||||
+ return ERR_APM_E;
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ if (using_acpi) {
|
||||
+ acpi_process_event(&acpiinfo);
|
||||
+ acpi_freebsd_read(&apminfo, &acpiinfo);
|
||||
@ -183,7 +203,7 @@
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -339,6 +363,13 @@
|
||||
@@ -339,6 +367,13 @@
|
||||
G_IO_IN | G_IO_ERR | G_IO_HUP,
|
||||
acpi_callback, NULL);
|
||||
}
|
||||
@ -197,7 +217,7 @@
|
||||
#endif
|
||||
pm_initialised = 1;
|
||||
|
||||
@@ -360,6 +391,10 @@
|
||||
@@ -360,6 +395,10 @@
|
||||
g_source_remove(acpiwatch);
|
||||
acpiwatch = 0;
|
||||
acpi_linux_cleanup(&acpiinfo);
|
||||
@ -208,9 +228,30 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
--- battstat/properties.c.orig Fri Jan 14 23:38:18 2005
|
||||
+++ battstat/properties.c Mon Mar 14 19:49:26 2005
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
-#ifdef __FreeBSD__
|
||||
+#if defined(__FreeBSD__) && defined(__i386__)
|
||||
#include <machine/apm_bios.h>
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <sys/param.h>
|
||||
@@ -61,6 +61,9 @@
|
||||
#include <panel-applet-gconf.h>
|
||||
/*#include <status-docklet.h>*/
|
||||
|
||||
+#if defined(__FreeBSD__) && !defined(__i386__)
|
||||
+#include "acpi-freebsd.h"
|
||||
+#endif
|
||||
#include "battstat.h"
|
||||
|
||||
#ifndef gettext_noop
|
||||
--- battstat/acpi-freebsd.c.orig Mon Feb 28 01:41:08 2005
|
||||
+++ battstat/acpi-freebsd.c Mon Feb 28 03:00:11 2005
|
||||
@@ -0,0 +1,206 @@
|
||||
@@ -0,0 +1,208 @@
|
||||
+/* battstat A GNOME battery meter for laptops.
|
||||
+ * Copyright (C) 2000 by Jörgen Pehrson <jp@spektr.eu.org>
|
||||
+ *
|
||||
@ -246,7 +287,9 @@
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/sysctl.h>
|
||||
+#include <sys/ioctl.h>
|
||||
+#if defined(__i386__)
|
||||
+#include <machine/apm_bios.h>
|
||||
+#endif
|
||||
+#include <stdlib.h>
|
||||
+#include <errno.h>
|
||||
+#include <unistd.h>
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
PORTNAME= gnomeapplets2
|
||||
PORTVERSION= 2.10.0
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= x11 gnome
|
||||
MASTER_SITES= ${MASTER_SITE_GNOME}
|
||||
MASTER_SITE_SUBDIR= sources/gnome-applets/2.10
|
||||
@ -45,7 +46,7 @@ FREEBSD_SYS?= /usr/src/sys
|
||||
|
||||
.include <bsd.port.pre.mk>
|
||||
|
||||
.if ${ARCH} != "i386"
|
||||
.if ${ARCH} != "i386" && ${ARCH} != "amd64"
|
||||
CONFIGURE_ENV+= CFLAGS="${CFLAGS} -fPIC"
|
||||
PLIST_SUB= BATTERY="@comment "
|
||||
.else
|
||||
@ -53,6 +54,7 @@ GCONF_SCHEMAS+= battstat.schemas
|
||||
PLIST_SUB= BATTERY=""
|
||||
|
||||
.if ${OSVERSION} < 600019
|
||||
.if ${OSVERSION} < 503105 || ${OSVERSION} >= 600000
|
||||
pre-everything::
|
||||
@${ECHO_MSG} ""
|
||||
@${ECHO_MSG} " W A R N I N G"
|
||||
@ -66,6 +68,7 @@ pre-everything::
|
||||
@${ECHO_MSG} ""
|
||||
.endif
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.if ${ARCH} != "i386" && ${ARCH} != "amd64"
|
||||
PLIST_SUB+= CPUFREQ="@comment "
|
||||
|
@ -32,7 +32,7 @@
|
||||
;;
|
||||
# list of supported OS cores that do not use libapm
|
||||
- *-*-freebsd*|*-*-netbsd*|*-*-openbsd*)
|
||||
+ i386-*-freebsd*|*-*-netbsd*|*-*-openbsd*)
|
||||
+ i386-*-freebsd*|amd64-*-freebsd*|*-*-netbsd*|*-*-openbsd*)
|
||||
+ if [ -n "${FREEBSD_SYS}" ]; then
|
||||
+ ACPIINC="-I${FREEBSD_SYS}"
|
||||
+ else
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- battstat/acpi-freebsd.h.orig Mon Sep 27 18:39:30 2004
|
||||
+++ battstat/acpi-freebsd.h Mon Sep 27 18:39:30 2004
|
||||
@@ -0,0 +1,45 @@
|
||||
@@ -0,0 +1,56 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2004 by Joe Marcus Clarke <marcus@FreeBSD.org>
|
||||
+ *
|
||||
@ -32,6 +32,17 @@
|
||||
+#define ACPI_LIFE "hw.acpi.battery.life"
|
||||
+#define ACPI_STATE "hw.acpi.battery.state"
|
||||
+
|
||||
+/* XXX: AMD64 does not have machine/apm_bios.h. */
|
||||
+#if !defined(__i386__)
|
||||
+struct apm_info {
|
||||
+ guint ai_acline;
|
||||
+ guint ai_batt_stat;
|
||||
+ guint ai_batt_life;
|
||||
+ int ai_batt_time;
|
||||
+ guint ai_status;
|
||||
+};
|
||||
+#endif
|
||||
+
|
||||
+struct acpi_info {
|
||||
+ gboolean ac_online;
|
||||
+ int acpifd;
|
||||
@ -106,11 +117,17 @@
|
||||
};
|
||||
|
||||
--- battstat/power-management.c.orig Thu Jan 13 23:06:40 2005
|
||||
+++ battstat/power-management.c Wed Feb 16 02:58:10 2005
|
||||
@@ -76,6 +76,14 @@
|
||||
#ifdef __FreeBSD__
|
||||
+++ battstat/power-management.c Mon Mar 14 19:53:13 2005
|
||||
@@ -73,9 +73,18 @@
|
||||
* the problem might be. This error message is not to be freed.
|
||||
*/
|
||||
|
||||
-#ifdef __FreeBSD__
|
||||
-
|
||||
+#if defined(__FreeBSD__)
|
||||
+#if defined(__i386__)
|
||||
#include <machine/apm_bios.h>
|
||||
+#endif
|
||||
+#include "acpi-freebsd.h"
|
||||
+
|
||||
+struct acpi_info acpiinfo;
|
||||
@ -122,7 +139,7 @@
|
||||
|
||||
#define APMDEVICE "/dev/apm"
|
||||
|
||||
@@ -86,32 +94,48 @@
|
||||
@@ -86,32 +95,51 @@
|
||||
FreeBSD. Each time this functions is called (once every second)
|
||||
the APM device is opened, read from and then closed.
|
||||
*/
|
||||
@ -145,6 +162,7 @@
|
||||
+ acpi_count--;
|
||||
}
|
||||
+ else {
|
||||
+#if defined(__i386__)
|
||||
+ fd = open(APMDEVICE, O_RDONLY);
|
||||
+ if (fd == -1) {
|
||||
+ return ERR_OPEN_APMDEV;
|
||||
@ -157,14 +175,16 @@
|
||||
|
||||
- close(fd);
|
||||
+ close(fd);
|
||||
+
|
||||
+ if(apminfo.ai_status == 0)
|
||||
+ return ERR_APM_E;
|
||||
+#else
|
||||
+ return ERR_OPEN_APMDEV;
|
||||
+#endif
|
||||
+ }
|
||||
|
||||
- if(apminfo.ai_status == 0)
|
||||
- return ERR_APM_E;
|
||||
+ if(apminfo.ai_status == 0)
|
||||
+ return ERR_APM_E;
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ if (using_acpi) {
|
||||
+ acpi_process_event(&acpiinfo);
|
||||
+ acpi_freebsd_read(&apminfo, &acpiinfo);
|
||||
@ -183,7 +203,7 @@
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -339,6 +363,13 @@
|
||||
@@ -339,6 +367,13 @@
|
||||
G_IO_IN | G_IO_ERR | G_IO_HUP,
|
||||
acpi_callback, NULL);
|
||||
}
|
||||
@ -197,7 +217,7 @@
|
||||
#endif
|
||||
pm_initialised = 1;
|
||||
|
||||
@@ -360,6 +391,10 @@
|
||||
@@ -360,6 +395,10 @@
|
||||
g_source_remove(acpiwatch);
|
||||
acpiwatch = 0;
|
||||
acpi_linux_cleanup(&acpiinfo);
|
||||
@ -208,9 +228,30 @@
|
||||
}
|
||||
#endif
|
||||
|
||||
--- battstat/properties.c.orig Fri Jan 14 23:38:18 2005
|
||||
+++ battstat/properties.c Mon Mar 14 19:49:26 2005
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
-#ifdef __FreeBSD__
|
||||
+#if defined(__FreeBSD__) && defined(__i386__)
|
||||
#include <machine/apm_bios.h>
|
||||
#elif defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <sys/param.h>
|
||||
@@ -61,6 +61,9 @@
|
||||
#include <panel-applet-gconf.h>
|
||||
/*#include <status-docklet.h>*/
|
||||
|
||||
+#if defined(__FreeBSD__) && !defined(__i386__)
|
||||
+#include "acpi-freebsd.h"
|
||||
+#endif
|
||||
#include "battstat.h"
|
||||
|
||||
#ifndef gettext_noop
|
||||
--- battstat/acpi-freebsd.c.orig Mon Feb 28 01:41:08 2005
|
||||
+++ battstat/acpi-freebsd.c Mon Feb 28 03:00:11 2005
|
||||
@@ -0,0 +1,206 @@
|
||||
@@ -0,0 +1,208 @@
|
||||
+/* battstat A GNOME battery meter for laptops.
|
||||
+ * Copyright (C) 2000 by Jörgen Pehrson <jp@spektr.eu.org>
|
||||
+ *
|
||||
@ -246,7 +287,9 @@
|
||||
+#include <sys/types.h>
|
||||
+#include <sys/sysctl.h>
|
||||
+#include <sys/ioctl.h>
|
||||
+#if defined(__i386__)
|
||||
+#include <machine/apm_bios.h>
|
||||
+#endif
|
||||
+#include <stdlib.h>
|
||||
+#include <errno.h>
|
||||
+#include <unistd.h>
|
||||
|
Loading…
Reference in New Issue
Block a user