All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Bur <cyrilbur@gmail.com>
To: OpenBMC Patches <openbmc-patches@stwcx.xyz>
Cc: openbmc@lists.ozlabs.org, Ken <ken.sk.lai@mail.foxconn.com>
Subject: Re: [PATCH skeleton v5 4/5] Solve auto power on issue, confirm GPIO status before send the signal
Date: Tue, 19 Jan 2016 10:00:03 +1100	[thread overview]
Message-ID: <20160119100003.00279380@camb691> (raw)
In-Reply-To: <1453084835-12886-5-git-send-email-openbmc-patches@stwcx.xyz>

On Sun, 17 Jan 2016 20:40:34 -0600
OpenBMC Patches <openbmc-patches@stwcx.xyz> wrote:

> From: Ken <ken.sk.lai@mail.foxconn.com>
> 

Hi Ken,

Sorry I responded to this patch in v3 but my comments are still relevant here.

Apologies,

Cyril

> ---
>  objects/button_power_obj.c | 37 ++++++++++++++++++++++++-------------
>  1 file changed, 24 insertions(+), 13 deletions(-)
>  mode change 100644 => 100755 objects/button_power_obj.c
> 
> diff --git a/objects/button_power_obj.c b/objects/button_power_obj.c
> old mode 100644
> new mode 100755
> index 94f8922..4c986a1
> --- a/objects/button_power_obj.c
> +++ b/objects/button_power_obj.c
> @@ -1,4 +1,5 @@
>  #include <stdio.h>
> +#include <stdlib.h>
>  #include "interfaces/openbmc_intf.h"
>  #include "gpio.h"
>  #include "openbmc.h"
> @@ -42,7 +43,11 @@ on_button_interrupt( GIOChannel *channel,
>  
>  	GError *error = 0;
>  	gsize bytes_read = 0;
> -	gchar buf[2]; 
> +	gchar buf[2];
> +
> +	uint8_t val;
> +	int rc1 = GPIO_OK;
> +
>  	buf[1] = '\0';
>  	g_io_channel_seek_position( channel, 0, G_SEEK_SET, 0 );
>  	GIOStatus rc = g_io_channel_read_chars( channel,
> @@ -50,7 +55,7 @@ on_button_interrupt( GIOChannel *channel,
>                                              &bytes_read,
>                                              &error );
>  	printf("%s\n",buf);
> -	
> +
>  	time_t current_time = time(NULL);
>  	if (gpio_button.irq_inited)
>  	{
> @@ -65,19 +70,25 @@ on_button_interrupt( GIOChannel *channel,
>  		{
>  			long press_time = current_time-button_get_timer(button);
>  			printf("Power Button released, held for %ld seconds\n",press_time);
> -			if (press_time > LONG_PRESS_SECONDS)
> -			{
> -				button_emit_pressed_long(button);
> -			} else {
> -				button_emit_released(button);
> -			}
> +		//	if (press_time > LONG_PRESS_SECONDS)
> +		//	{
> +		//		button_emit_pressed_long(button);
> +		//	} else {
> +			rc1 =  gpio_open(&gpio_button);
> +			rc1 = gpio_read(&gpio_button,&val);
> +			if (val == 1)
> +			button_emit_released(button);
> +
> +			//	if (press_time > 1)
> +			//	sleep(1);
> +			//}
>  		}
> -	} 
> +	}
>  	else { gpio_button.irq_inited = true; }
>  
>  	return TRUE;
>  }
> -static void 
> +static void
>  on_bus_acquired (GDBusConnection *connection,
>                   const gchar     *name,
>                   gpointer         user_data)
> @@ -110,7 +121,7 @@ on_bus_acquired (GDBusConnection *connection,
>                      G_CALLBACK (on_button_press),
>                      NULL); /* user_data */
>  
> -		
> +
>  	/* Export the object (@manager takes its own reference to @object) */
>  	g_dbus_object_manager_server_export (manager, G_DBUS_OBJECT_SKELETON (object));
>  	g_object_unref (object);
> @@ -130,7 +141,7 @@ on_bus_acquired (GDBusConnection *connection,
>  	{
>  		printf("ERROR PowerButton: GPIO setup (rc=%d)\n",rc);
>  	}
> -	emit_object_added((GDBusObjectManager*)manager); 
> +	emit_object_added((GDBusObjectManager*)manager);
>  }
>  
>  static void
> @@ -171,7 +182,7 @@ main (gint argc, gchar *argv[])
>                         NULL);
>  
>    g_main_loop_run (loop);
> -  
> +
>    g_bus_unown_name (id);
>    g_main_loop_unref (loop);
>    return 0;

  reply	other threads:[~2016-01-18 23:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-18  2:40 [PATCH skeleton v5 0/5] Add inventory fan5 OpenBMC Patches
2016-01-18  2:40 ` [PATCH skeleton v5 1/5] " OpenBMC Patches
2016-01-18  2:40 ` [PATCH skeleton v5 2/5] Initial fan LED status OpenBMC Patches
2016-01-18  2:40 ` [PATCH skeleton v5 3/5] Remove reboot function in power button, reboot is in reset button OpenBMC Patches
2016-01-18  2:40 ` [PATCH skeleton v5 4/5] Solve auto power on issue, confirm GPIO status before send the signal OpenBMC Patches
2016-01-18 23:00   ` Cyril Bur [this message]
2016-01-18  2:40 ` [PATCH skeleton v5 5/5] Reset button does not power on when dc off OpenBMC Patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160119100003.00279380@camb691 \
    --to=cyrilbur@gmail.com \
    --cc=ken.sk.lai@mail.foxconn.com \
    --cc=openbmc-patches@stwcx.xyz \
    --cc=openbmc@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.