ref: 23f68f7cc1154a54fa0912cee97b1ec16e138261
parent: 2437e40f537abe426e9458c90729e940cd1e543f
author: cinap_lenrek <cinap_lenrek@localhost>
date: Wed Aug 24 02:31:23 EDT 2011
make scram work on T23 (fix issue #85)
--- a/sys/src/cmd/scram.c
+++ b/sys/src/cmd/scram.c
@@ -1,20 +1,36 @@
#include <u.h>
#include </386/include/ureg.h>
-typedef struct Ureg Ureg;
#include <libc.h>
+struct Ureg u;
+int fd;
+
void
+apm(void)
+{+ seek(fd, 0, 0);
+ if(write(fd, &u, sizeof u) < 0)
+ sysfatal("write: %r");+ seek(fd, 0, 0);
+ if(read(fd, &u, sizeof u) < 0)
+ sysfatal("read: %r");+ if(u.flags & 1)
+ sysfatal("apm: %lux", (u.ax>>8) & 0xFF);+}
+
+void
main()
{- Ureg ureg;
- int fd;
-
- fd = open("/dev/apm", OWRITE);- if(fd < 0) sysfatal("%r");- memset(&ureg, 0, sizeof ureg);
- ureg.ax = 0x5307;
- ureg.bx = 0x0001;
- ureg.cx = 0x0003;
- ureg.trap = 0x15;
- write(fd, &ureg, sizeof ureg);
+ if((fd = open("/dev/apm", ORDWR)) < 0)+ if((fd = open("#P/apm", ORDWR)) < 0)+ sysfatal("open: %r");+
+ u.ax = 0x530E;
+ u.bx = 0x0000;
+ u.cx = 0x0102;
+ apm();
+ u.ax = 0x5307;
+ u.bx = 0x0001;
+ u.cx = 0x0003;
+ apm();
}
--
⑨