nanosleep: use ucode on newer openwrt

This commit is contained in:
bol-van 2023-10-31 16:19:49 +03:00
parent 81b60aa4ed
commit 8c4faefa68

View File

@ -208,6 +208,9 @@ fsleep_setup()
local errtext=$(read -t 0.001 2>&1) local errtext=$(read -t 0.001 2>&1)
if [ -z "$errtext" ]; then if [ -z "$errtext" ]; then
FSLEEP=3 FSLEEP=3
# newer openwrt has ucode with system function that supports timeout in ms
elif ucode -e "system(['sleep','infinity'], 1)"; then
FSLEEP=4
else else
FSLEEP=0 FSLEEP=0
fi fi
@ -226,6 +229,9 @@ minsleep()
3) 3)
read -t 0.1 read -t 0.1
;; ;;
4)
ucode -e "system(['sleep','infinity'], 100)"
;;
*) *)
sleep 1 sleep 1
esac esac