• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

LG G4 WiFi Fix - Always all channels on 2.4 GHz

Search This thread

dominik-p

Senior Member
Aug 20, 2015
95
56
WiFi Fix - always all channels on 2.4 GHz

IMPORTANT:
Only for advanced users!
You are an advanced user if you know exactly what you are doing.
You are an advanced user if you know what to do if something went wrong.
You are NOT an advanced user if you know how to do copy+paste.

You can bring your smartphone into a state, so it no longer works.
I am not responsible for anything. The following instructions are only suggestions.


Hello,
I want to show you a way how you prevent your LG G4 to limit wireless channels to 1-11.
This happens when no SIM card is inserted or if the airplane mode is activated.
You get messages like:
"Some Wi-Fi networks unavailable due to unknown location" (English)
"Einige Wi-Fi-Netzwerke sind wegen des unbekannten Standorts nicht verfügbar" (German)
"Algunas redes Wi-Fi no están disponibles debido a una ubicación desconocida" (Spanish)

I studied the log entries and found a line that said "[LGE_PATCH] For Country code DC. ....".
After a long search in the code I have discovered the place that is responsible for the limitation.
It is located in the wifi-service and it sets the WifiCountryCode to "DC" if your location could not be obtained.
For me living in Germany it should be "DE".
The WifiCountryCode named "wifi_country_code" is stored in the "global" table of "/data/data/com.android.providers.settings/databases/settings.db".
Changing it has no effect as it is overwritten instantly.
So we need to modify the program code of "wifi-service".

According to this post: http://forum.xda-developers.com/showpost.php?p=64636618&postcount=8
this guide seems to work on other models from LG and newer Android versions too.
You have to search for the wifi-service.odex file and replace "DC" with your two-letter country code.
Alter the paths of the instructions if you use another phone than LG G4 with Android 5.1 Lollipop!

The following instructions show how to do it on the LG G4 with Android (5.1) Lollipop.

Prerequisites:
ROOT
USB debugging enabled

Procedere:
Connect your G4 to your computer.
Open the command promt and enter the following lines:
Code:
adb shell
mkdir /sdcard/wifi-service
cp /system/framework/arm64/wifi-service.odex /sdcard/wifi-service/64wifi-service.odex
Now a file named "64wifi-service.odex" is on your internal memory located in the folder "wifi-service".
Copy the file to your computer.
Now you have to edit the file.
Don't use the "editor" on windows, use Notepad++
With Strg+F search for "DDD".

You will find exactly one line that contains this::
"DATE_TIME DBG DC DCM DDD DDFName"

Change the value "DC" to "DE" for example (search the internet for the two-letter country code of your country (ISO 3166-1 alpha-2))
"DATE_TIME DBG DE DCM DDD DDFName"

Save the file.
Delete the file "64wifi-service.odex" on your smartphone.
Copy the edited file from your computer to the folder "wifi-service" on your smartphone.

Go back to the command prompt and type this:
Code:
su
You should see an confirmation promt on your smartphone that asks to grant root rights.
Confirm the message.

The command promt should change from $ to # now.
To verify your rights type this:
Code:
id
You should see "uid=0" etc.

Now type in the following lines (I recommend to execute each row seperately):
Code:
mount -o remount,rw /system
cd /system/framework/arm64
cp wifi-service.odex /sdcard/wifi-service/64wifi-service.odex.bak
rm wifi-service.odex
cd /sdcard/wifi-service
cp 64wifi-service.odex /system/framework/arm64/wifi-service.odex
cd /system/framework/arm64
chown 0:0 wifi-service.odex
chmod 0644 wifi-service.odex
echo "restart device"

Check the outputs. There must be no errors!
After hitting the Enter button the last line should output "restart device".

In the folder "wifi-service" on your internal storage you find the original "wifi-service.odex".
It is named "64wifi-service.odex.bak".

Restart your smartphone now.

As from now it does not matter whether a SIM card is inserted or if the airplane mode is activated.
The WiFi channels are no longer limited to 1-11. You can now always use 12 and 13.

Did the instructions help you?
Please give a "Thanks!"

Thank you ;)

For users who speak German:
I wrote this guide in German at first. You can find it on android-hilfe.de
Title: "LG G4 WLAN Fix - immer alle Kanäle"
http://www.android-hilfe.de/thema/lg-g4-wlan-fix-immer-alle-kanaele.710265/
 
Last edited:

fpsq

Senior Member
Nov 20, 2014
142
33
I am using Ultraedit. Nevertheless I only see a hex file and I can not locate a string: "DCM DDD DDFName" Any suggestions?
 

dominik-p

Senior Member
Aug 20, 2015
95
56
It is also passible with your editor.

There are two ways:
1. In HEX mode (default mode)
After hit "Strg + F" enter the string "DDD"
Activate the checkboxes "ASCII suchen" and "Groß-/Kleinschreibung beachten".
You will find excatly one result. (DC is in line 00c6e40h)

2. Deactivate HEX mode (Strg + H)
After hit "Strg + F" enter the string "DDD"
The first result is what you need. (line 10528)

Change "DC" to "DE". Don't change anything else!

Hope I could help.
You are also on V10c? Otherwise line numbers will differ.

Tip:
Make a system.img with "dd" of your current system partition.
If it don't work or you did something wrong you can simply copy it back with "dd".
 
Last edited:

fpsq

Senior Member
Nov 20, 2014
142
33
It is also passible with your editor.

There are two ways:
1. In HEX mode (default mode)
After hit "Strg + F" enter the string "DDD"
Activate the checkboxes "ASCII suchen" and "Groß-/Kleinschreibung beachten".
You will find excatly one result. (DC is in line 00c6e40h)

2. Deactivate HEX mode (Strg + H)
After hit "Strg + F" enter the string "DDD"
The first result is what you need. (line 10528)

Change "DC" to "DE". Don't change anything else!

Hope I could help.
You are also on V10c? Otherwise line numbers will differ.

Tip:
Make a system.img with "dd" of your current system partition.
If it don't work or you did something wrong you can simply copy it back with "dd".
Thanks for all the help! I switched to notepad ++. Found the entry
Code:
DATE_CLASS DATE_KEY 	DATE_TIME DBG DE DCM DDD DDFName DEBUG
in line 17126 though. Changed it successfully! Copied successfully to my phone! No effect! Still no channel 13 without sim. Double checked (copy wifi-service.odex to pc) and look for
Code:
DATE_TIME DBG DE DCM
.

It IS in there. Somehow not taking effect? I had problems when doing "chown 0:0 wifi-service.odex" It tells me "read only file system". I did set the owner and permissions with ES File Explorer. TO: root, root and Read, write; read; read.
 
Last edited:

dominik-p

Senior Member
Aug 20, 2015
95
56
OK I think you are an advanced user. (aren't you?)
You did it right with your app, but it should be possible with the shell too.
Readonly means you are not "su" in shell or/and did not "mount -o remount,rw /system".
Check su with "id" (uid=0) and mount should output something like this:
Code:
/dev/block/bootdevice/by-name/system /system ext4 [B]rw[/B],seclabel,relatime,data=ordered 0 0

Please check that /system/framework/arm64 has only one file named wifi-service.odex in it.
While testing I got to a point where I had two "wifi-service.odex" files with different file permissions in it.
Post an "ls -l" of the folder please.

After removing the SIM card and rebooting your phone look in the "global" table of settings.db and check that "wifi_country_code" is set to "DE".
Please also use catlog to check if wpa_supplicant sets the CountryCode to DE.

PS: for me it's line 17073 in notepad++ Don't know why lines differ.
Filesize of wifi-service.odex is 3903976 bytes for me. You are also on V10c?
 

diogo.sena

Senior Member
Apr 7, 2011
666
273
Thanks for this! just fixed my G3 Marshmallow,
I'm using another region rom, and i think sim country is not properly detected.
 

dominik-p

Senior Member
Aug 20, 2015
95
56
Thanks for reply.
Didn't know that the G3 has this "problem" too and that my solution works on Android M.
I guess it's not the same line "DATE_TIME DBG DC DCM DDD DDFName"
but also a line with the value "DC"?
 

diogo.sena

Senior Member
Apr 7, 2011
666
273
Thanks for reply.
Didn't know that the G3 has this "problem" too and that my solution works on Android M.
I guess it's not the same line "DATE_TIME DBG DC DCM DDD DDFName"
but also a line with the value "DC"?

I just noticed the problem when updating to 6, its another line but very similar:

the full path for the file is /system/framework/oat/arm/wifi-service.odex
Line is 24139
values for the line are "DATE_CLASS DATE_KEY DATE_TIME DATUM_WIDTH DBG DC DCM DD DDD DDFName "

Just changed DC to BR.
 
  • Like
Reactions: dominik-p

valy_cta

Senior Member
Feb 29, 2012
499
186
Constanta
Hello, I know that the thread is quite old, but I have a small problem with the wifi-service.odex file on my phone. Looks scrambled in n++. Is there any setting for n++ that I should use?
My phone is a Le Max2 and I don't have GSM signal at my workplace. The routers are set to automatic and they also use channels 12 and 13.
From what I understand by the commands, you are just pulling the file from system to internal storage, and copying it to the computer, changing it with n++ and copying it back to system. There is no transformation to .jar as I can see...
The file is about 4mb.
Can you provide any help please?
 

dominik-p

Senior Member
Aug 20, 2015
95
56
Hello, I know that the thread is quite old, but I have a small problem with the wifi-service.odex file on my phone. Looks scrambled in n++. Is there any setting for n++ that I should use?
My phone is a Le Max2 and I don't have GSM signal at my workplace. The routers are set to automatic and they also use channels 12 and 13.
From what I understand by the commands, you are just pulling the file from system to internal storage, and copying it to the computer, changing it with n++ and copying it back to system. There is no transformation to .jar as I can see...
The file is about 4mb.
Can you provide any help please?

Hi,
you already created a thread here: https://forum.xda-developers.com/le-max-2/help/wifi-channels-12-13-unable-to-t3773144
Please stay at your own thread for further discussion. This thread here is only for LG devices and the provided fix is only working on some LG devices.

You're right, the odex file looks "scrambled" in Notepad++, but that's no problem. We only had to change one or two letters.
I will answer at your thread "WiFi channels 12 and 13 - unable to see them". (https://forum.xda-developers.com/showthread.php?t=3773144)

For all other users, please read these threads to understand the problem:
WiFi regional problem on Android https://forum.xda-developers.com/wiki/WiFi_regional_problem_on_Android
[GUIDE] WiFi Country Problem Solving for AOSP, MIUI & others https://forum.xda-developers.com/showthread.php?t=2368501
 
  • Like
Reactions: valy_cta

DarkBader

Member
Dec 17, 2019
14
2
Worked cool on LG G4 Stylus

Just a few "logistics" to comment:

-on some devices/models seems to be that /sdcard is no possible to access. Instead, /storage/emulated/0/ or the real path /data/media/0

-when copying the modified wifi-service file to /system/... folder, step on with a "Permission Denied" message. I was Root and /system was mounted as wr. Finally continued by copying using a root explorer and then continuing in the shell.

-after i rebooted, tried to connect on a channel 13 without sucess. I had plain mode. I put off plain mode, changed the country in wpa_supplicant.conf file and rebooted again. After that, all went good
 

dominik-p

Senior Member
Aug 20, 2015
95
56
Just a few "logistics" to comment:

-on some devices/models seems to be that /sdcard is no possible to access. Instead, /storage/emulated/0/ or the real path /data/media/0

-when copying the modified wifi-service file to /system/... folder, step on with a "Permission Denied" message. I was Root and /system was mounted as wr. Finally continued by copying using a root explorer and then continuing in the shell.

-after i rebooted, tried to connect on a channel 13 without sucess. I had plain mode. I put off plain mode, changed the country in wpa_supplicant.conf file and rebooted again. After that, all went good

Thanks for your feedback!
Would you please share your model number and Android version of your "LG G4 Stylus"?
 

DarkBader

Member
Dec 17, 2019
14
2
Question!

Thanks for your feedback!
Would you please share your model number and Android version of your "LG G4 Stylus"?

I had a situation i yet did not solve.


Yesterday i went to some friend's house, where before i could not see their wifi network. And i still can not see it ! :0 :0

I know this method worked, because changed the channel on my router to 12 or 13 and i can see them and connect. Also country code show as i changed it in Wpa_Supplicant and in CountryCode in Android.Providers. I also know is not a hidden network, as my friends can see it and connect normally without problem. Also tried with WPS button, and nothing.
.
-As the "problematic" network is a 5G, maybe is something related with this? lack of technology as my phone model is a bit old nowadays?
But what i understood about 5 G, is that they assure backwards compability :/
.
Maybe u see something i am missing?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 5
    WiFi Fix - always all channels on 2.4 GHz

    IMPORTANT:
    Only for advanced users!
    You are an advanced user if you know exactly what you are doing.
    You are an advanced user if you know what to do if something went wrong.
    You are NOT an advanced user if you know how to do copy+paste.

    You can bring your smartphone into a state, so it no longer works.
    I am not responsible for anything. The following instructions are only suggestions.


    Hello,
    I want to show you a way how you prevent your LG G4 to limit wireless channels to 1-11.
    This happens when no SIM card is inserted or if the airplane mode is activated.
    You get messages like:
    "Some Wi-Fi networks unavailable due to unknown location" (English)
    "Einige Wi-Fi-Netzwerke sind wegen des unbekannten Standorts nicht verfügbar" (German)
    "Algunas redes Wi-Fi no están disponibles debido a una ubicación desconocida" (Spanish)

    I studied the log entries and found a line that said "[LGE_PATCH] For Country code DC. ....".
    After a long search in the code I have discovered the place that is responsible for the limitation.
    It is located in the wifi-service and it sets the WifiCountryCode to "DC" if your location could not be obtained.
    For me living in Germany it should be "DE".
    The WifiCountryCode named "wifi_country_code" is stored in the "global" table of "/data/data/com.android.providers.settings/databases/settings.db".
    Changing it has no effect as it is overwritten instantly.
    So we need to modify the program code of "wifi-service".

    According to this post: http://forum.xda-developers.com/showpost.php?p=64636618&postcount=8
    this guide seems to work on other models from LG and newer Android versions too.
    You have to search for the wifi-service.odex file and replace "DC" with your two-letter country code.
    Alter the paths of the instructions if you use another phone than LG G4 with Android 5.1 Lollipop!

    The following instructions show how to do it on the LG G4 with Android (5.1) Lollipop.

    Prerequisites:
    ROOT
    USB debugging enabled

    Procedere:
    Connect your G4 to your computer.
    Open the command promt and enter the following lines:
    Code:
    adb shell
    mkdir /sdcard/wifi-service
    cp /system/framework/arm64/wifi-service.odex /sdcard/wifi-service/64wifi-service.odex
    Now a file named "64wifi-service.odex" is on your internal memory located in the folder "wifi-service".
    Copy the file to your computer.
    Now you have to edit the file.
    Don't use the "editor" on windows, use Notepad++
    With Strg+F search for "DDD".

    You will find exactly one line that contains this::
    "DATE_TIME DBG DC DCM DDD DDFName"

    Change the value "DC" to "DE" for example (search the internet for the two-letter country code of your country (ISO 3166-1 alpha-2))
    "DATE_TIME DBG DE DCM DDD DDFName"

    Save the file.
    Delete the file "64wifi-service.odex" on your smartphone.
    Copy the edited file from your computer to the folder "wifi-service" on your smartphone.

    Go back to the command prompt and type this:
    Code:
    su
    You should see an confirmation promt on your smartphone that asks to grant root rights.
    Confirm the message.

    The command promt should change from $ to # now.
    To verify your rights type this:
    Code:
    id
    You should see "uid=0" etc.

    Now type in the following lines (I recommend to execute each row seperately):
    Code:
    mount -o remount,rw /system
    cd /system/framework/arm64
    cp wifi-service.odex /sdcard/wifi-service/64wifi-service.odex.bak
    rm wifi-service.odex
    cd /sdcard/wifi-service
    cp 64wifi-service.odex /system/framework/arm64/wifi-service.odex
    cd /system/framework/arm64
    chown 0:0 wifi-service.odex
    chmod 0644 wifi-service.odex
    echo "restart device"

    Check the outputs. There must be no errors!
    After hitting the Enter button the last line should output "restart device".

    In the folder "wifi-service" on your internal storage you find the original "wifi-service.odex".
    It is named "64wifi-service.odex.bak".

    Restart your smartphone now.

    As from now it does not matter whether a SIM card is inserted or if the airplane mode is activated.
    The WiFi channels are no longer limited to 1-11. You can now always use 12 and 13.

    Did the instructions help you?
    Please give a "Thanks!"

    Thank you ;)

    For users who speak German:
    I wrote this guide in German at first. You can find it on android-hilfe.de
    Title: "LG G4 WLAN Fix - immer alle Kanäle"
    http://www.android-hilfe.de/thema/lg-g4-wlan-fix-immer-alle-kanaele.710265/
    1
    Thanks for reply.
    Didn't know that the G3 has this "problem" too and that my solution works on Android M.
    I guess it's not the same line "DATE_TIME DBG DC DCM DDD DDFName"
    but also a line with the value "DC"?

    I just noticed the problem when updating to 6, its another line but very similar:

    the full path for the file is /system/framework/oat/arm/wifi-service.odex
    Line is 24139
    values for the line are "DATE_CLASS DATE_KEY DATE_TIME DATUM_WIDTH DBG DC DCM DD DDD DDFName "

    Just changed DC to BR.
    1
    Hello, I know that the thread is quite old, but I have a small problem with the wifi-service.odex file on my phone. Looks scrambled in n++. Is there any setting for n++ that I should use?
    My phone is a Le Max2 and I don't have GSM signal at my workplace. The routers are set to automatic and they also use channels 12 and 13.
    From what I understand by the commands, you are just pulling the file from system to internal storage, and copying it to the computer, changing it with n++ and copying it back to system. There is no transformation to .jar as I can see...
    The file is about 4mb.
    Can you provide any help please?

    Hi,
    you already created a thread here: https://forum.xda-developers.com/le-max-2/help/wifi-channels-12-13-unable-to-t3773144
    Please stay at your own thread for further discussion. This thread here is only for LG devices and the provided fix is only working on some LG devices.

    You're right, the odex file looks "scrambled" in Notepad++, but that's no problem. We only had to change one or two letters.
    I will answer at your thread "WiFi channels 12 and 13 - unable to see them". (https://forum.xda-developers.com/showthread.php?t=3773144)

    For all other users, please read these threads to understand the problem:
    WiFi regional problem on Android https://forum.xda-developers.com/wiki/WiFi_regional_problem_on_Android
    [GUIDE] WiFi Country Problem Solving for AOSP, MIUI & others https://forum.xda-developers.com/showthread.php?t=2368501