From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Maksim Radziwill" <7c00@wp.pl> To: <9fans@cse.psu.edu> Message-ID: <000001c2daaf$c28d7e60$f7e84dd5@makr4j0ty5i9an> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0001_01C2DAB8.2451E660" Subject: [9fans] Apm Enhancement + some bonuses Date: Sat, 22 Feb 2003 21:19:52 +0100 Topicbox-Message-UUID: 6e43891e-eacb-11e9-9e20-41e7f4b1d025 This is a multi-part message in MIME format. ------=_NextPart_000_0001_01C2DAB8.2451E660 Content-Type: multipart/alternative; boundary="----=_NextPart_001_0002_01C2DAB8.2451E660" ------=_NextPart_001_0002_01C2DAB8.2451E660 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi all, I wrote a (ugly) enhancement to the plan9 kernel that allows users using workstations To press ^P and power off the machine, this is especially useful on (old) notebooks That has a broken power switch. I have added too some extra feature ^T^T 5 will turn off the screen ^T^T 6 will put it into a ready state ^T^T f confirms apm is present in the kernel ^T^T g is equivalent to ^P on workstations There was too an options to poweroff disks, but it may hang the whole system. Normally aux/apm disallows you to power off because you won't be able to sync the fs And if you halt the fs you won't be able to power off using aux/apm . ;) (Of course if you uncomment those two lines that allows suspending the sys in the aux/apm code) What is the solutions to this ? Place the power off sequence in the kernel as a key shortcut We will use ^P because using it will power off workstations and reboot cpu's , a nice behavior (since we won't need to power off cpu server) VERY IMPORTANT !!! This thing won't work if aux/apm isn't working in the background. And if boot.ini don't have the apm0= line added. So how to install the code? Copy the attached lib.h to /sys/src/9/port/lib.h The devcons.c to /sys/src/9/port/devcons.c The apm.c to /sys/src/9/pc/apm.c And recompile the kernel and then install it. This is a *extremely* dirty (and ugly) hack, don't blame me for it please. If you ever want to add some shorcuts for other devices (like net cards) Then you'll have to know that the poweroff_call functions Takes too argument - Which device - What to do with it So as an example poweroff_call(ALL_DEVICES,POWEROFF); Will effectively power off all devices The defines for the Devices are self explanatory: #define BIOS 0x00 #define ALL_DEVICES 0x01 #define DISPLAY 0x1ff #define SEC_STORAGE 0x2ff #define PARALE_PORT 0x3ff #define SERIAL_PORT 0x4ff #define NET_ADAPTER 0x5ff #define PCMCIA 0x6ff #define BATTERY 0x80ff Consider BIOS equivalent to ALL_DEVICES The same for the action taken: #define POWEROFF 0x03 #define SLEEP_DEEP 0x02 #define SLEEP_LIGHT 0x01 #define READY 0x00 Anyway HAVE FUN, Maks P.S: If you got some troubles just mail me I'm planning too to clean that stuff one of those days. ------=_NextPart_001_0002_01C2DAB8.2451E660 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Hi all,
I wrote a (ugly) enhancement to the plan9 kernel that =
allows
users using workstations
To press ^P and power off the machine, this is =
especially useful
on (old) notebooks
That has a broken power =
switch…
I have added too some extra feature ^T^T 5 will turn =
off the
screen
^T^T 6 will put it into a ready =
state
^T^T f confirms apm is =
present in
the kernel
^T^T g is equivalent to ^P on =
workstations
There was too an options =
to poweroff disks, but it may hang the whole =
system…
Normally aux/apm =
disallows you to power
off because you won’t be able to sync the fs
And if you halt the fs =
you
won’t be able to power off using aux/apm
… ;)
(Of course if you uncomment those two lines that =
allows suspending =
the
sys in the aux/apm =
code)
What is the solutions to this =
?
Place the power off sequence in the kernel as a key =
shortcut
We will use ^P because using it will power off =
workstations
and reboot cpu’s , a nice behavior
(since we won’t need =
to power
off cpu server)
VERY IMPORTANT !!! This =
thing
won’t work if aux/apm isn’t =
working in the
background…
 =
; =
&nbs=
p;
And if boot.ini don’t have the =
apm0=3D line
added…
So how to install the =
code?
Copy the attached lib.h =
to
/sys/src/9/port/lib.h
The devcons.c to
/sys/src/9/port/devcons.c
The apm.c to =
/sys/src/9/pc/apm.c
And recompile the kernel and then install =
it…
This is a *extremely* dirty (and ugly) hack, =
don’t
blame me for it please.
If you ever want to add some shorcuts
for other devices (like net cards)
Then you’ll have to know that the poweroff_call
functions
Takes too argument
-
Which =
device
-
What to do with =
it
So as an example poweroff_call(ALL_DEVICES,POWEROFF);
Will effectively power off all =
devices
The =
defines for the
Devices are self explanatory:
#define
BIOS &nbs=
p;
0x00
#define
ALL_DEVICES =
0x01
#define
DISPLAY
0x1ff
#define
SEC_STORAGE =
0x2ff
#define
PARALE_PORT =
0x3ff
#define
SERIAL_PORT =
0x4ff
#define
NET_ADAPTER =
0x5ff
#define
PCMCIA
0x6ff
#define
Consider BIOS equivalent to =
ALL_DEVICES
The same for the action =
taken:
#define
POWEROFF
0x03
#define
SLEEP_DEEP =
0x02
#define
SLEEP_LIGHT =
0x01
#define READY &nbs=
p;
0x00
Anyway HAVE FUN,
Maks
P.S: If you got some troubles just mail =
me
&nbs=
p;
I’m planning too to clean that stuff one of those =
days…