It’s been a bit since I’ve posted and I plan to start making posts much more often. In the mean time I have been running into an issue with my laptop where the bluetooth device doesn’t turn back on after resuming from suspend. I have a bluetooth mouse and keyboard and they work great with my Fedora 20 install. When I put the laptop in suspend, and resume it, I no longer have use of the bluetooth devices. I have to manually reconnect them which is frustrating because I suspend my laptop a lot during the day.

I found after testing that the devices were still paired with the bluetooth manager but the bluetooth device on the laptop was no longer powered on. By turning it on, everything started to work again. Simple solution, make sure bluetooth turns on the adapter after resume from suspend.

I know I’m not the only person with this issue and after spending a bit of time reading and writing, I found the solution.

I actually found the solution from Arch Linux bluetooth section. Link: https://wiki.archlinux.org/index.php/Bluetooth

 

Edit or Add this file:

/etc/udev/rules.d/10-local.rules

 

Add to this file:

# Set bluetooth power up
ACTION=="add", KERNEL=="hci0", RUN+="/usr/bin/hciconfig hci0 up"

By doing do this will make sure bluetooth comes on after reboot.

 

Here is the meat and potatos!

Edit or Add this file:

/etc/systemd/system/bluetooth-auto-power@.service

 

Add to this file:

[Unit]
Description=Bluetooth auto power on
After=bluetooth.service sys-subsystem-bluetooth-devices-%i.device suspend.target
 
[Service]
Type=oneshot
#We could also do a 200 char long call to bluez via dbus. Except this does not work since bluez does not react to dbus at this point of the resume sequence and I do not know how I get this service to run at a time it does. So we just ignore bluez and force %i up using hciconfig. Welcome to the 21st century.
#ExecStart=/usr/bin/dbus-send --system --type=method_call --dest=org.bluez /org/bluez/%I org.freedesktop.DBus.Properties.Set string:org.bluez.Adapter1 string:Powered variant:boolean:true
ExecStart=/usr/bin/hciconfig %i up
 
[Install]
WantedBy=suspend.target

This works flawlessly! I have zero issues and bluetooth always comes back on, connects the device and I go back to working!!!

 

Leave a reply

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

required


SimplyCaptcha