improve checking of "lpt_enable" variable
This commit is contained in:
parent
828d9323cc
commit
233f9ffab0
11
yasnd.c
11
yasnd.c
@ -52,6 +52,8 @@ void* allocate_memory(int bytes)
|
|||||||
management computer is just booted
|
management computer is just booted
|
||||||
*/
|
*/
|
||||||
void lpt_init()
|
void lpt_init()
|
||||||
|
{
|
||||||
|
if (lpt_enable)
|
||||||
{
|
{
|
||||||
if (ioperm (lpt_port, 3, 1))
|
if (ioperm (lpt_port, 3, 1))
|
||||||
{
|
{
|
||||||
@ -63,6 +65,7 @@ void lpt_init()
|
|||||||
// Unlock circuit
|
// Unlock circuit
|
||||||
outb (0, lpt_port);
|
outb (0, lpt_port);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Function, that turn on first LPT port pin and turn off others.
|
Function, that turn on first LPT port pin and turn off others.
|
||||||
@ -70,6 +73,8 @@ void lpt_init()
|
|||||||
management computer is rebooted
|
management computer is rebooted
|
||||||
*/
|
*/
|
||||||
void lpt_lock()
|
void lpt_lock()
|
||||||
|
{
|
||||||
|
if (lpt_enable)
|
||||||
{
|
{
|
||||||
if (ioperm (lpt_port, 3, 1))
|
if (ioperm (lpt_port, 3, 1))
|
||||||
{
|
{
|
||||||
@ -81,6 +86,7 @@ void lpt_lock()
|
|||||||
// Lock circuit
|
// Lock circuit
|
||||||
outb (1, lpt_port);
|
outb (1, lpt_port);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Function, that checks that defined host entry is valid
|
// Function, that checks that defined host entry is valid
|
||||||
int cb_validate_host(cfg_t *cfg, cfg_opt_t *opt)
|
int cb_validate_host(cfg_t *cfg, cfg_opt_t *opt)
|
||||||
@ -164,7 +170,6 @@ void init()
|
|||||||
if (sms_enable)
|
if (sms_enable)
|
||||||
gammu_init();
|
gammu_init();
|
||||||
// initialize LPT control circuit
|
// initialize LPT control circuit
|
||||||
if (lpt_enable)
|
|
||||||
lpt_init();
|
lpt_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,6 +202,8 @@ void check_host(int num,host_decl* host)
|
|||||||
and turn off all pins. That is enough to reset specified host.
|
and turn off all pins. That is enough to reset specified host.
|
||||||
*/
|
*/
|
||||||
void reset_pin(int pin_num)
|
void reset_pin(int pin_num)
|
||||||
|
{
|
||||||
|
if (lpt_enable)
|
||||||
{
|
{
|
||||||
if (pin_num==0)
|
if (pin_num==0)
|
||||||
return; // there is no LPT control for target host
|
return; // there is no LPT control for target host
|
||||||
@ -216,6 +223,7 @@ void reset_pin(int pin_num)
|
|||||||
sleep(1);
|
sleep(1);
|
||||||
outb (0, lpt_port);
|
outb (0, lpt_port);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int loop_function()
|
int loop_function()
|
||||||
{
|
{
|
||||||
@ -319,7 +327,6 @@ void signal_handler(int signum)
|
|||||||
{
|
{
|
||||||
log_event("SIGTERM captured, daemon stopping");
|
log_event("SIGTERM captured, daemon stopping");
|
||||||
// block LPT control circuit
|
// block LPT control circuit
|
||||||
if (lpt_enable)
|
|
||||||
lpt_lock();
|
lpt_lock();
|
||||||
// close log decriptor
|
// close log decriptor
|
||||||
closelog();
|
closelog();
|
||||||
|
Loading…
Reference in New Issue
Block a user