moved to using dbus properties
diff --git a/bin/chassis_control.py b/bin/chassis_control.py
index c2a2af2..7eda9a0 100755
--- a/bin/chassis_control.py
+++ b/bin/chassis_control.py
@@ -18,6 +18,12 @@
BOOTED = 100
+def getWatchdog():
+ obj = bus.get_object('org.openbmc.watchdog.Host',
+ '/org/openbmc/watchdog/HostWatchdog_0')
+ intf = dbus.Interface(obj, 'org.openbmc.Watchdog' )
+ return intf
+
class ChassisControlObject(Openbmc.DbusProperties):
def __init__(self,bus,name):
self.dbus_objects = { }
@@ -81,6 +87,11 @@
if (self.getPowerState()==0):
intf = self.getInterface('power_control')
intf.setPowerState(POWER_ON)
+ intfwatchdog = getWatchdog()
+ #Start watchdog with 30s timeout per the OpenPower Host IPMI Spec
+ #Once the host starts booting, it'll reset and refresh the timer
+ intfwatchdog.set(30000)
+ intfwatchdog.start()
return None
@dbus.service.method(DBUS_NAME,
diff --git a/bin/ipmi_example.py b/bin/ipmi_example.py
index ba13b60..f8b921e 100755
--- a/bin/ipmi_example.py
+++ b/bin/ipmi_example.py
@@ -120,8 +120,12 @@
elif (cmd == "statewatchdog"):
intf = getWatchdog()
intf.start()
+ elif (cmd == "stopwatchdog"):
+ intf = getWatchdog()
+ intf.stop()
elif (cmd == "setwatchdog"):
count = int(sys.argv[2])
+ intf = getWatchdog()
intf.set(count)
else:
print "Unsupported command"
diff --git a/objects/host_watchdog_obj.c b/objects/host_watchdog_obj.c
index e4e4bab..b1c8f2b 100644
--- a/objects/host_watchdog_obj.c
+++ b/objects/host_watchdog_obj.c
@@ -8,7 +8,7 @@
static const gchar* dbus_name = "org.openbmc.watchdog.Host";
static GDBusObjectManagerServer *manager = NULL;
-
+static guint watchdogid = 0;
static gboolean
poll_watchdog(gpointer user_data)
@@ -21,6 +21,7 @@
if (count == 0)
{
//watchdog error, emit error and stop watchdog
+ watchdogid = 0;
watchdog_emit_watchdog_error(watchdog);
return FALSE;
}
@@ -49,7 +50,7 @@
watchdog_set_watchdog(wd,1);
guint poll_interval = watchdog_get_poll_interval(wd);
g_print("Starting watchdog with poll interval: %d\n", poll_interval);
- g_timeout_add(poll_interval, poll_watchdog, user_data);
+ watchdogid = g_timeout_add(poll_interval, poll_watchdog, user_data);
watchdog_complete_start(wd,invocation);
return TRUE;
}
@@ -64,7 +65,22 @@
return TRUE;
}
+static gboolean
+on_stop (Watchdog *wd,
+ GDBusMethodInvocation *invocation,
+ gpointer user_data)
+{
+ g_print("Stopping watchdog\n");
+ if (watchdogid)
+ {
+ g_source_remove(watchdogid);
+ watchdogid = 0;
+ }
+
+ watchdog_complete_stop(wd,invocation);
+ return TRUE;
+}
static void
on_bus_acquired (GDBusConnection *connection,
@@ -107,6 +123,11 @@
object); /* user_data */
g_signal_connect (wd,
+ "handle-stop",
+ G_CALLBACK (on_stop),
+ object); /* user_data */
+
+ g_signal_connect (wd,
"handle-set",
G_CALLBACK (set_poll_interval),
object); /* user_data */