Commit ab6a8ac9 authored by Claes Sjofors's avatar Claes Sjofors

Support for EmergBreakAction Reboot added

parent 390e8fb2
...@@ -135,6 +135,7 @@ int main(int argc, char *argv[]) ...@@ -135,6 +135,7 @@ int main(int argc, char *argv[])
{ "other", 0, NULL, 'o' }, { "other", 0, NULL, 'o' },
{ "rr", 0, NULL, 'r' }, { "rr", 0, NULL, 'r' },
{ "verbose", 0, NULL, 'v' }, { "verbose", 0, NULL, 'v' },
{ "reboot", 0, NULL, 'B' },
// { "version", 0, NULL, 'V' }, // { "version", 0, NULL, 'V' },
{ NULL, 0, NULL, 0 } { NULL, 0, NULL, 0 }
}; };
...@@ -171,6 +172,14 @@ int main(int argc, char *argv[]) ...@@ -171,6 +172,14 @@ int main(int argc, char *argv[])
// case 'V': // case 'V':
// printf("chrt version " VERSION "\n"); // printf("chrt version " VERSION "\n");
// return 0; // return 0;
case 'B': {
int sts;
sts = system( "/sbin/reboot");
if ( sts != 0)
printf( "Reboot return sts: %d\n", sts);
return 0;
}
case 'h': case 'h':
ret = 0; ret = 0;
default: default:
......
...@@ -52,6 +52,7 @@ pwrs_Node_Exec ( ...@@ -52,6 +52,7 @@ pwrs_Node_Exec (
5,5,5,0,0,20,0,5,5,5, 5,5,5,0,0,20,0,5,5,5,
5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,5,5}; 5,5,5,5,5,5,5,5,5,5};
static int reboot_done = 0;
if ( !np) { if ( !np) {
pwr_tOid oid; pwr_tOid oid;
...@@ -66,6 +67,28 @@ pwrs_Node_Exec ( ...@@ -66,6 +67,28 @@ pwrs_Node_Exec (
if ( !np) if ( !np)
return; return;
if ( np->EmergBreakTrue) {
switch ( np->EmergBreakSelect) {
case 1: {
/* Reboot */
int sts;
if ( !reboot_done) {
errh_Fatal( "Emergency break action: reboot");
sts = system("rt_prio --reboot");
if ( sts != 0)
errh_Fatal("Unable to reboot, sts %d", sts);
reboot_done = 1;
}
break;
}
default: ;
}
}
else
reboot_done = 0;
system_severity = errh_Severity( np->SystemStatus); system_severity = errh_Severity( np->SystemStatus);
time_GetTime( &current_time); time_GetTime( &current_time);
for ( i = 0; i < sizeof(np->ProcStatus)/sizeof(np->ProcStatus[0]); i++) { for ( i = 0; i < sizeof(np->ProcStatus)/sizeof(np->ProcStatus[0]); i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment