{"id":70,"date":"2019-11-19T22:56:29","date_gmt":"2019-11-19T22:56:29","guid":{"rendered":"http:\/\/hotelectron.co.uk\/?p=70"},"modified":"2019-11-19T22:56:29","modified_gmt":"2019-11-19T22:56:29","slug":"fedora-28-wakes-immediately-after-suspend-solution","status":"publish","type":"post","link":"https:\/\/hotelectron.co.uk\/?p=70","title":{"rendered":"Fedora 28 wakes immediately after suspend [solution]"},"content":{"rendered":"\n<p>In Fedora 28 on my Dell Precision laptop, when I close the lid, the suspension starts, but the laptop wakes up almost immediately, so I cannot suspend properly.<\/p>\n\n\n\n<p>The problem is that BlueTooth is causing the laptop to ignore the suspend signal. This is easily fixed with the following workaround.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Turn on bluetooth and type &#8216;lsusb&#8217;. In my case I see this <\/li><\/ol>\n\n\n\n<p>Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub<br> Bus 001 Device 007: ID 8087:0a2b Intel Corp. <br> Bus 001 Device 004: ID 0bda:5650 Realtek Semiconductor Corp. <br> Bus 001 Device 003: ID 0a5c:5834 Broadcom Corp. <br> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub<\/p>\n\n\n\n<p>Now turn off Bluetooth and again type &#8216;lsusb&#8217;. Now I see this<\/p>\n\n\n\n<p>Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub<br>\nBus 001 Device 004: ID 0bda:5650 Realtek Semiconductor Corp. <br>\nBus 001 Device 003: ID 0a5c:5834 Broadcom Corp. <br>\nBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub<\/p>\n\n\n\n<p>So from this, I know that the USB device is vendor 8087 and product 0a2b. I need these values for the next step.<\/p>\n\n\n\n<p>Now create a file called \/usr\/local\/bin\/bluetooth-sleep and in it, paste this :-<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>!\/bin\/bash<br> Disable bluetooth given first argument &#8220;start&#8221;<br> Re-enable bluetooth given first argument &#8220;stop&#8221;<br> Expects vendor and product as sedond and 3rd arguments<br> set -eu<br> usage() {<br>   script_name=&#8221;\/usr\/local\/bin\/bluetooth-sleep&#8221;<br>   printf &#8216;%s: de-authorise bluetooth during sleep\/suspend\\n&#8217; &#8220;$script_name&#8221; &gt;&amp;2<br>   printf &#8216;Usage: %s (start|stop)  \\n&#8217; &#8220;$script_name&#8221; &gt;&amp;2<br>   exit 1<br> }<br> case &#8220;${1:-}&#8221; in<br>   start) value=0 ;;<br>   stop)  value=1 ;;<br>   *)     usage   ;;<br> esac<br> [ $# -ne 3 ] &amp;&amp; usage<br> vendor=$2<br> product=$3<br> shopt -s nullglob<br> for dir in \/sys\/bus\/usb\/devices\/*; do<br>   if [[ -L &#8220;$dir&#8221; &amp;&amp; -f $dir\/idVendor &amp;&amp; -f $dir\/idProduct &amp;&amp;<br>       $(cat &#8220;$dir\/idVendor&#8221;) == &#8220;$vendor&#8221; &amp;&amp;<br>       $(cat &#8220;$dir\/idProduct&#8221;) == &#8220;$product&#8221; ]] ; then<br>     echo &#8220;$value&#8221; &gt; &#8220;$dir\/authorized&#8221;<br>     echo &#8220;echo $value &gt; $dir\/authorized&#8221;<br>   fi<br> done<\/p><\/blockquote>\n\n\n\n<p>Next, create a file called <code>\/etc\/systemd\/system\/bluetooth-disable-before-sleep.service<\/code><\/p>\n\n\n\n<p>In it, paste this :-<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>[Unit]<br> Description=disable bluetooth for system sleep\/suspend targets<br> Before=sleep.target<br> Before=suspend.target<br> Before=hybrid-sleep.target<br> Before=suspend-then-hybernate.target<br> StopWhenUnneeded=yes<br> [Service]<br> Type=oneshot<br> RemainAfterExit=yes<br> Usage: blootooth-sleep (start|stop)  <br> Get values from <code>lsusb<\/code><br> eq: Bus 001 Device 003: ID 8087 0a2b Intel Corp<br> Usage: bluetooth-sleep (start|stop) 8087 0a2b<br> ExecStart=\/usr\/local\/bin\/bluetooth-sleep start 8087 0a2b<br> ExecStop= \/usr\/local\/bin\/bluetooth-sleep stop 8087 0a2b<br> [Install]<br> WantedBy=sleep.target<br> WantedBy=suspend.target<br> WantedBy=hybrid-sleep.target<br> WantedBy=suspend-then-hibernate.target<\/p><\/blockquote>\n\n\n\n<p>Note that the values used in this second file include 8087 and 0a2b which relate to the bluetooth device connected to the internal usb hub (it is not a plugin usb device).<\/p>\n\n\n\n<p>The final step is to enable the new service<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>systemctl enable <code>bluetooth-disable-before-sleep.service<\/code><\/p><\/blockquote>\n\n\n\n<p>You should be able to turn off bluetooth by running :-<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>\/usr\/local\/bin\/bluetooth-sleep start 8087 0a2b<\/p><\/blockquote>\n\n\n\n<p>and turn it on again by running :-<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>\/usr\/local\/bin\/bluetooth-sleep stop 8087 0a2b<\/p><\/blockquote>\n\n\n\n<p>And now that you have started the systemctl process, closing your laptop lid should first turn off bluetooth and then suspend. The suspend should now work. And when you open the laptop, the bluetooth should restart.<\/p>\n\n\n\n<p>I hope it works for you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Fedora 28 on my Dell Precision laptop, when I close the lid, the suspension starts, but the laptop wakes up almost immediately, so I cannot suspend properly. The problem is that BlueTooth is causing the laptop to ignore the suspend signal. This is easily fixed with the following workaround. Turn on bluetooth and type &hellip; <a href=\"https:\/\/hotelectron.co.uk\/?p=70\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Fedora 28 wakes immediately after suspend [solution]&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-70","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/hotelectron.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/70","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hotelectron.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hotelectron.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hotelectron.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hotelectron.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=70"}],"version-history":[{"count":1,"href":"https:\/\/hotelectron.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/70\/revisions"}],"predecessor-version":[{"id":71,"href":"https:\/\/hotelectron.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/70\/revisions\/71"}],"wp:attachment":[{"href":"https:\/\/hotelectron.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=70"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hotelectron.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=70"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hotelectron.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=70"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}