summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hwdb.d/60-autosuspend.hwdb7
-rwxr-xr-xhwdb.d/parse_hwdb.py1
-rw-r--r--rules.d/60-autosuspend.rules4
3 files changed, 12 insertions, 0 deletions
diff --git a/hwdb.d/60-autosuspend.hwdb b/hwdb.d/60-autosuspend.hwdb
index 15dcc2f1ee..e9304f440d 100644
--- a/hwdb.d/60-autosuspend.hwdb
+++ b/hwdb.d/60-autosuspend.hwdb
@@ -24,6 +24,13 @@
#
# Allowed properties are:
# ID_AUTOSUSPEND=1
+# ID_PERSIST=0
+#
+# 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
+# is unable to recover the state when resuming. See
+# https://www.kernel.org/doc/html/latest/driver-api/usb/persist.html
# Sort by brand, model
diff --git a/hwdb.d/parse_hwdb.py b/hwdb.d/parse_hwdb.py
index dea71acfe9..f385e52628 100755
--- a/hwdb.d/parse_hwdb.py
+++ b/hwdb.d/parse_hwdb.py
@@ -134,6 +134,7 @@ def property_grammar():
('MOUSE_WHEEL_CLICK_COUNT', INTEGER),
('MOUSE_WHEEL_CLICK_COUNT_HORIZONTAL', INTEGER),
('ID_AUTOSUSPEND', Or((Literal('0'), Literal('1')))),
+ ('ID_PERSIST', Or((Literal('0'), Literal('1')))),
('ID_INPUT', Or((Literal('0'), Literal('1')))),
('ID_INPUT_ACCELEROMETER', Or((Literal('0'), Literal('1')))),
('ID_INPUT_JOYSTICK', Or((Literal('0'), Literal('1')))),
diff --git a/rules.d/60-autosuspend.rules b/rules.d/60-autosuspend.rules
index 1f9ebef631..332d052caa 100644
--- a/rules.d/60-autosuspend.rules
+++ b/rules.d/60-autosuspend.rules
@@ -11,4 +11,8 @@ SUBSYSTEM=="i2c", ATTR{name}=="cyapa", \
ENV{ID_AUTOSUSPEND}=="1", TEST=="power/control", \
ATTR{power/control}="auto"
+# Disable USB persist if hwdb says so.
+ENV{ID_PERSIST}=="0", TEST=="power/persist", \
+ ATTR{power/persist}="0"
+
LABEL="autosuspend_end"