View Single Post
Posts: 97 | Thanked: 318 times | Joined on Feb 2012 @ Switzerland
#310
I should have posted that for a long time now, but I wanted to install the CM13 port first...

I have completely rewritten the bluetooth low-power-mode script. It is now based on a single permanent dbus listener. The implementation is much cleaner. Also I was able to fix the problems some of you had, when trying to connect some devices.

I use that next generation script for a long time now with no problems with my car audio system, bt-headphones and a HiFi bt-adapter.

Feel free to report problems...

Source: https://github.com/minimec/bt-sleep-monitor

#How it works... : A dbus-monitor process is listening for different dbus events in parallel:
# - Bluetooth power on/off
# - Bluetooth connections
# - Display events
# When an event is triggered the program will decide whether to enable/disable
# or temporarily disable bluetooth suspend (low power mode).
# If bluetooth is powered and in low power mode, a display event will disable suspend mode for 60 seconds ($BTACTIVE).
# In case there is no bluetooth connection after that time, suspend mode is enabled again.


This is a copy/paste instruction to replace the implemented script in the CM13 port.

Code:
# login root console
devel-su

# stop/disable old services
systemctl stop bt-sleep-monitor.service
systemctl mask bt-sleep-monitor.service
systemctl mask bt-sleep-monitor.timer

# Download new files and put them in place
curl -o /usr/bin/bt-sleep-monitor https://raw.githubusercontent.com/minimec/bt-sleep-monitor/master/bt-sleep-monitor

curl -o /lib/systemd/system/bt-sleep-monitor-ng.service https://raw.githubusercontent.com/minimec/bt-sleep-monitor/master/bt-sleep-monitor.service

# Make script executable
chmod +x /usr/bin/bt-sleep-monitor

# Remove executalbe rights from the old script
chmod -x /usr/bin/bt-sleep-monitor.sh

# reload systemd units
systemctl daemon-reload

# Start service
systemctl enable bt-sleep-monitor-ng.service
systemctl start bt-sleep-monitor-ng.service

# Exit root console
exit

Last edited by minimec; 2018-05-19 at 20:11.
 

The Following 5 Users Say Thank You to minimec For This Useful Post: