added error logging
diff --git a/Makefile b/Makefile
index ea14c51..2c49960 100644
--- a/Makefile
+++ b/Makefile
@@ -25,8 +25,8 @@
 libopenbmc_intf: openbmc_intf.o
 	$(CC) -shared -o lib/$@.so obj/openbmc_intf.o $(CFLAGS)
 
-power_control: power_control_obj.o gpio.o event_log.o
-	$(CC) -o bin/$@.exe obj/event_log.o obj/gpio.o obj/power_control_obj.o $(OFLAGS) $(CFLAGS)
+power_control: power_control_obj.o gpio.o
+	$(CC) -o bin/$@.exe obj/gpio.o obj/power_control_obj.o $(OFLAGS) $(CFLAGS)
 
 chassis_identify: chassis_identify_obj.o gpio.o
 	$(CC) -o bin/$@.exe obj/gpio.o obj/chassis_identify_obj.o $(OFLAGS) $(CFLAGS)
diff --git a/bin/Openbmc.py b/bin/Openbmc.py
index b320d52..9cfeffb 100644
--- a/bin/Openbmc.py
+++ b/bin/Openbmc.py
@@ -20,8 +20,6 @@
 	'NOT_PRESENT'       : 3,
 }
 
-EVENT_TYPES = ['NONE','FATAL','RECOVERABLE','WARNING','SW_ERROR','INFO']
-
 
 ENUMS = {
 	'org.openbmc.SensorIntegerThreshold.state' : 
diff --git a/bin/eventlogger.py b/bin/eventlogger.py
index 0c4fcfc..95edfb8 100644
--- a/bin/eventlogger.py
+++ b/bin/eventlogger.py
@@ -1,6 +1,8 @@
 #!/usr/bin/env python
 
 import sys
+import datetime
+import time
 import syslog
 import json
 import gobject
@@ -12,24 +14,33 @@
 DBUS_NAME = 'org.openbmc.loggers.EventLogger'
 OBJ_NAME = '/org/openbmc/loggers/EventLogger/'+sys.argv[1]
 
+
 class EventLogger(dbus.service.Object):
 	def __init__(self,bus,name):
 		dbus.service.Object.__init__(self,bus,name)
 		bus = dbus.SessionBus()
-		syslog.openlog('openbmc')
-
 		bus.add_signal_receiver(self.event_log_signal_handler, 
 					dbus_interface = "org.openbmc.EventLog", 
 					signal_name = "EventLog",
 					path_keyword='path')
 
 	## Signal handler
-	def event_log_signal_handler(self,e_type,msg,path = None):
+	def event_log_signal_handler(self,priority,msg,path = None):
 		message = {}
+		ts = time.time()
+
+		message['priority'] = priority
 		message['object_path'] = path
-		message['e_type'] = Openbmc.EVENT_TYPES[int(e_type)]
 		message['message'] = msg
-		syslog.syslog(json.dumps(message))
+
+		json_dump = json.dumps(message)
+		print "EVENT_LOG: "+json_dump
+		syslog.openlog('[OpenBmc]',logoption=syslog.LOG_PID)
+		syslog.syslog(priority,json_dump)
+		syslog.closelog()
+		
+
+
 
 if __name__ == '__main__':
     dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
diff --git a/includes/gpio.c b/includes/gpio.c
index 4b22f89..992745f 100644
--- a/includes/gpio.c
+++ b/includes/gpio.c
@@ -43,18 +43,26 @@
 {
 	char buf[1];
 	int r = GPIO_OK;
-	if (read(gpio->fd,&buf,1) != 1)
+	if (gpio->fd <= 0)
 	{
-		r = GPIO_READ_ERROR;
-	} else {
-		if (buf[0]=='1') {
-			*value = 1;
+		r = GPIO_ERROR;	
+	}
+	else
+	{
+		if (read(gpio->fd,&buf,1) != 1)
+		{
+			g_print("here1\n");
+			r = GPIO_READ_ERROR;
 		} else {
-			*value = 0;
+			g_print("here2\n");
+			if (buf[0]=='1') {
+				*value = 1;
+			} else {
+				*value = 0;
+			}
 		}
 	}
 	return r;
-
 }
 int gpio_clock_cycle(GPIO* gpio, int num_clks) {
         int i=0;
diff --git a/includes/openbmc.h b/includes/openbmc.h
index 5ae0ede..bb6660b 100644
--- a/includes/openbmc.h
+++ b/includes/openbmc.h
@@ -13,6 +13,8 @@
 #define NEW_VARIANT_B(v)       g_variant_new_variant(g_variant_new_byte(v)) 
 #define VARIANT_COMPARE(x,y)   g_variant_compare(GET_VARIANT(x),GET_VARIANT(y))
 
+
+
 #ifdef __arm__
 static inline void write_reg(uint32_t val,void* addr)
 {
diff --git a/interfaces/openbmc_intf.c b/interfaces/openbmc_intf.c
index ec88fdc..fcdac58 100644
--- a/interfaces/openbmc_intf.c
+++ b/interfaces/openbmc_intf.c
@@ -17669,12 +17669,12 @@
 
 /* ---- Introspection data for org.openbmc.EventLog ---- */
 
-static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_e_type =
+static const _ExtendedGDBusArgInfo _event_log_signal_info_event_log_ARG_priority =
 {
   {
     -1,
-    (gchar *) "e_type",
-    (gchar *) "y",
+    (gchar *) "priority",
+    (gchar *) "i",
     NULL
   },
   FALSE
@@ -17693,7 +17693,7 @@
 
 static const _ExtendedGDBusArgInfo * const _event_log_signal_info_event_log_ARG_pointers[] =
 {
-  &_event_log_signal_info_event_log_ARG_e_type,
+  &_event_log_signal_info_event_log_ARG_priority,
   &_event_log_signal_info_event_log_ARG_message,
   NULL
 };
@@ -17784,7 +17784,7 @@
   /**
    * EventLog::event-log:
    * @object: A #EventLog.
-   * @arg_e_type: Argument.
+   * @arg_priority: Argument.
    * @arg_message: Argument.
    *
    * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> is received.
@@ -17799,14 +17799,14 @@
     NULL,
     g_cclosure_marshal_generic,
     G_TYPE_NONE,
-    2, G_TYPE_UCHAR, G_TYPE_STRING);
+    2, G_TYPE_INT, G_TYPE_STRING);
 
 }
 
 /**
  * event_log_emit_event_log:
  * @object: A #EventLog.
- * @arg_e_type: Argument to pass with the signal.
+ * @arg_priority: Argument to pass with the signal.
  * @arg_message: Argument to pass with the signal.
  *
  * Emits the <link linkend="gdbus-signal-org-openbmc-EventLog.EventLog">"EventLog"</link> D-Bus signal.
@@ -17814,10 +17814,10 @@
 void
 event_log_emit_event_log (
     EventLog *object,
-    guchar arg_e_type,
+    gint arg_priority,
     const gchar *arg_message)
 {
-  g_signal_emit_by_name (object, "event-log", arg_e_type, arg_message);
+  g_signal_emit_by_name (object, "event-log", arg_priority, arg_message);
 }
 
 /* ------------------------------------------------------------------------ */
@@ -18378,7 +18378,7 @@
 static void
 _event_log_on_signal_event_log (
     EventLog *object,
-    guchar arg_e_type,
+    gint arg_priority,
     const gchar *arg_message)
 {
   EventLogSkeleton *skeleton = EVENT_LOG_SKELETON (object);
@@ -18387,8 +18387,8 @@
   GVariant   *signal_variant;
   connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
 
-  signal_variant = g_variant_ref_sink (g_variant_new ("(ys)",
-                   arg_e_type,
+  signal_variant = g_variant_ref_sink (g_variant_new ("(is)",
+                   arg_priority,
                    arg_message));
   for (l = connections; l != NULL; l = l->next)
     {
diff --git a/interfaces/openbmc_intf.h b/interfaces/openbmc_intf.h
index e7cbdec..3e764c1 100644
--- a/interfaces/openbmc_intf.h
+++ b/interfaces/openbmc_intf.h
@@ -2345,7 +2345,7 @@
 
   void (*event_log) (
     EventLog *object,
-    guchar arg_e_type,
+    gint arg_priority,
     const gchar *arg_message);
 
 };
@@ -2359,7 +2359,7 @@
 /* D-Bus signal emissions functions: */
 void event_log_emit_event_log (
     EventLog *object,
-    guchar arg_e_type,
+    gint arg_priority,
     const gchar *arg_message);
 
 
diff --git a/objects/power_control_obj.c b/objects/power_control_obj.c
index 3395502..9291345 100644
--- a/objects/power_control_obj.c
+++ b/objects/power_control_obj.c
@@ -6,10 +6,10 @@
 #include <unistd.h>

 #include <sys/stat.h>

 #include <sys/mman.h>

+#include <syslog.h>

 #include "interfaces/openbmc_intf.h"

 #include "openbmc.h"

 #include "gpio.h"

-#include "event_log.h"

 

 /* ---------------------------------------------------------------------------------------------------- */

 static const gchar* dbus_object_path = "/org/openbmc/control";

@@ -27,6 +27,7 @@
 

 static gboolean poll_pgood(gpointer user_data)

 {

+	g_print("polling\n");

 	ControlPower *control_power = object_get_control_power((Object*)user_data);

 	Control* control = object_get_control((Object*)user_data);

 	EventLog* event_log = object_get_event_log((Object*)user_data);

@@ -38,9 +39,10 @@
 

 	if (pgood_timeout_count > pgood_timeout)

 	{

-		event_log_emit_event_log(event_log, FATAL, "Pgood poll timeout");

+		event_log_emit_event_log(event_log, LOG_ALERT, "Pgood poll timeout");

 		control_power_set_pgood_timeout(control_power,0);

-		//return FALSE;

+		pgood_timeout_count = 0;

+		return TRUE;

 	}

 	//For simulation, remove

 	if (tmp_pgood!=last_pgood) {

@@ -72,8 +74,8 @@
  			}

 		}

 	} else {

-		event_log_emit_event_log(event_log, FATAL, "GPIO read error");

-		//return FALSE;

+		event_log_emit_event_log(event_log, LOG_ALERT, "GPIO read error");

+		return FALSE;

 	}

 	//pgood is not at desired state yet

 	if (gpio != control_power_get_state(control_power) &&

@@ -133,7 +135,7 @@
 		} while(0);

 		if (error != GPIO_OK)

 		{

-			event_log_emit_event_log(event_log, FATAL, "GPIO setup error");

+			event_log_emit_event_log(event_log, LOG_ALERT, "GPIO setup error");

 		}

 	}

 	return TRUE;

diff --git a/xml/openbmc_intf.xml b/xml/openbmc_intf.xml
index 4a26f12..728fdbd 100644
--- a/xml/openbmc_intf.xml
+++ b/xml/openbmc_intf.xml
@@ -124,7 +124,7 @@
 	</interface>
 	<interface name="org.openbmc.EventLog">
 		<signal name="EventLog">
-			<arg name="e_type" type="y"/>
+			<arg name="priority" type="i"/>
 			<arg name="message" type="s"/>
 		</signal>
 	</interface>