blob: 500a1cd49279256edf25abc3b48a678d58c5836d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
$NetBSD: patch-aj,v 1.2 2002/09/08 00:03:57 jschauma Exp $
--- /dev/null Sat Sep 7 13:47:40 2002
+++ net_apm.cc Sat Sep 7 14:08:07 2002
@@ -0,0 +1,23 @@
+#ifdef __NetBSD__
+#include "net_apm.h"
+
+int apm_desc = -1;
+
+void apm_init() {
+ if ( (apm_desc = open( "/dev/apm", O_RDONLY ) ) == -1 ) {
+ printf("Error: cannot open APM device: /dev/apm: %s\n",
+ strerror( errno ) );
+ exit( 1 );
+ }
+}
+
+int apm_read( apm_info* a_info ) {
+ if( apm_desc < 0 )
+ return -1;
+
+ if ( ioctl( apm_desc, APM_IOC_GETPOWER, a_info ) == -1 )
+ return -1;
+ else
+ return 0;
+}
+#endif
|