LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Auto starting bluetooth after hibernate (https://www.linuxquestions.org/questions/slackware-14/auto-starting-bluetooth-after-hibernate-4175455553/)

daf1kpp 03-25-2013 03:53 PM

Auto starting bluetooth after hibernate
 
Hi,
I used to use hibernate at my slack 14.0 (kde).

I have problem annoying me and I want to fix it somehow, hope you will help me.

Scenario is like...
i use hibernate. pc turned off. i power on pc. pc is up. i log in. all is ok - all windows/apps back + bluettoth manager and bluetooth is ON.


why is it ON ? how to keep it off ? well i know i could do it like
chmod -x /etc/rc.d/rc.bluetooth
but i use bluetooth sometimes and i want to use it, but why the hell is it starting up after hibernate ?


ty for help

Mike_M 03-25-2013 04:04 PM

I used to have the same issue before I disabled bluetooth completely on my laptop (I only very rarely use it).

To work around this I wrote the following script:

Code:

#!/bin/sh
#
# In order to help save power on my laptop, I want the Bluetooth radio
# to be disabled unless I need to use it.  I already turn it off at boot
# time from rc.local.  But it is re-enabled after a resume from suspend.
#

case "$1" in
  hibernate|suspend)
      # Nothing to do during suspend
      ;;
  thaw|resume)
      # Wait a few seconds for the system to resume, otherwise one of
      # the other scripts may keep the Bluetooth radio enabled.  No
      # doubt there is a more elegant solution to this.
      sleep 5
      /usr/sbin/rfkill block bluetooth
      ;;
  *) exit $NA
      ;;
esac

I saved that as /etc/pm/sleep.d/00disable_bluetooth and made it executable. This turned the bluetooth radio off after a resume, but still allowed me to turn it on via the bluetooth applet when I needed it.

dklovedoctor 06-05-2013 11:13 AM

Quote:

Originally Posted by Mike_M (Post 4918656)
I used to have the same issue before I disabled bluetooth completely on my laptop (I only very rarely use it).

To work around this I wrote the following script:

Code:

#!/bin/sh
#
# In order to help save power on my laptop, I want the Bluetooth radio
# to be disabled unless I need to use it.  I already turn it off at boot
# time from rc.local.  But it is re-enabled after a resume from suspend.
#

case "$1" in
  hibernate|suspend)
      # Nothing to do during suspend
      ;;
  thaw|resume)
      # Wait a few seconds for the system to resume, otherwise one of
      # the other scripts may keep the Bluetooth radio enabled.  No
      # doubt there is a more elegant solution to this.
      sleep 5
      /usr/sbin/rfkill block bluetooth
      ;;
  *) exit $NA
      ;;
esac

I saved that as /etc/pm/sleep.d/00disable_bluetooth and made it executable. This turned the bluetooth radio off after a resume, but still allowed me to turn it on via the bluetooth applet when I needed it.

Searching the forum, I found this post as the closest to my problem.
I also want to take some actions after the resume takes place. I used your solution when I hibernated my system with the pm-hibernate command. That worked ok.
However, for some reason I cannot find, pm-hibernate does not work at my system any more and I use this command to hibernate my system:
echo disk > /sys/power/state
However, since now pm-hibernate is not used, the solution offered does not work. Do you have anything else to suggest?
I use opesuse 12.1 MileStone 3 (Asparagus)
Many thanx.


All times are GMT -5. The time now is 09:27 AM.