summaryrefslogtreecommitdiff
diff options
authorrickwu4444 <rick.wu@canonical.com>2022-06-29 10:58:10 +0800
committerrickwu4444 <rick.wu@canonical.com>2022-06-29 11:14:31 +0800
commit229cc3edf22bc6031b3103f743d0583d2701b581 (patch)
tree781eb2a43b9d4a60f46380d7c96190fdecff7cca
parent0bc1f6761099d405269e19b121e5c3250fce5fe5 (diff)
Change: Change suspend method if using rtcwake
Due to rtcwake is calling kernel power states directly to put system into suspend. That will cause userspace services didn't been handle. Therefore, using systemd to handle suspend would be better for handle the userspace services.
-rw-r--r--units/stress/s3s4.pxu3
-rw-r--r--units/suspend/suspend.pxu12
2 files changed, 10 insertions, 5 deletions
diff --git a/units/stress/s3s4.pxu b/units/stress/s3s4.pxu
index 77b9af6..9bf6ea7 100644
--- a/units/stress/s3s4.pxu
+++ b/units/stress/s3s4.pxu
@@ -63,7 +63,8 @@ command:
for i in {1..{{ s3_iterations }}};
do
echo "Iteration $i"
- rtcwake -v -m mem -s "${STRESS_S3_SLEEP_DELAY:-30}"
+ rtcwake -v -m on -s "${STRESS_S3_SLEEP_DELAY:-30}" &
+ systemctl suspend
done
{% endif -%}
_description:
diff --git a/units/suspend/suspend.pxu b/units/suspend/suspend.pxu
index 1225d90..9d905da 100644
--- a/units/suspend/suspend.pxu
+++ b/units/suspend/suspend.pxu
@@ -202,9 +202,11 @@ command:
else
echo "Calling rtcwake"
if [ -z "$RTC_DEVICE_FILE" ]; then
- rtcwake -m mem -s 30
+ rtcwake -m on -s 30 &
+ systemctl suspend
else
- rtcwake -d "$RTC_DEVICE_FILE" -m mem -s 30
+ rtcwake -d "$RTC_DEVICE_FILE" -m on -s 30 &
+ systemctl suspend
fi
fi
else
@@ -285,9 +287,11 @@ command:
else
echo "Calling rtcwake"
if [ -z "$RTC_DEVICE_FILE" ]; then
- rtcwake -m mem -s 30
+ rtcwake -m on -s 30 &
+ systemctl suspend
else
- rtcwake -d "$RTC_DEVICE_FILE" -m mem -s 30
+ rtcwake -d "$RTC_DEVICE_FILE" -m on -s 30 &
+ systemctl suspend
fi
fi
estimated_duration: 90.000