diff --git a/debian/librem5-base-defaults.bluetooth-brcmfmac.service b/debian/librem5-base-defaults.bluetooth-brcmfmac.service index 8f192c2a5b04124e0d99f0bd3b5525c4f7732ae6..9883e939f3520cf93976c82e19c4926b53f2abf7 100644 --- a/debian/librem5-base-defaults.bluetooth-brcmfmac.service +++ b/debian/librem5-base-defaults.bluetooth-brcmfmac.service @@ -3,10 +3,12 @@ Description=Bluetooth attachment for brcmfmac driver After=sys-bus-sdio-drivers-brcmfmac-mmc1:0001:1.device BindsTo=sys-bus-sdio-drivers-brcmfmac-mmc1:0001:1.device ConditionPathExists=/etc/firmware/brcm/BCM4362A2.hcd +StopWhenUnneeded=true [Install] -WantedBy=sys-bus-sdio-drivers-brcmfmac-mmc1:0001:1.device +RequiredBy=sys-bus-sdio-drivers-brcmfmac-mmc1:0001:1.device [Service] Type=forking -ExecStart=/usr/bin/hciattach -s 115200 /dev/ttymxc3 bcm43xx 1500000 +ExecStart=sh -c '/usr/bin/hciattach -s 115200 /dev/ttymxc3 bcm43xx 1500000 || /usr/bin/hciattach -s 1500000 /dev/ttymxc3 bcm43xx 1500000' +Restart=on-abort diff --git a/debian/librem5-base-defaults.install b/debian/librem5-base-defaults.install index 07d32f0b8902000c55944e651fcf5187fb787a05..c33a30660975984d8df0207fc4555e56c2818825 100644 --- a/debian/librem5-base-defaults.install +++ b/debian/librem5-base-defaults.install @@ -56,6 +56,9 @@ default/systemd/systemd-localed.service.d/* lib/systemd/system/systemd-localed.s # enable zram default/systemd/zram-generator.conf.d/* lib/systemd/zram-generator.conf.d/ +# suspend hooks +default/systemd/system-sleep/* lib/systemd/system-sleep/ + # initramfs modules default/initramfs-tools/modules.d/* usr/share/initramfs-tools/modules.d/ diff --git a/default/systemd/system-sleep/bluetooth-brcmfmac b/default/systemd/system-sleep/bluetooth-brcmfmac new file mode 100755 index 0000000000000000000000000000000000000000..6df98603476c5f441909ef7972c361093fb377a1 --- /dev/null +++ b/default/systemd/system-sleep/bluetooth-brcmfmac @@ -0,0 +1,11 @@ +#!/bin/sh +# Stop hciattach before system suspend to not interfere with +# freshly reset card after resume. +# +# No need to start it back here as it gets restarted automatically +# because of RequiredBy relation in its systemd unit. +case "${1}/${2}" in + hibernate|suspend|pre*) + systemctl stop bluetooth-brcmfmac.service + ;; +esac