9.2 KiB
Sailfish OS Xperia devices A-GPS SUPL Patcher
_____ __ ______ __ ____ __ __
/ ___// / / / __ \/ / / __ \____ _/ /______/ /_ ___ _____
\__ \/ / / / /_/ / / / /_/ / __ `/ __/ ___/ __ \/ _ \/ ___/
___/ / /_/ / ____/ /___ / ____/ /_/ / /_/ /__/ / / / __/ /
/____/\____/_/ /_____/ /_/ \__,_/\__/\___/_/ /_/\___/_/
What's this all about?
This is a small command line tool to fix your long lasting A-GPS issues with official supported Xperia X devices.
Use it at our own risk.
[root@Sailfish nemo]# ./suplpatch --help
Usage of ./suplpatch:
-disable
disable SUPL TLS transport in modem
-enable
enable SUPL TLS transport in modem
-info
print modem information
-remove
remove Google and Let's Encrypt root certs from modem
-upload
upload Google and Let's Encrypt root certs to modem
-version
show version
Who should use it?
- You should be familar with Linux shell and have developer mode enabled on your device
- Your device suffers from delayed GPS fixes and you want to speed things up
- Your are aware of Google SUPL service and decreased privacy
Requirements for working A-GPS solution
A-GPS / SUPL support is a modem-internal process. Therefor the modem must
- have a valid SIM card in your device
- have GPRS / data connection setup and activated, i.e. you can connect to the internet from your mobile without using wifi
- have location service activated and high precision option selected (not exclusive device more nor custom settings)
- have positioning package from harbour installed for the region you are living
- nope, it's not working on wifi-only connections, go buy a mobile subscription
Preparation
Install binary
- copy
suplpatch
binary to your device (scp or use terminal app) devel-su
chmod +x suplpatch
Optional: Backup your modem settings
ls -l /dev/block/platform/soc.0/by-name/ | grep modemst
Find the mmcblk devices with modemst1
and modemst2
.
Example:
lrwxrwxrwx 1 root root 22 Jan 16 16:49 modemst1 -> ../../../../mmcblk0p14
lrwxrwxrwx 1 root root 22 Jan 16 16:49 modemst2 -> ../../../../mmcblk0p15
dd if=/dev/mmcblk0p14 of=modemst1.bin
dd if=/dev/mmcblk0p15 of=modemst2.bin
Option 1: Disable SUPL TLS transport
This is the easiest way and no certificates will be uploaded to modem. However after this all SUPL requests will be send unencrypted over the internet to Google or other unencrypted SUPL services.
You can trigger TLS deactivation using the --disable
flag.
[root@Sailfish nemo]# ./suplpatch --disable
______ _____ __ ___ __ __
/ __/ / / / _ \/ / / _ \___ _/ /_____/ / ___ ____
_\ \/ /_/ / ___/ /__ / ___/ _ `/ __/ __/ _ \/ -_) __/
/___/\____/_/ /____/ /_/ \_,_/\__/\__/_//_/\__/_/
SailfishOS Xperia X devices A-GPS SUPL Patcher v0.0.1.6 (git: 6f1c86c, build: 20.01.2022 15:55)
2022/01/20 16:01:38 ------------------------------------------------------------------------------------------
2022/01/20 16:01:38 SailfishOS Xperia X devices A-GPS SUPL Patcher v0.0.1.6 (git: 6f1c86c, build: 20.01.2022 15:55)
2022/01/20 16:01:38 Command line './suplpatch' launched with the following flags ...
2022/01/20 16:01:38 --disable=true
2022/01/20 16:01:38 --enable=false
2022/01/20 16:01:38 --info=false
2022/01/20 16:01:38 --remove=false
2022/01/20 16:01:38 --upload=false
2022/01/20 16:01:38 --version=false
2022/01/20 16:01:38 Executable launched as user 'root@Sailfish'.
2022/01/20 16:01:38 Secure SUPL mode successfully deactivated.
2022/01/20 16:01:38 Bye.
This setting can be reverted using the --enable
flag to turn on SUPL TLS again.
Note: For a working TLS protected SUPL request you need updated root certificates in your modem (see option 2).
Now that you disabled SUPL TLS transport you must change your gps.conf
file.
It can be located at /etc/gps.conf
(Xperia X, ...) or /system/vendor/etc/gps.conf
(Xperia 10 II).
# FOR SUPL SUPPORT, set the following
SUPL_HOST=supl.google.com
SUPL_PORT=7276
Change SUPL_HOST
to supl.google.com
and SUPL_PORT
to 7276
.
This is the unencrypted SUPL service provided by Google (port 7275 uses TLS).
Reboot your device to clear previously cached volatile ephemeris data in modem.
If you changed your location settings to high precision
after injection of the SUPL host your modem will fetch ephemeris data from the unencrypted Google endpoint and you should get an A-GPS fix within a few seconds or even faster.
Since SailfishOS might still try to connect to legacy MLS you should also add
127.0.0.1 location.services.mozilla.com
into your /etc/hosts
file to make things a tick faster.
Option 2: Upload additional ROOT certificates
Well, if only Google should know your SUPL request data you should use SUPL TLS transport which is the default modem setting without patching.
However to get this working you need a valid root certificate injected into modem via QMI but missing libhybris bindings and libgeoclue parser support for gps.conf file will not allow this at the moment so you have to upload the required certificates to modem manually.
This is triggered via the --upload
flag.
[root@Sailfish nemo]# ./suplpatch --upload
______ _____ __ ___ __ __
/ __/ / / / _ \/ / / _ \___ _/ /_____/ / ___ ____
_\ \/ /_/ / ___/ /__ / ___/ _ `/ __/ __/ _ \/ -_) __/
/___/\____/_/ /____/ /_/ \_,_/\__/\__/_//_/\__/_/
SailfishOS Xperia X devices A-GPS SUPL Patcher v0.0.1.6 (git: 6f1c86c, build: 20.01.2022 15:55)
2022/01/20 16:02:25 ------------------------------------------------------------------------------------------
2022/01/20 16:02:25 SailfishOS Xperia X devices A-GPS SUPL Patcher v0.0.1.6 (git: 6f1c86c, build: 20.01.2022 15:55)
2022/01/20 16:02:25 Command line './suplpatch' launched with the following flags ...
2022/01/20 16:02:25 --disable=false
2022/01/20 16:02:25 --enable=false
2022/01/20 16:02:25 --info=false
2022/01/20 16:02:25 --remove=false
2022/01/20 16:02:25 --upload=true
2022/01/20 16:02:25 --version=false
2022/01/20 16:02:25 Executable launched as user 'root@Sailfish'.
2022/01/20 16:02:25 CyberTrust root certificate for Google SUPL uploaded to modem successfully.
2022/01/20 16:02:25 ISRGRootX1 root certificate for Let's Encrypt based SUPLs uploaded to modem successfully.
2022/01/20 16:02:25 Bye.
Two new root certificates will be uploaded to your modem (SuplRootCert will not be replaced or modified).
You can revert this (remove the certificates from modem) using the --remove
flag.
The uploaded certificates are:
- CyberTrust Root CA used by Google SUPL service (https://pki.goog/roots.pem)
- ISRGRootX1 used by Let's Encrypt service (https://letsencrypt.org/certs/isrgrootx1.pem)
This gives you the option to host your own TLS encrypted SUPL proxy using a Let's Encrypt signed certificate or otherwise use the Google SUPL TLS service directly.
Now that you enabled SUPL TLS transport you must change your gps.conf
file.
It can be located at /etc/gps.conf
(Xperia X, ...) or /system/vendor/etc/gps.conf
(Xperia 10 II).
# FOR SUPL SUPPORT, set the following
SUPL_HOST=supl.google.com
SUPL_PORT=7275
Change SUPL_HOST
to supl.google.com
and SUPL_PORT
to 7275
.
This is the encrypted SUPL service provided by Google (port 7276 is unencrpyted transport).
Reboot your device to clear previously cached volatile ephimeris data in modem.
If you changed your location settings to high precision
after injection of the SUPL host your modem will fetch ephimeris data from the unencrypted Google endpoint and you should get an A-GPS fix within a few seconds or even faster.
Since SailfishOS might still try to connect to legacy MLS you should also add
127.0.0.1 location.services.mozilla.com
into your /etc/hosts
file to make things a tick faster.
It's not working for me
I've tested suplpatch
with Xperia X and get an A-GPS fix in less than 10 seconds even if the device wasn't using GPS for many days and ephemeris data was expired.
Deactivation of SUPL TLS was verified by proxying requests from a public server to supl.google.com and examing the requests. No TLS hello package or other handshake overhead was send so TLS deactivation works as expected.
Pro-Tip
If you don't worry about your privacy you should simply disable SUPL TLS as TLS handshake uses more traffic than plain SUPL request/response itself.
FAQ
Is this an official tool released by Jolla?
- NO it's a community members attempt to help fixing your A-GPS problems
What does ERR: Unable to open '/dev/diag' device (ioctl DIAG_IOCTL_SWITCH_LOGGING fails (12)).
mean?
- Your modem driver has some problems and you should reboot your device to fix it
How do I ... on my phone?
- If you are not familar with Linux shell or editing tools please wait for an official A-GPS solution by Jolla
Can you add feature ... into the tool?
- This is not a hacking tool for your device modem so don't expect to see VoLTE/VoWifi profile modifications or unlocking of locked radio bands ever