Hi guys!
As I'm not a developer, but did not find a proper section to post this, feel free to edit / move / remove this topic if you feel it necessary / that does not comply.
Short story: updated my HTC One M8 Verizon phone with Viper OneM8 ROM, had some issues during various setups, and at final install I disalowed Google to restore my infos (contacts, apps, wifi settings etc) automatically at initial setup. Did almost all of the restore manually at a later time. But without my saved wifi profiles (arround 200 saved).
As I did not find a proper way to get them from Google, I had to do it old way. Had an older HTC One S, sync'd with Google backup, having full list of all my wifi profiles.
Disclaimer: I cannot take credits for this, as I just double checked and adapted the code found here for my needs (I am a lazy guy, and - as the original code was written to be used "as is" on a linux machine - I did not wanted to reboot to Mint, do the job and revert to Windows afterthat :) ).
So please make backups and don't do it if you don't understand what you are doing! As I take no credit, I also take no responsibility!
The goal: copy relevant info from wpa_supplicant.conf on old phone and put it in wpa_supplicant.conf in the new phone and make it load the new info correctly.
What you need:
- rooted device (rw access to /data/misc/wifi/),
- a backup of wpa_supplicant.conf from the above folder (a previous version) - might be from another device (like in my case).
- working adb tools on a windows computer (for linux see the above disclaimer).
- some basic skills in adb
The job:
1. Get the wpa_supplicant.conf from BOTH devices on your desktop.
This can be done in various ways, I will not get too deep into it. The easiest way is to just copy the wpa_supplicant.conf from /data/misc/wifi/ somewhere on sdcard on devices (using root explorer or similar app - remember, you need root on your device!), and after that just get it with windows explorer or whatever tool you are using to copy files from device to computer.
the adb should look like (I assumed you did copy the file(s) from /data/misc/wifi to the root of your sdcard(s) ):
(from old device)
(from old device)
2. Make a backup of BOTH files you just got! Especially of the EMPTY file, in case you run troubles.
3. Open the wpa_supplicant.FULL with a text editor on your computer and clear the headers. Save afterthat:
Don't use notepad, it's not handling well *nix new lines. You can use notepadd++, wordpad etc.
You need to delete everything in the begining of the .FULL file down to first
(DON'T delete the network={ part or anything bellow it!)
Save the file. Open it again to check headers are gone.
4. Get the content from just saved wpa_supplicant.FULL into wpa_supplicant.EMPTY
Can be done in various ways. Easiest:
Check that now wpa_supplicant.EMPTY is full (filled with original new file headers and your networks info from the FULL file).
5. Put the new file back to new device sdcard and rename it with correct filename:
Again multiple options here (explorer, cloud etc).
Adb should look like:
Check on your device that file is indeed there (also check it's contents with a text editor).
6. Turn off device WiFi
7. Make a backup of /data/misc/wifi/wpa_supplicant.conf:
Adb stuff:
Check on device that both wpa_supplicant.conf AND wpa_supplicant.conf.backup are in place, and they have the same size.
8. Overwrite wpa_supplicant.conf in /data/misc/wifi/ with wpa_supplicant.conf from sdcard:
I prefered to delete the file and copy my version instead of overwriting it:
9. Change permissions for wpa_supplicant.conf:
10. Turn on wifi on device (restart device recommended):
In my case it worked after device reboot, but I did it with wifi turned-on. ;)
Check your saved wifi networks in Settings - WiFi!
Most probably this will not apply to all devices (I remember I saw a wpa_supplicant.conf with encrypted passwords at some point on my device (different ROM, probably original Verizon One M8 ROM), but in some cases might help, as there are few references of how to recover previously saved network details (except Google backup and some apps, that sometimes do not work).
Hope this helps someone!
Thanks!
As I'm not a developer, but did not find a proper section to post this, feel free to edit / move / remove this topic if you feel it necessary / that does not comply.
Short story: updated my HTC One M8 Verizon phone with Viper OneM8 ROM, had some issues during various setups, and at final install I disalowed Google to restore my infos (contacts, apps, wifi settings etc) automatically at initial setup. Did almost all of the restore manually at a later time. But without my saved wifi profiles (arround 200 saved).
As I did not find a proper way to get them from Google, I had to do it old way. Had an older HTC One S, sync'd with Google backup, having full list of all my wifi profiles.
Disclaimer: I cannot take credits for this, as I just double checked and adapted the code found here for my needs (I am a lazy guy, and - as the original code was written to be used "as is" on a linux machine - I did not wanted to reboot to Mint, do the job and revert to Windows afterthat :) ).
So please make backups and don't do it if you don't understand what you are doing! As I take no credit, I also take no responsibility!
The goal: copy relevant info from wpa_supplicant.conf on old phone and put it in wpa_supplicant.conf in the new phone and make it load the new info correctly.
What you need:
- rooted device (rw access to /data/misc/wifi/),
- a backup of wpa_supplicant.conf from the above folder (a previous version) - might be from another device (like in my case).
- working adb tools on a windows computer (for linux see the above disclaimer).
- some basic skills in adb
The job:
1. Get the wpa_supplicant.conf from BOTH devices on your desktop.
This can be done in various ways, I will not get too deep into it. The easiest way is to just copy the wpa_supplicant.conf from /data/misc/wifi/ somewhere on sdcard on devices (using root explorer or similar app - remember, you need root on your device!), and after that just get it with windows explorer or whatever tool you are using to copy files from device to computer.
the adb should look like (I assumed you did copy the file(s) from /data/misc/wifi to the root of your sdcard(s) ):
(from old device)
Code:
adb pull /mnt/sdcard/wpa_supplicant.conf wpa_supplicant.FULL
Code:
adb pull /mnt/sdcard/wpa_supplicant.conf wpa_supplicant.EMPTY
3. Open the wpa_supplicant.FULL with a text editor on your computer and clear the headers. Save afterthat:
Don't use notepad, it's not handling well *nix new lines. You can use notepadd++, wordpad etc.
You need to delete everything in the begining of the .FULL file down to first
Code:
network={
ssid="hro-M"
Save the file. Open it again to check headers are gone.
4. Get the content from just saved wpa_supplicant.FULL into wpa_supplicant.EMPTY
Can be done in various ways. Easiest:
Code:
more wpa_supplicant.FULL >> wpa_supplicant.EMPTY
5. Put the new file back to new device sdcard and rename it with correct filename:
Again multiple options here (explorer, cloud etc).
Adb should look like:
Code:
adb push wpa_supplicant.EMPTY /mnt/sdcard/wpa_supplicant.conf
6. Turn off device WiFi
7. Make a backup of /data/misc/wifi/wpa_supplicant.conf:
Adb stuff:
Code:
adb shell
su
cd /data/misc/wifi
cp wpa_supplicant.conf wpa_supplicant.conf.backup
8. Overwrite wpa_supplicant.conf in /data/misc/wifi/ with wpa_supplicant.conf from sdcard:
I prefered to delete the file and copy my version instead of overwriting it:
Code:
rm wpa_supplicant.conf
cp /mnt/sdcard/wpa_supplicant.conf .
Code:
chown system.wifi wpa_supplicant.conf
In my case it worked after device reboot, but I did it with wifi turned-on. ;)
Check your saved wifi networks in Settings - WiFi!
Most probably this will not apply to all devices (I remember I saw a wpa_supplicant.conf with encrypted passwords at some point on my device (different ROM, probably original Verizon One M8 ROM), but in some cases might help, as there are few references of how to recover previously saved network details (except Google backup and some apps, that sometimes do not work).
Hope this helps someone!
Thanks!