From 08d9bcdef21f117511e109d28507c9f76045914f Mon Sep 17 00:00:00 2001
From: Yannick Fertre <yannick.fertre@st.com>
Date: Fri, 16 Sep 2016 16:59:37 +0200
Subject: [PATCH] miscutils: watchdog: Add gettimeleft

For purpose debug only, call of ioctl GETTIMELEFT

Signed-off-by: Yannick Fertre <yannick.fertre@st.com>
---
 /miscutils/watchdog.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a//miscutils/watchdog.c b//miscutils/watchdog.c
index d3a76ed..d8e1c0e 100644
--- a//miscutils/watchdog.c
+++ b//miscutils/watchdog.c
@@ -50,6 +50,7 @@ int watchdog_main(int argc, char **argv)
 	unsigned opts;
 	unsigned stimer_duration; /* how often to restart */
 	unsigned htimer_duration = 60000; /* reboots after N ms if not restarted */
+	unsigned time_left;
 	char *st_arg;
 	char *ht_arg;
 
@@ -105,6 +106,10 @@ int watchdog_main(int argc, char **argv)
 		 */
 		write(3, "", 1); /* write zero byte */
 		usleep(stimer_duration * 1000L);
+
+#ifdef WDIOC_GETTIMELEFT
+		ioctl_or_warn(3, WDIOC_GETTIMELEFT, &time_left);
+#endif
 	}
 	return EXIT_SUCCESS; /* - not reached, but gcc 4.2.1 is too dumb! */
 }
-- 
1.9.1

