All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: "Jiří Prchal" <jiri.prchal@aksignal.cz>
Cc: coreteam@netfilter.org, netfilter-devel@vger.kernel.org,
	kadlec@blackhole.kfki.hu, kaber@trash.net,
	Bryan Wu <cooloney@gmail.com>, Richard Purdie <rpurdie@rpsys.net>
Subject: Re: [BUG] nf: xt_LED: led-always-blink invisible
Date: Mon, 30 Jun 2014 12:54:19 +0200	[thread overview]
Message-ID: <20140630105419.GA7671@localhost> (raw)
In-Reply-To: <53A2AABD.8000109@aksignal.cz>

Cc'ing LED subsystem developers.

On Thu, Jun 19, 2014 at 11:17:49AM +0200, Jiří Prchal wrote:
> Hi all,
> probably I found bug in kernel 3.14.0 in xt_LED module when set
> led-always-blink. If it is set, then between switch led OFF and ON
> is almost zero time. So blink is invisible. I did some fix, but I'm
> not sure if this way would be good. Please, help to direct me. This
> is not final patch so don't punish me for coding style.

Yes, coding style needs to be fixed.

On top of that, I need a second opinion on this since I'm not familiar
with the led subsystem.

@Richard, Bryan: Would you comment on this, please?

Thanks.

> diff --git a/net/netfilter/xt_LED.c b/net/netfilter/xt_LED.c
> index 993de2b..430584b 100644
> --- a/net/netfilter/xt_LED.c
> +++ b/net/netfilter/xt_LED.c
> @@ -54,30 +54,32 @@ static unsigned int
>  led_tg(struct sk_buff *skb, const struct xt_action_param *par)
>  {
>  	const struct xt_led_info *ledinfo = par->targinfo;
>  	struct xt_led_info_internal *ledinternal = ledinfo->internal_data;
> +        unsigned long t=50;
> 
>  	/*
>  	 * If "always blink" is enabled, and there's still some time until the
>  	 * LED will switch off, briefly switch it off now.
>  	 */
>  	if ((ledinfo->delay > 0) && ledinfo->always_blink &&
>  	    timer_pending(&ledinternal->timer))
> -		led_trigger_event(&ledinternal->netfilter_led_trigger, LED_OFF);
> -
> -	led_trigger_event(&ledinternal->netfilter_led_trigger, LED_FULL);
> +		//led_trigger_event(&ledinternal->netfilter_led_trigger, LED_OFF);
> +          led_trigger_blink_oneshot(&ledinternal->netfilter_led_trigger, &t, &t, 1);
> +        else
> +                led_trigger_event(&ledinternal->netfilter_led_trigger, LED_FULL);
> 
>  	/* If there's a positive delay, start/update the timer */
>  	if (ledinfo->delay > 0) {
>  		mod_timer(&ledinternal->timer,
>  			  jiffies + msecs_to_jiffies(ledinfo->delay));
> 
>  	/* Otherwise if there was no delay given, blink as fast as possible */
>  	} else if (ledinfo->delay == 0) {
>  		led_trigger_event(&ledinternal->netfilter_led_trigger, LED_OFF);
>  	}
> 
>  	/* else the delay is negative, which means switch on and stay on */
> 
>  	return XT_CONTINUE;
>  }
> 
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2014-06-30 10:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-19  9:17 [BUG] nf: xt_LED: led-always-blink invisible Jiří Prchal
2014-06-30 10:54 ` Pablo Neira Ayuso [this message]
2014-06-30 23:36   ` Bryan Wu
2014-07-25  7:21     ` [PATCH] nf: xt_LED: fix too short led-always-blink Jiří Prchal
2014-07-25 12:22       ` Pablo Neira Ayuso
2014-07-25 12:40         ` [PATCH v2] " Jiří Prchal
2014-07-25 12:59           ` Pablo Neira Ayuso

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=20140630105419.GA7671@localhost \
    --to=pablo@netfilter.org \
    --cc=cooloney@gmail.com \
    --cc=coreteam@netfilter.org \
    --cc=jiri.prchal@aksignal.cz \
    --cc=kaber@trash.net \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    /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.