]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Add support to set autosuspend delay via hwdb
authorMario Limonciello <superm1@gmail.com>
Tue, 10 May 2022 01:16:22 +0000 (20:16 -0500)
committerMario Limonciello <superm1@gmail.com>
Tue, 10 May 2022 02:14:12 +0000 (21:14 -0500)
hwdb.d/60-autosuspend.hwdb
hwdb.d/parse_hwdb.py
rules.d/60-autosuspend.rules

index 1b6c1e1c8fc154673dad9505685d06e93a26adc5..323611d0003ea44bfacb18c384f0243dbfc4562c 100644 (file)
 #
 # Allowed properties are:
 #    ID_AUTOSUSPEND=1
+#    ID_AUTOSUSPEND_DELAY_MS=####
 #    ID_PERSIST=0
 #
+# ID_AUTOSUSPEND_DELAY_MS adjusts the delay for autosuspend to something
+# different than the kernel default of 2000ms.
+#
 # ID_PERSIST=0 allows disabling the kernels USB "persist" feature, which allows
 # the continued use of devices after a power loss (due to suspend). Disable it
 # if the device will loose state without a USB power session and the driver
index 93179b675c9977578abee03fe83c6fef68818e67..7bad559699b0e99789501cbc5762e1ec03dbb979 100755 (executable)
@@ -135,6 +135,7 @@ def property_grammar():
              ('MOUSE_WHEEL_CLICK_COUNT', INTEGER),
              ('MOUSE_WHEEL_CLICK_COUNT_HORIZONTAL', INTEGER),
              ('ID_AUTOSUSPEND', Or((Literal('0'), Literal('1')))),
+             ('ID_AUTOSUSPEND_DELAY_MS', INTEGER),
              ('ID_AV_PRODUCTION_CONTROLLER', Or((Literal('0'), Literal('1')))),
              ('ID_PERSIST', Or((Literal('0'), Literal('1')))),
              ('ID_PDA', Or((Literal('0'), Literal('1')))),
index 332d052caa3bf7a893b1f8ec9d519a04f3866259..ce31a920edbb300c7d556064b6b624dd6a2c4d36 100644 (file)
@@ -15,4 +15,8 @@ ENV{ID_AUTOSUSPEND}=="1", TEST=="power/control", \
 ENV{ID_PERSIST}=="0", TEST=="power/persist", \
   ATTR{power/persist}="0"
 
+# Set up an autosuspend delay if hwdb say so
+ENV{ID_AUTOSUSPEND_DELAY_MS}!="", TEST=="power/control", \
+  ATTR{power/autosuspend_delay_ms}="$env{ID_AUTOSUSPEND_DELAY_MS}"
+
 LABEL="autosuspend_end"