{"id":667,"date":"2014-06-27T20:27:06","date_gmt":"2014-06-27T19:27:06","guid":{"rendered":"http:\/\/blog.thogersens.net\/?p=667"},"modified":"2014-07-01T21:26:18","modified_gmt":"2014-07-01T20:26:18","slug":"a-little-trick","status":"publish","type":"post","link":"https:\/\/jakobsens.net\/?p=667","title":{"rendered":"A little wireless trick"},"content":{"rendered":"<p>My media center PC has a wireless network adapter and of cause a BIG blue light on the front of the PC.<\/p>\n<p>As wireless network connection and a media center (with slow CPU) streaming movies is not a good combination I wanted to disable the wireless card.<\/p>\n<p>To do that I used the command <strong>ifconfig.<\/strong><\/p>\n<p>First type:<\/p>\n<pre>$&gt; ifconfig -a<\/pre>\n<pre>eth0\u00a0\u00a0\u00a0\u00a0\u00a0 Link encap:Ethernet\u00a0 HWaddr 00:01:02:03:04:05:06 \r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 inet addr:192.168.0.153\u00a0 Bcast:10.25.1.255\u00a0 Mask:255.255.255.0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 inet6 addr: fe80::201:2eff:fe3b:c50f\/64 Scope:Link\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 UP BROADCAST RUNNING MULTICAST\u00a0 MTU:1500\u00a0 Metric:1\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 RX packets:154476 errors:0 dropped:0 overruns:0 frame:0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 TX packets:77817 errors:0 dropped:0 overruns:0 carrier:0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 collisions:0 txqueuelen:1000 \r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 RX bytes:168840925 (168.8 MB)\u00a0 TX bytes:5938729 (5.9 MB)\r\n\r\nlo\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Link encap:Local Loopback \u00a0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 inet addr:127.0.0.1\u00a0 Mask:255.0.0.0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 inet6 addr: ::1\/128 Scope:Host\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 UP LOOPBACK RUNNING\u00a0 MTU:65536\u00a0 Metric:1\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 RX packets:376 errors:0 dropped:0 overruns:0 frame:0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 TX packets:376 errors:0 dropped:0 overruns:0 carrier:0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 collisions:0 txqueuelen:0 \r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 RX bytes:45071 (45.0 KB)\u00a0 TX bytes:45071 (45.0 KB)\r\n\r\nwlan0\u00a0\u00a0\u00a0\u00a0 Link encap:Wireless\u00a0 HWaddr\u00a000:01:02:03:04:05:07\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 inet addr:192.168.0.153\u00a0 Bcast:10.25.1.255\u00a0 Mask:255.255.255.0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 inet6 addr: fe80::201:2eff:fe3b:c60f\/64 Scope:Link\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 BROADCAST MULTICAST\u00a0 MTU:1500\u00a0 Metric:1\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 RX packets:0 errors:0 dropped:0 overruns:0 frame:0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 collisions:0 txqueuelen:1000 \r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 RX bytes:0 (0.0 B)\u00a0 TX bytes:0 (0.0 B)\r\n\r\n<\/pre>\n<p>As you can see from the output I have 3 network adapters: <strong>eth0, lo, wlan0<\/strong>.<br \/>\nYou might get other output, like eth1, lo, wlan0 etc.<\/p>\n<p>I want to disable the wireless adapter: wlan0<\/p>\n<p>At the command line I type:<\/p>\n<pre>$&gt; sudo ifconfig wlan0 down\r\n[sudo] password for gopher:<\/pre>\n<p>Then the wireless adapter is disabled and the stupid blue light is gone!<\/p>\n<p>To enable the wireless adapter again type:<\/p>\n<pre>$&gt; sudo ifconfig wlan0 up\r\n[sudo] password for gopher:<\/pre>\n<p>Then the wireless adapter is enabled and the stupid blue light is on again!<\/p>\n<p>To have the wireless adapter disabled every time the media center start add the command to the end of the file <strong>\/etc\/rc.local<\/strong> (before the exit 0).<br \/>\nUse a editor like <strong>nano<\/strong> or <strong>kate<\/strong> etc. to change the file.<\/p>\n<pre>$&gt; sudo nano \/etc\/rc.local\r\n!\/bin\/sh -e\r\n#\r\n# rc.local\r\n#\r\n# This script is executed at the end of each multiuser runlevel.\r\n# Make sure that the script will \"exit 0\" on success or any other\r\n# value on error.\r\n#\r\n# In order to enable or disable this script just change the execution\r\n# bits.\r\n#\r\n# By default this script does nothing.\r\n\r\n<strong>ifconfig wlan0 down<\/strong>\r\n\r\nexit 0\r\n\r\n<\/pre>\n<p>Now I just found that out after a suspend the wireless network adapter was enabled again.<\/p>\n<p>To solve it I have to disable the wlan0 adapter during the resume. Create a file called \/etc\/pm\/sleep.d\/20_custom_wlan0<\/p>\n<pre>$&gt; sudo nano \/etc\/pm\/sleep.d\/20_custom_wlan0<\/pre>\n<p>Add the following to the file:<\/p>\n<pre># Script to disable wlan0 before suspend and restart after wake.\r\ncase \"${1}\" in\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 suspend|hibernate)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo suspending 20_custom-wlan0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ;;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 resume|thaw)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo Resumeing\u00a020_custom-wlan0 - shutting down wlan0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ifconfig wlan0 down\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ;;\r\nesac\r\n\r\n<\/pre>\n<p>Save the files and make sure is executable:<\/p>\n<pre>$&gt; sudo chmod 755 \/etc\/pm\/sleep.d\/20_custom-wlan0<\/pre>\n<p>The file is named 20&lt;something&gt; because I want the file to called a relative late in resume process. On my system there is a file called 60&lt;something&gt; which enable the wireless network adapter and I want to disable it again.<\/p>\n<p>To see the scripts called during the suspend process go through the log file:<\/p>\n<pre>\/var\/log\/pm-suspend.log<\/pre>\n<p>Thats it, good luck \ud83d\ude42<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My media center PC has a wireless network adapter and of cause a BIG blue light on the front of the PC. As wireless network connection and a media center (with slow CPU) streaming movies is not a good combination I wanted to disable the wireless card. To do that I used the command ifconfig. [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-667","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/jakobsens.net\/index.php?rest_route=\/wp\/v2\/posts\/667","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jakobsens.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jakobsens.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jakobsens.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jakobsens.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=667"}],"version-history":[{"count":4,"href":"https:\/\/jakobsens.net\/index.php?rest_route=\/wp\/v2\/posts\/667\/revisions"}],"predecessor-version":[{"id":675,"href":"https:\/\/jakobsens.net\/index.php?rest_route=\/wp\/v2\/posts\/667\/revisions\/675"}],"wp:attachment":[{"href":"https:\/\/jakobsens.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=667"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jakobsens.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=667"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jakobsens.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=667"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}