From 0138e189c2e6f18e8acca7008d84d4c3612e2d75 Mon Sep 17 00:00:00 2001 From: Oleksandr Shamray Date: Fri, 16 Feb 2024 17:57:55 +0200 Subject: [PATCH] hw-mgmt: infra: Optimize PSU init time For PSU on udev event we have a delay 2 sec which is needed to allow PSU controller to stabilize. This delay of 2 sec can be too much. In this change, we replaced constant delay to PSU attribute polling, which can help us to get the exact time when PSU is ready and reduce wait time for PSU attributes init. Signed-off-by: Oleksandr Shamray --- usr/usr/bin/hw-management-thermal-events.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr/usr/bin/hw-management-thermal-events.sh b/usr/usr/bin/hw-management-thermal-events.sh index 591688020..897c64b8d 100755 --- a/usr/usr/bin/hw-management-thermal-events.sh +++ b/usr/usr/bin/hw-management-thermal-events.sh @@ -818,7 +818,8 @@ if [ "$1" == "add" ]; then exit 0 fi # Allow PS controller to stabilize - sleep 2 + retry_helper "ls" 0.2 20 "$2 takes too long to init" "$5""$3"/in1_input + sleep 1 # Set I2C bus for psu echo "$bus" > $config_path/"$psu_name"_i2c_bus # Set default fan speed