fix interrupt handling
diff --git a/objects/button_power_obj.c b/objects/button_power_obj.c
index 30078bb..93005a1 100644
--- a/objects/button_power_obj.c
+++ b/objects/button_power_obj.c
@@ -5,6 +5,7 @@
 

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

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

+static const gchar* instance_name = "power0";

 static const gchar* dbus_name        = "org.openbmc.buttons.Power";

 

 static GDBusObjectManagerServer *manager = NULL;

@@ -37,9 +38,34 @@
                GIOCondition condition,

                gpointer user_data )

 {

-	Button* button = object_get_button((Object*)user_data);

-	printf("Power Button pressed\n");

-	button_emit_button_pressed(button);

+

+	GError *error = 0;

+	gsize bytes_read = 0;

+	gchar buf[2]; 

+	buf[1] = '\0';

+	g_io_channel_seek_position( channel, 0, G_SEEK_SET, 0 );

+	GIOStatus rc = g_io_channel_read_chars( channel,

+                                            buf, 1,

+                                            &bytes_read,

+                                            &error );

+	printf("%s\n",buf);

+	

+	if (gpio_button.irq_inited)

+	{

+		Button* button = object_get_button((Object*)user_data);

+		if (buf[0] == '0')

+		{

+			printf("Power Button pressed\n");

+			button_emit_button_pressed(button);

+		}

+		else

+		{

+			printf("Power Button released\n");

+		}

+	} 

+	else { gpio_button.irq_inited = true; }

+

+	return TRUE;

 }

 

 static void 

@@ -50,15 +76,10 @@
 	ObjectSkeleton *object;

 	//g_print ("Acquired a message bus connection: %s\n",name);

  	cmdline *cmd = user_data;

-	if (cmd->argc < 2)

-	{

-		g_print("No objects created.  Put object name(s) on command line\n");

-		return;

-	}	

   	manager = g_dbus_object_manager_server_new (dbus_object_path);

   	int i=0;

 	gchar *s;

-	s = g_strdup_printf ("%s/%s",dbus_object_path,cmd->argv[1]);

+	s = g_strdup_printf ("%s/%s",dbus_object_path,instance_name);

 	object = object_skeleton_new (s);

 	g_free (s);