Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
German Leon
Irradiar
Commits
f8986a77
Commit
f8986a77
authored
Feb 08, 2022
by
German Leon
Browse files
No sign 2
parent
07458f59
Changes
2
Hide whitespace changes
Inline
Side-by-side
bin/refresh_watchdog
0 → 100755
View file @
f8986a77
File added
irradiacion/tools/refresh_watchdog.cpp
0 → 100644
View file @
f8986a77
// iisalive.cpp
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h> // for watchdog timer
#include <unistd.h> // needed only if close() is used to close watchdog timer
#include <sys/ioctl.h> // for watchdog timer
#include <linux/watchdog.h> // for watchdog timer
#include <time.h>
int
main
(
int
argc
,
char
*
argv
[])
{
int
fd
,
ret
;
/* open WDT0 device (WDT0 enables itself automatically) */
fd
=
open
(
"/dev/watchdog0"
,
O_RDWR
);
if
(
fd
<
0
)
{
fprintf
(
stderr
,
"Open watchdog device failed!
\r\n
"
);
return
-
1
;
}
ret
=
ioctl
(
fd
,
WDIOC_KEEPALIVE
,
0
);
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"Kick watchdog failed!
\r\n
"
);
return
-
1
;
}
close
(
fd
);
if
(
ret
<
0
)
{
fprintf
(
stderr
,
"Failed to close watchdog device."
);
return
-
1
;
}
return
0
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment