Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ power(4) — NEWS-os 4.2.1R

Media Vault

Software Library

Restoration Projects

Artifacts Sought

POWER(4)  —  NEWS-OS Programmer’s Manual

NAME

power − NEWS power interface

SYNOPSIS

pseudo-device power

DESCRIPTION

Returns the current voltage of the power in 1-byte by reading /dev/power with a read system call.  The voltage value is in the range obtained by PWIOCPOWERPARAM, described later. 

By issuing the ioctl(2) the various information can be obtained as well. 

IOCTL

The following the description of ioctl commands.  The following header files must be included. 

#include <sys/ioctl.h>
#include <machine/powerctl.h>
#include <machine/powerioctl.h>

PWIOCBATTVOL
Returns 10000 times of the average unit time of battery A/D converter.

int volt;
ioctl(power, PWIOCBATTVOL, &volt);

PWIOCBATTDVOL
Returns 10000 times of the average change unit time of battery A/D converter.

int dvolt;
ioctl(power, PWIOCBATTDVOL, &dvolt);

PWIOCBATTRVOL
Returns the value of battery A/D converter.

int volt;
ioctl(power, PWIOCBATTRVOL, &volt);

PWIOCBATTSTAT
Returns the status of the battery.

int stat;
ioctl(power, PWIOCBATTSTAT, &stat);

BATT_BTTOK
If this bit is 0, battery is empty.

BATT_DCOPE
0 indicates AC, and 1 indicates DC.

BATT_PSOK
If this bit 0, there is a problem in the power.

BATT_PWSW
SHUTDOWN switch/Power switch is pressed.

PWIOCIOPWSTAT
Obtains the status of the device whose power can be turned off.

int stat;
ioctl(power, PWIOCIOPWSTAT, &stat);

POWER_FDD
Power of FDD drive

POWER_RS
Power of RS-232C drive

PWIOCBATTPARAM
Obtains the power and battery parameters.

struct battparam param;
ioctl(power, PWIOCBATTPARAM, ¶m);

PWIOCGETSYSDI
Obtaines the status of sysctld(8). 

#include <machine/sysctl.h>
int state;
ioctl(power, PWIOCGETSYSDI, &state);

PWIOCPOWERPARAM
Obtaines the parameters which indicates the maximum and minimum power and how many times of the actual value can be read by read(2).  read(2) can obtain the maximum value in the member maxvalue, the minimum value in the member minvalue, in multibied by the value specified in the member scale.

struct powerparam param;
ioctl(power, PWIOCPOWERPARAM, ¶m);

PWIOCPOWERSTATE
Obtaines the current status of the power.

struct powerstatus status;
ioctl(power, PWIOCPOWERSTATE, &status);

ERRORS

If the system call ends in error, −1 is returned and one of the following error codes is set. 

#include <sys/errno.h>
extern int errno;

[ENXIO] Special device specified at open does not exist. 

[EIO] Such ioctl is not supported. 

[EACCES]
Non-root user tries to change the system status.

FILES

/dev/power

SEE ASLO

powerd(8), sysctld(8)

REMARKS

Supported only on NWS-3100 series and NWS-5000 series workstation.  Voltage value and A/D value are not correct on NWS-5000. 

NEWS-OSRelease 4.2.1R

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026