[systemd-devel] [PATCH 3/3] rules: Enable runtime power management on built-in USB Bluetooth controllers

Matthew Garrett mjg59 at srcf.ucam.org
Sat Apr 18 09:11:57 PDT 2015


From: Matthew Garrett <mjg59 at coreos.com>

If a Bluetooth controller is built into the machine, it should be safe to
enable runtime power management on it. Let's do so.
---
 Makefile.am                     | 3 ++-
 rules/90-usb-bluetooth-pm.rules | 8 ++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)
 create mode 100644 rules/90-usb-bluetooth-pm.rules

diff --git a/Makefile.am b/Makefile.am
index 40cf101..8463a54 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3754,7 +3754,8 @@ dist_udevrules_DATA += \
 	rules/78-sound-card.rules \
 	rules/80-net-setup-link.rules \
 	rules/90-hda-controller-pm.rules \
-	rules/90-hda-codec-pm.rules
+	rules/90-hda-codec-pm.rules \
+	rules/90-usb-bluetooth-pm.rules
 
 nodist_udevrules_DATA += \
 	rules/99-systemd.rules
diff --git a/rules/90-usb-bluetooth-pm.rules b/rules/90-usb-bluetooth-pm.rules
new file mode 100644
index 0000000..ea535f0
--- /dev/null
+++ b/rules/90-usb-bluetooth-pm.rules
@@ -0,0 +1,8 @@
+# USB devices that are internal to the machine should also be safe to autosuspend
+
+ACTION=="add", SUBSYSTEM=="usb", SUBSYSTEMS=="usb", ATTR{removable}=="removable", GOTO="usb_bluetooth_pm_end"
+ACTION=="add", SUBSYSTEM=="usb", SUBSYSTEMS=="usb", ATTR{removable}=="unknown", GOTO="usb_bluetooth_pm_end"
+
+ACTION=="add", SUBSYSTEM=="usb", ATTR{bDeviceClass}=="e0", ATTR{bDeviceSubClass}=="01", ATTR{bDeviceProtocol}=="01", TEST=="power/control", ATTR{power/control}="auto"
+
+LABEL="usb_bluetooth_pm_end"
-- 
2.3.5



More information about the systemd-devel mailing list