├── LICENSE ├── README.md ├── install.sh ├── wifi-reset.service └── wifi-reset.sh /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Adafruit Industries 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | WiFi Reset Service 2 | ================== 3 | 4 | Systemd service to reset (ifdown & ifup) all wireless interfaces on boot. Greatly improves reliability of wifi adapters on the BeagleBone Black's Debian OS with 3.8 kernel. 5 | 6 | Installation 7 | ============ 8 | 9 | This *must* be run on a BeagleBone Black running the Debian operating system. Get the latest image from: http://beagleboard.org/latest-images 10 | 11 | Next make sure you've upgraded to the latest kernel available by executing once (be sure you device has internet access first): 12 | 13 | ```` 14 | cd /opt/scripts/tools/ 15 | ./update_kernel.sh 16 | ```` 17 | 18 | Once the kernel has updated and the device restarted, install the service by entering the directory where this repository was cloned and executing: 19 | 20 | ```` 21 | ./install.sh 22 | ```` 23 | 24 | You should see the following response: 25 | 26 | ```` 27 | Installing wifi reset service to /opt/wifi-reset. 28 | Installing systemd service to run at boot. 29 | Enabling systemd service. 30 | ```` 31 | 32 | That's it! On boot the service will reset (run ifdown and ifup) all wifi interfaces. 33 | 34 | If you'd ever like to disable the service, run the command: 35 | 36 | ```` 37 | systemctl disable wifi-reset.service 38 | ```` 39 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "Installing wifi reset service to /opt/wifi-reset." 3 | mkdir -p /opt/wifi-reset 4 | cp -f wifi-reset.sh /opt/wifi-reset/wifi-reset.sh 5 | echo "Installing systemd service to run at boot." 6 | cp -f wifi-reset.service /lib/systemd/system/wifi-reset.service 7 | echo "Enabling systemd service." 8 | systemctl enable wifi-reset.service > /dev/null 9 | -------------------------------------------------------------------------------- /wifi-reset.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Wireless Network Reset 3 | 4 | [Service] 5 | Type=oneshot 6 | RemainAfterExit=true 7 | ExecStart=/bin/bash /opt/wifi-reset/wifi-reset.sh 8 | 9 | [Install] 10 | WantedBy=multi-user.target 11 | -------------------------------------------------------------------------------- /wifi-reset.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Bring all wifi interfaces down. 3 | # Identify wifi interfaces as rows from standard output of iwconfig (NOT standard 4 | # error, those are non-wifi interfaces) which start without whitespace. 5 | sleep 30 6 | iwconfig 2> /dev/null | grep -o '^[[:alnum:]]\+' | while read x; do ifdown $x; done 7 | # Bring all wifi interfaces up. 8 | sleep 30 9 | iwconfig 2> /dev/null | grep -o '^[[:alnum:]]\+' | while read x; do ifup $x; done 10 | --------------------------------------------------------------------------------