Вход на хостинг
IT-новости
20.04.2016 iPhone 2017 года поместят в водонепроницаемый корпус из стекла
Линейка iPhone в новом году серьезно поменяется. В этом уверен аналитический исследователь Мин Чи Ку......
30.07.2015 Ищем уникальный контент для сайта
Ищем уникальный контент для сайта Без уникального контента Ваш сайт обречен на то, что его страницы......
/*
* powerd Catch power failure signals from a Trust Energy Protector 400/650 and notify init
*
* Usage: powerd /dev/cua3 (or any other serial device)
*
* Author: Ciro Cattuto <ciro@stud.unipg.it>
*
* Version 1.0 - 31 March 1997
*
* This code is heavily based on the original powerd.c code by Miquel van Smoorenburg <miquels@drinkel.ow.org>.
*
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
*
* Update for PowerCom King Pro by Fedor Lizunkov 2:5020/960@Fidonet 24 May 2000
*/
/* state 0 - power is good */
#define T0_SLEEP 10 /* interval between port reads,in seconds */
#define T0_INL 3 /* number of seconds IN LINE has to be 0 to cause an action */
#define T0_BAT 3 /* number of seconds BATTERY has to be 0 to cause an action */
/* state 1 - power is failing */
#define T1_SLEEP 2 /* interval between ports reads */
#define T1_INL 3 /* same as T0_INL */
#define T1_BAT 3 /* same as T0_BAT */
#define NUMRECEIVEDBYTES 11 /* out date size from UPS */
#define REQ_01 0x01 /* in date to UPS (request) */
#define REQ_03 0x03 /* in date to UPS (self test) */
#define REQ_OFF 0xbc /* first byte for UPS off */
#define LINE_FAIL 0x01
#define BATT_LOW 0x02
#define UPS_OFF 0x80
#define BATT_BAD 0x02
/* Use the new way of communicating with init. */
#define NEWINIT
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>