From: "Jiří Prchal" <jiri.prchal@aksignal.cz>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Bryan Wu <cooloney@gmail.com>,
coreteam@netfilter.org, netfilter-devel@vger.kernel.org,
kadlec@blackhole.kfki.hu, kaber@trash.net,
Richard Purdie <rpurdie@rpsys.net>,
linux-leds@vger.kernel.org
Subject: [PATCH v2] nf: xt_LED: fix too short led-always-blink
Date: Fri, 25 Jul 2014 14:40:42 +0200 [thread overview]
Message-ID: <53D2504A.20003@aksignal.cz> (raw)
In-Reply-To: <20140725122212.GA5347@salvia>
If led-always-blink is set, then between switch led OFF and ON
is almost zero time. So blink is invisible. This use oneshot led trigger
with fixed time 50ms witch is enough to see blink.
Signed-off-by: Jiri <jiri.prchal@aksignal.cz>
v2:
defined constant XT_LED_BLINK_DELAY and use it instead of number
---
net/netfilter/xt_LED.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/net/netfilter/xt_LED.c b/net/netfilter/xt_LED.c
index 993de2b..9c12f16 100644
--- a/net/netfilter/xt_LED.c
+++ b/net/netfilter/xt_LED.c
@@ -28,6 +28,8 @@
#include <linux/netfilter/xt_LED.h>
+#define XT_LED_BLINK_DELAY 50 /* ms */
+
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Adam Nielsen <a.nielsen@shikadi.net>");
MODULE_DESCRIPTION("Xtables: trigger LED devices on packet match");
@@ -55,6 +57,7 @@ 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 led_delay = XT_LED_BLINK_DELAY;
/*
* If "always blink" is enabled, and there's still some time until the
@@ -62,9 +65,10 @@ led_tg(struct sk_buff *skb, const struct xt_action_param *par)
*/
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_blink_oneshot(&ledinternal->netfilter_led_trigger,
+ &led_delay, &led_delay, 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) {
--
1.9.1
next prev parent reply other threads:[~2014-07-25 12:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <53A2AABD.8000109@aksignal.cz>
[not found] ` <20140630105419.GA7671@localhost>
[not found] ` <CAK5ve-Kc_Kv_EnenJSNA9J60QoTtH-zEjPowrOPuUrsWkh3ACQ@mail.gmail.com>
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 ` Jiří Prchal [this message]
2014-07-25 12:59 ` [PATCH v2] " 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=53D2504A.20003@aksignal.cz \
--to=jiri.prchal@aksignal.cz \
--cc=cooloney@gmail.com \
--cc=coreteam@netfilter.org \
--cc=kaber@trash.net \
--cc=kadlec@blackhole.kfki.hu \
--cc=linux-leds@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).