Disk activity trigger: keeps blinking under full load
From: Pavel Machek
Date: Thu May 23 2019 - 17:46:01 EST
Hi!
I'm trying to use disk activity trigger on a scrollock LED... but it
significantly differs from "usual" disk LED: even under "full" disk
activity (linear read) where it should be solidly "on", it keeps
blinking.
I guess that's what led_trigger_blink_oneshot() does. I tried to
change the parameters... off_delay == 0 breaks it completely, and even
with delay of 1 it behaves very weirdly.
Is there better helper I should use?
Pavel
diff --git a/drivers/leds/trigger/ledtrig-disk.c b/drivers/leds/trigger/ledtrig-disk.c
index 9816b0d..cf40ef2 100644
--- a/drivers/leds/trigger/ledtrig-disk.c
+++ b/drivers/leds/trigger/ledtrig-disk.c
@@ -15,7 +15,7 @@
#include <linux/init.h>
#include <linux/leds.h>
-#define BLINK_DELAY 30
+#define BLINK_DELAY 10
DEFINE_LED_TRIGGER(ledtrig_disk);
DEFINE_LED_TRIGGER(ledtrig_disk_read);
@@ -25,17 +25,18 @@ DEFINE_LED_TRIGGER(ledtrig_ide);
void ledtrig_disk_activity(bool write)
{
unsigned long blink_delay = BLINK_DELAY;
+ unsigned long off_delay = 1;
led_trigger_blink_oneshot(ledtrig_disk,
- &blink_delay, &blink_delay, 0);
+ &blink_delay, &off_delay, 0);
led_trigger_blink_oneshot(ledtrig_ide,
- &blink_delay, &blink_delay, 0);
+ &blink_delay, &off_delay, 0);
if (write)
led_trigger_blink_oneshot(ledtrig_disk_write,
- &blink_delay, &blink_delay, 0);
+ &blink_delay, &off_delay, 0);
else
led_trigger_blink_oneshot(ledtrig_disk_read,
- &blink_delay, &blink_delay, 0);
+ &blink_delay, &off_delay, 0);
}
EXPORT_SYMBOL(ledtrig_disk_activity);
@@ -44,6 +45,7 @@ static int __init ledtrig_disk_init(void)
led_trigger_register_simple("disk-activity", &ledtrig_disk);
led_trigger_register_simple("disk-read", &ledtrig_disk_read);
led_trigger_register_simple("disk-write", &ledtrig_disk_write);
+ /* deprecate? */
led_trigger_register_simple("ide-disk", &ledtrig_ide);
return 0;
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Attachment:
signature.asc
Description: Digital signature