summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOBATA Akio <obache@wizdas.com>2019-04-06 19:01:11 +0900
committerOBATA Akio <obache@wizdas.com>2019-04-16 18:02:35 +0900
commitf8424834b6a36b4d3e43e3af199e55c18fb913b8 (patch)
treefc9b419d76a6552bcb49073ae814e06499318e55
parentda2fceb03bbdb031fbe6e3e285f5a4d0b013c0b4 (diff)
downloadtdeutils-f8424834b6a36b4d3e43e3af199e55c18fb913b8.zip
tdeutils-f8424834b6a36b4d3e43e3af199e55c18fb913b8.tar.gz
Fix NetBSD APM support
NetBSD APM is supported other than i386 too, emulate API, so change to detect with MI support header. Additionally, catch up support codes to others. Signed-off-by: OBATA Akio <obache@wizdas.com>
-rw-r--r--CMakeLists.txt1
-rw-r--r--ConfigureChecks.cmake4
-rw-r--r--config.h.cmake6
-rw-r--r--klaptopdaemon/portable.cpp50
4 files changed, 55 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a51b14c..27d5897 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,6 +24,7 @@ set( VERSION R14.1.0 )
include( FindPkgConfig )
include( CheckIncludeFile )
+include( CheckIncludeFiles )
include( CheckLibraryExists )
include( CheckSymbolExists )
include( CheckFunctionExists )
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 44ca497..1b48407 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -80,6 +80,10 @@ if( BUILD_KLAPTOPDAEMON )
tde_message_fatal( "stdint.h header is required, but was not found on your system" )
endif( NOT HAVE_STDINT_H )
+# NetBSD apm support
+ check_include_files( "unistd.h;machine/apm_bios.h" HAVE_MACHINE_APM_BIOS_H )
+ check_include_files( "unistd.h;dev/apm/apmio.h" HAVE_DEV_APM_APMIO_H )
+
# xtest
pkg_search_module( XTEST xtst )
if( XTEST_FOUND )
diff --git a/config.h.cmake b/config.h.cmake
index 50adee4..52adf87 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -60,6 +60,12 @@
#if !defined( HAVE_STDINT_H )
#cmakedefine HAVE_STDINT_H
#endif // HAVE_STDINT_H
+#if !defined( HAVE_MACHINE_APM_BIOS_H )
+#cmakedefine HAVE_MACHINE_APM_BIOS_H
+#endif // HAVE_MACHIE_APM_BIOS_H
+#if !defined( HAVE_DEV_APM_APMIO_H )
+#cmakedefine HAVE_DEV_APM_APMIO_H
+#endif // HAVE_DEV_APM_APMIO_H
#cmakedefine HAVE_XSCREENSAVER
#cmakedefine HAVE_DPMS
diff --git a/klaptopdaemon/portable.cpp b/klaptopdaemon/portable.cpp
index 35d69b6..1be8706 100644
--- a/klaptopdaemon/portable.cpp
+++ b/klaptopdaemon/portable.cpp
@@ -39,7 +39,7 @@
//
// Linux (#if __linux__)
// FreeBSD (#elif __FreeBSD__)
-// NetBSD (#elif __NetBSD_APM__)
+// NetBSD (#elif __NetBSD__)
// generic nothing (#else)
//
//
@@ -2429,7 +2429,7 @@ laptop_portable::software_suspend_set_mask(bool /*hibernate*/)
}
-#elif defined(__NetBSD_APM__)
+#elif defined(__NetBSD__) && defined(HAVE_DEV_APM_APMIO_H)
#include <errno.h>
#include <fcntl.h>
@@ -2437,11 +2437,16 @@ laptop_portable::software_suspend_set_mask(bool /*hibernate*/)
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
-#include <machine/apmvar.h>
-#include <iostream.h>
+#include <dev/apm/apmbios.h>
+#include <dev/apm/apmio.h>
+#include <iostream>
+#include <tqpushbutton.h>
+#include <tqobject.h>
+#include <kactivelabel.h>
+#include <kprocess.h>
//
-// klaptopdeamon interface to NetBSD 1.5 apm.
+// Klaptopdeamon interface to NetBSD 1.5 apm.
// Scott Presnell, srp@zgi.com, srp@tworoads.net
// Fri Jun 29 17:21:25 PDT 2001
// Tested on Dell I4K running NetBSD 1.5R
@@ -2463,6 +2468,7 @@ laptop_portable::has_power_management()
}
struct apm_power_info info;
+ memset(&info, 0, sizeof(info));
ret=ioctl(fd, APM_IOC_GETPOWER, &info);
::close(fd);
@@ -2490,6 +2496,7 @@ int laptop_portable::has_battery_time()
return 0;
struct apm_power_info info;
+ memset(&info, 0, sizeof(info));
ret=ioctl(fd, APM_IOC_GETPOWER, &info);
::close(fd);
@@ -2661,6 +2668,15 @@ laptop_portable::apm_set_mask(bool , bool )
//
+// adds extra widgets to the battery panel
+//
+void
+laptop_portable::extra_config(TQWidget *parent, TDEConfig *config, TQVBoxLayout *layout)
+{
+}
+
+
+//
// return current battery state
//
struct power_result laptop_portable::poll_battery_state()
@@ -2674,6 +2690,7 @@ struct power_result laptop_portable::poll_battery_state()
goto bad;
struct apm_power_info info;
+ memset(&info, 0, sizeof(info));
ret=ioctl(fd, APM_IOC_GETPOWER, &info);
::close(fd);
@@ -2736,7 +2753,16 @@ laptop_portable::get_brightness()
}
bool
-laptop_portable::get_system_throttling(bool, int &current, TQStringList &s) // do something to help get system throttling data from places like ACPI
+laptop_portable::get_system_performance(bool, int &current, TQStringList &s, bool *&) // do something to help get system profiles from places like ACPI
+{
+ // INSERT HERE
+ current = 0;
+ s.clear();
+ return(0); // if no profiles are available
+}
+
+bool
+laptop_portable::get_system_throttling(bool, int &current, TQStringList &s, bool *&) // do something to help get system throttling data from places like ACPI
{
// INSERT HERE
current = 0;
@@ -2794,6 +2820,18 @@ laptop_portable::get_battery_status(int &num_batteries, TQStringList &names, TQS
values.append(s);
}
+bool
+laptop_portable::has_software_suspend(int /*type*/)
+{
+ return false; // (::has_software_suspend(type));
+}
+
+void
+laptop_portable::software_suspend_set_mask(bool hibernate)
+{
+ // software_suspend_is_preferred =hibernate;
+}
+
#else
/*