summaryrefslogtreecommitdiff
path: root/x11/bbapm/patches/patch-aj
blob: 79860e68887b561cdfdf106a69bace86ec6d2e1c (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
29
$NetBSD: patch-aj,v 1.3 2003/12/03 17:41:21 gson Exp $

--- /dev/null	Sat Sep  7 13:47:40 2002
+++ net_apm.cc	Sat Sep  7 14:08:07 2002
@@ -0,0 +1,24 @@
+#ifdef __NetBSD__
+#include <stdlib.h>
+#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