PirateBox-Dev / PirateBoxScripts_Webserver

PirateBox Scriptcollection for running in Webserver
GNU General Public License v3.0
206 stars 102 forks source link

RPi3 wifi vs additional wifi dongle #155

Closed MaStr closed 7 years ago

MaStr commented 8 years ago

https://forum.piratebox.cc/read.php?7,19718

Seems there are inconsistencies or other things that prevent a smooth transition between onboard wifi to external wifi.

MaStr commented 7 years ago

The problem is a conflicting udev rule together with wifi detection. The udev rule starts on each detected wifi device (wlan*). This triggers starter.sh (https://github.com/PirateBox-Dev/PirateBoxScripts_Webserver/blob/master/piratebox/piratebox/rpi/bin/starter.sh#L3).

If starter.sh is able to find a valid wifi device, it starts the piratebox automatically.

wifi_detect.sh https://github.com/PirateBox-Dev/PirateBoxScripts_Webserver/blob/master/piratebox/piratebox/rpi/bin/wifi_detect.sh Detects the needed hostap version based on any device-driver message. It favors nl80211 over every other wifi device. The result is, that the realtek chipsets won't come in place, if needed. Or another option is that the onboard device of RPi3 over-rules always.

My assumption for a manual fix (not script fix) is:

  1. Remove udev rule
  2. Manually install needed hostap version
  3. adjust opt/piratebox/conf/hostapd.conf & piratebox.conf (wifi adapter name)
  4. Enable USB probing in piratebox.conf
  5. Enable PirateBox for startup via systemctl

A script fix might be something like:

ref: https://www.kernel.org/pub/linux/utils/kernel/hotplug/udev/udev.html http://www.reactivated.net/writing_udev_rules.html

MaStr commented 7 years ago

@stylesuxx , can you have a look at this patch ced3258 ? Just throw in some comments :)

MaStr commented 7 years ago

Did some more bugfixes around this. Works quite well.

stylesuxx commented 7 years ago

Hey looks good to me, I just browsed the source but did not test it. I can see if I can find some time on the weekend to test it. One of my work projects is coming to an end next week (I hope this time for real). After that I should have more time than for sleep and work :-(

MaStr commented 7 years ago

No worries. Have a look at the complete branch history of patch-rpi3-wifi-issue I made some tests this morning and added smaller fixes.

In addition I found out that the extra handling for the realtek chips is not needed anymore... 👍 But within 1.1 I won't remove it