2013-09-26 17:14:40 +02:00

30 lines
698 B
Plaintext

$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