[updated Magisk Module] Step By Step Definitive Gps Solution (global)

Discussion in 'Xiaomi Mi 5' started by ianhughes74, Jan 8, 2018.

  1. ianhughes74

    Jan 6, 2018
    13
    4
    15
    Male
    #1ianhughes74,Jan 8, 2018
    Last edited: May 5, 2018
    *This module also works for any another device with Snapdragon chipset based, so feel free to test it on another device that have Magisk and recommend for your friends that want a better GPS experience and functionality.

    The original gps.conf file present in any version of MIUI is very wrong, it has a lot of bad information and settings for the correct operation of the GPS and A-GPS. In my video on this thread that I compare the native MIUI file with my edited file, you'll see the big difference with a lot of bad settings and a lot of # that precedes relevant information, this aborts/cancels the line.
    So, I've made changes for a better optimization that have the best results.

    A little reflection tested and proven by myself: If you have a nice firmware version with wrong gps.conf you won't have good results with the GPS, but if you have any firmware version with gps.conf file correctly edited, maybe you might get better results.
    Then we can finally conclude that, the Xiaomi Mi5 don't have any hardware problem with GPS. What happens is that the firmware works in conjunction with the file.

    Explaining some of my changes:
    1 - Now basically the A-GPS data files are XTRA 3.0 files (It provides GPS, GLO and BDS assistance data) served over HTTPS with SSL and without # preceding the address lines while the default was XTRA 2.0 (provides only GPS and GLO) served over HTTP without SSL, this allows an attacker to mount a MITM attack on the network level and modify the GPS assistance data while in transit.
    2 - I switched the XTRA_VERSION_CHECK from 0 to 3 because it's obvious that xtra3grc.bin are XTRA 3.0 files.
    3- I included the address servers from pool.ntp.org as the main NTP server because it's global, the system will try finding the closest available servers for you. (in my video you'll se my daily file with brazilian servers, don't worry.)
    4 - I set SUPL_HOST google.com as default, before was qxwz.com and this is an A-GPS server in China. Google server is more "Global" and can do the job very well.
    5 - I updated the SUPL version from 2.0 to 3.0
    6 - I changed the SUPL_MODE from 3 (so bad, this option doesn't even exist) to 0x2 (MSA), under normal circumstances, the MSA method is applicable to situation which the satellite signal is poor, to achieve a single positioning.
    7 - Changed the value of GPS CAPABILITIES from 0x37 to 0x35 for correctly MSA mode functionality.
    8 - Changed the LTE Positioning Profile Settings from 0 (RRLP) to 1 (LPP_User_Plane)
    9 - Changed the A-GLONASS Positioning Protocol from 0 to 0x4 (LLP Uplane)
    The reason for the 8 and 9 changes is because SUPL 3.0 doesn't support RRC and RRLP anymore.

    [Step By Step]
    *Please, before just check if yours gps.conf is located at /system/etc or /system/vendor/etc and then choose the corresponding .zip file. gpsconfN.zip is for file located on /system/etc path and gpsconfO.zip is for file located on /system/vendor/etc path.
    It's Magisk install-able, don't install it by TWRP but with Magisk instead! (Thanks to Dusan @uvera00 for having created this Mod of my optimized gps.conf file)
    1 - Go on Magisk > Modules > Click on "+" yellow button > Long press on that gpsconfN.zip (Nougat) or gpsconfO (Oreo) file and select open and after installed then reboot your device.
    2 - Make sure your location settings is setup on mode "High accuracy"
    3 - Skirt outdoors, can be in the yard of your house or anywhere else with a line of sight to the sky, download some Compass app on Google Play Store (I recommend the Compass Steel 3D) and then calibrate the compass.
    4 - Stay in that outdoor place and download GPS Locker on Google Play Store and open the app and wait for the first time fix/lock. This is necessary and essential because the app will recognize some GPS satellites signals for the very first time.

    *Note 1 - Location mode "Battery saving" is gone due to Google's location accuracy is now a binary setting.
    *Note 2 - Consider using the GPS Locker app because it is much better than the GPS Test and GPS Data. You just need to open it once and wait for fix, then your gps signal is locked and when you close it the app keep awake running in the background. (press Cancel in "Unlock GPS on exit" message). GPS was made to work on outdoor places. For indoor/enclosed places such as inside of your house don't forget that, it will take a few minutes to fix. It drains more battery, but is required if you're an advanced user that use gps all the time.
    Whenever I'm on the street I keep the GPS Locker and Cellular data open because I use Cerberus antitheft, so if I get mugged or if I lose my phone I can track him down and retrieve it.

    gpsconfN.zip: https://goo.gl/GnLEwx
    gpsconfO.zip: https://goo.gl/VfDdKR
     
    Nobody67 and ingbrzy like this.
  2. ianhughes74

    Jan 6, 2018
    13
    4
    15
    Male
    I hope I've helped. Please, if someone test this give me some feedback if it worked for you.
    Thanks
     
  3. tmz83

    tmz83Members

    Mar 7, 2014
    72
    7
    20
    Male
    I've put your GPS.conf on latest 9.2 stable

    I'll let you know

    Inviato dal mio MI 5 utilizzando Tapatalk
     
  4. tmz83

    tmz83Members

    Mar 7, 2014
    72
    7
    20
    Male
    Emh... Now no gpx fix at all...

    Inviato dal mio MI 5 utilizzando Tapatalk
     
  5. tmz83

    tmz83Members

    Mar 7, 2014
    72
    7
    20
    Male
    Fix after 7 minutes on the second try

    Inviato dal mio MI 5 utilizzando Tapatalk
     
  6. Lappen

    LappenMembers

    Dec 30, 2017
    10
    2
    5
    Male
    #6Lappen,Jan 12, 2018
    Last edited: Jan 12, 2018
    hi, i testet your gps config now for a few days and it works really well.
    it makes the xiaomi mi5 gps in android 7 finally usable again. it sometimes jumps a bit around in accuracy, but thats not the gps.conf fault, but android 7 or more acurate the xiaomi firmware on android 7

    i tested your config with miui 8.1.4.0 global which is the latest with android 6 and there it is just excellent.
    it got down to 3m and stayed there very reliably

    i tested the difference with android 6 and 7 before and wrote the results in this thread: http://en.miui.com/thread-1133678-1-1.html

    so long story short. your gps.conf makes gps on miui9/android7 on xiaomi mi5 finally usable again. on miui8/android 6 its just unbeatable :)
     
  7. Lappen

    LappenMembers

    Dec 30, 2017
    10
    2
    5
    Male
    double post. pls delete
     
  8. ianhughes74

    Jan 6, 2018
    13
    4
    15
    Male
    I don't believe it. Did you follow all the steps on my tutorial? It's not just about replace the gps.conf file. Read again with attention!
     
  9. ianhughes74

    Jan 6, 2018
    13
    4
    15
    Male
    Thanks for the good feedback, brother. On Android 8.1.0 Oreo my accuracy in outdoor places is 3m too, but on any Android 7 Nougat ROM it got 4m.
     
  10. ianhughes74

    Jan 6, 2018
    13
    4
    15
    Male
    Don't know what you're talking about, I think this has been deleted.
     
  11. ianhughes74

    Jan 6, 2018
    13
    4
    15
    Male
    LAST UPDATED FINAL VERSION check it out!
     
    Nobody67 likes this.