WiFi works!!! A successful experience. [ SCRIPTS PROVIDED ]
If you're looking for a graphical way to manage wifi on Replicant 6.0, an app is now available at http://redmine.replicant.us/boards/9/topics/14079.¶
It seems like someone could be mislead by the way my original post was written, so I want to make things clear:
This thread is about making WiFi work USING AN EXTERNAL DONGLE. The internal Broadcom chip is not yet usable in freedom.
I just wanted to share my enthusiasm for my recent successful experience in making WiFi work on Replicant, using this external dongle.
As I've already written [[here]] , I spent a couple of days working on the command line, and now I have a usable WiFi client on my Replicant Phone!
Thanks to Tibi (Tehnoetic) for releasing all the necessary patches to Replicant and the fundamental scripts for wpa_supplicant!
I'm now planning to develop a graphical front-end to make it usable by everyone.
I'm providing every detail I can to those who want to learn more, so if you're curious, just ask!
P.S. please read [[this]] and help if you can!
I am now proud to provide some useful free-licensed scripts, to make the WiFi experience a bit easier:
the basic instructions are the same provided here
I'm going to update Tehnoetic's wiki too, as soon as I'm able.
The HUGE difference I discovered is that IT IS NOT NECESSARY TO FORMAT THE /data PARTITION in order to recover from a system crash.
Instead, it is sufficient to chmod the /data/misc/wifi folder and all its contents to 777.
Maybe some less privilege is sufficient, but I haven't tried yet. I only tried 777, and it works. If someone finds out that less privilege is needed, please let us know, as "least privilege" is always the best philosophy!
Other improvements I was able to achieve are:
1) the ability to scan for available networks, and connect to the one of interest by simply choosing a number from the list, and providing the relative WPA password.
2) a better management of the connection, with both connect and disconnect scritps.
3) an automated way to write the configuration file for wpa_supplicant.
So, without further introduction, here are the instructions:
(It is assumed that you have tehnoetic's unofficial version of Replicant running on the target device which must be an i9100)
- Back up all of your data! Back up all of your data! Back up all of your data!
All the scripts and relative instructions are provided "AS IS" without ANY warranty.
I tested all of the following instructions, and they SHOULD cause no harm, but I don't take any responsibility for any data loss or any damage to your device.
- Download and copy the needed drivers/firmwares for ath9k (refer to: https://wiki.tehnoetic.com/doku.php?id=tehnoetic_wifi_replicant)
- Download the scripts attached to this post.
- Copy all the scripts to /data/misc/wifi:
adb push startwpa.sh /data/misc/wifi adb push rstr.sh /data/misc/wifi adb push check_modules.sh /data/misc/wifi adb push connect.sh /data/misc/wifi adb push disconnect.sh /data/misc/wifi adb push select_network.sh /data/misc/wifi adb push write_config.sh /data/misc/wifi
- To prepare the environment run the rstr.sh script on the target device, in terminal emulator, running as root.
(the "rstr" script can be used both at system startup to set up the environment, and after a crash, to restore it)
# bash /data/misc/wifi/rstr.sh
- To scan for available WiFi networks, run the "select_network.sh" script
# bash /data/misc/wifi/select_network.sh
- The script scans for networks, and lists the available ones:
Scanning for networks... OK Retrieving network list... Please input the number of the network you want to connect to: # | SSID ---|------------------ 1) | JustAnotherWiFi_AP 2) | SuperFastNetwork 3) | ARandomISPname1234
- (EXAMPLE) Enter 1 to connect to JustAnotherWiFi_AP, the script will then ask for a PSK password for the connection:
Enter a password for JustAnotherWiFi_AP
- Input the password and press enter. The script will automatically set up "wpa_supplicant.conf" for the desired connection. You will then be asked if you want to connect:
Network connection has been set up for JustAnotherWiFi_AP! Do you want to connect to JustAnotherWiFi_AP now? [y/n]
- Input "y" to connect.. Everything should work...
- BEFORE UNPLUGGING THE DONGLE: make sure you stop wpa_supplicant and dhcpcd, to avoid possible crashes!
During my tests, I have found that a rough 90% of the crashes must be due to a lack of current to the external dongle.
I fact, crashes tend to occur when the device battery is low (below 40%) or when doing CPU-intensive operations (e.g. playing 720p videos while being connected).
I'm going to try and use a "Y" cable together with an additional power supply ("power bank"), and see if the situation gets better.
Apart from this, regular web browsing (no heavy graphics or scripts) should work like a charm.
If you encounter any problem, ask here or on the mailing list. I'll be glad to help you if I'm able to, as soon as my schedule allows me to.
Any improvements and corrections are very, very, very welcome, so please, if you find a bug, or have any suggestion, don't hesitate to answer this post or write on the mailing list.
My idea was, and still is, to write an application to provide a GUI around these scripts.
But, as of now, I still haven't been able to overcome the numerous troubles I encountered in trying to get Replicant's SDK work in Eclipse.
That's to say: if someone wants to help, we can join efforts and do The Right Thing to make Replicant even better then now!
I hope many of you will find my work useful and enjoyable!
|write_config.sh (1.07 KB) write_config.sh
|writes a config file for wpa_supplicant using provided parameters (SSID and password)
|select_network.sh (2.76 KB) select_network.sh
|Scans for available connections and lets you choose one to connect to.
|check_modules.sh (2.45 KB) check_modules.sh
|checks if the needed drivers are loaded
|connect.sh (1.12 KB) connect.sh
|connects to the network using current wpa_supplicant.conf file
|disconnect.sh (180 Bytes) disconnect.sh
|stops dhcpcd and wpa_supplicant
|rstr.sh (1.2 KB) rstr.sh
|sets up or restores the working environment
|startwpa.sh (82 Bytes) startwpa.sh
|starts wpa_supplicant without configuration, in order to make it work wit wpa_cli
RE: WiFi works!!! A successful experience. [ SCRIPTS PROVIDED ] - Added by Fil Bergamo almost 7 years ago
Kurtis Hanna wrote:
jc gargma wrote:
I can only speculate that apps like F-Droid and Antox in some way check the system status for whether the wifi and/or mobile data toggles are enabled and abort outgoing connection attempts right away if both are turned off.
I hadn't seen this mentioned so far, and I doubt I'm the only one that tried refreshing F-Droid and mistakenly concluded the scripts don't work.
This F-Droid bug seems to speak to this very issue, except it is someone using Replicant 4.2 with reverse tether: https://gitlab.com/fdroid/fdroidclient/issues/816
Perhaps F-Droid has other bugs related to this too. One user suggests downgrading F-Droid to the version before they started doing this internet check.
From the F-Droid issue:
"We did indeed add some code to try and detect the type of connection, so that people can select the setting "Only update automatically on unmetered networks like Wi-Fi". It seems that we have been a bit too strict though." https://gitlab.com/pserwylo (Peter Serwylo) <-- someone should probably talk to Peter.
As reported on the Issue #1792 page, I'm on the way to solve the problem.
I would need a list of applications that present the same f-droid issue, to test them out with my fix, and see if it works for all of them.
As for reverse-tethering, I will need to study the scripts, and find out a way to write a similar fix, and I'm sure it can be done!