blob: edb4b012aae300a3b97f7db179f5214e352a6767 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#include <fcntl.h>
#include <unistd.h>
#include "cablerun.h"
void CableRun::detectState( NodeCollection * NC ) {
int fd = open( D->Device.latin1(), O_RDWR );
if( fd < 0 ) {
NC->setCurrentState( Unavailable );
}
close( fd );
NC->setCurrentState( Available );
}
bool CableRun::setState( NodeCollection * NC, Action_t A ) {
if( A == Activate ) {
detectState(NC);
return (NC->currentState() == Available);
}
return 1;
}
bool CableRun::canSetState( State_t , Action_t ) {
return 1;
}
|