From 990f726ce797c040adda6d1e1bc6a21bd2b28657 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 1 Oct 2024 14:24:41 +0200 Subject: [PATCH] ubi: implement support for LED activity Implement support for LED activity. If the feature is enabled, make the defined ACTIVITY LED to signal ubi write operation. Signed-off-by: Christian Marangi Reviewed-by: Simon Glass --- cmd/ubi.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cmd/ubi.c b/cmd/ubi.c index 0e62e449327..56d7da82629 100644 --- a/cmd/ubi.c +++ b/cmd/ubi.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -488,10 +489,18 @@ exit: int ubi_volume_write(char *volume, void *buf, loff_t offset, size_t size) { - if (!offset) - return ubi_volume_begin_write(volume, buf, size, size); + int ret; - return ubi_volume_offset_write(volume, buf, offset, size); + led_activity_blink(); + + if (!offset) + ret = ubi_volume_begin_write(volume, buf, size, size); + else + ret = ubi_volume_offset_write(volume, buf, offset, size); + + led_activity_off(); + + return ret; } int ubi_volume_read(char *volume, char *buf, loff_t offset, size_t size)