Mines too. However, it seems that the gps.conf file is not used by location service.
How do you ascertain that? Are you sure that you are not using the network-based location service in microG Settings?
No. I have no android support activated.
I think you are right, all the SUPL servers give me the same result, no quick fix. Maybe the old Certifacte stored in the GPS blob expired a few months ago, i doubt that we will see a fix for this anytime soon by Jolla
For me a fix can take between 30 seconds and several minutes, and when my location is changed with GPS switched off it is the same again. No problem on an Android device, which gets the fix nearly instantly.
supl.pos.nlp.nokia.com works for me as well and is not Google.
supl.qxwz.com only provides a self signed cert and probably won’t work:
$ openssl s_client -connect supl.qxwz.com:7275
CONNECTED(00000003)
depth=0 C = CN, ST = Shanghai, L = Shanghai, O = QianXun, OU = AGNSS, CN = supl.qxwz.com
verify error:num=18:self signed certificate
verify return:1
I came accross the cert issue when trying to run my own SUPL proxy. I could see the phone connecting but TLS negotiation failed against a LetsEncrypt chain, that verifies ok with openssl.
Fortunately some of the more common root certs (Verisign for Nokia/Here, GlobalSign for Google) seem to be preinstalled in the SOC’s firmware.
Regarding certificate upload in Sony’s AOSP release, that doesn’t seem to be used even on Android. Without some writabable slots for certificates (# AGPS_CERT_WRITABLE_MASK=0 in /etc/gps.conf), uploads are not possible.
Edit/Update: The preinstalled certs are available in the FSG partition (/dev/mmcblk0p6). To extract them as root run
# tail -c +1065 /dev/mmcblk0p6 | tar xvf -
And here the bad news begin …
- Verisign is not included, hence Nokia’s SUPL server does not work
- Availabe are
- Equifax, expired Aug 22 16:41:51 2018 GMT,
- GlobalSign, expires Dec 15 08:00:00 2021 GMT,
- Sony Ericsson, expired Dec 31 11:01:29 2019 GMT
So SUPL against Google will stop working in December unless we get a way to upload a new cert.
I checked on xa2, SFOS 3.2.1.20 and found only SonyEricsson cert in SuplRootCert. So maybe a newer SFOS ( hence some updated blobs?, android10?) brought those in?
As the SonyEricsson SUPL server is long gone.
@martinh
I would really like to achieve supl working but still I fail. Would you mind to list all your settings regarding (I think):
/etc/gps.conf
/etc/location/location.conf
maybe /etc/hosts
and whatever you tweaked?
TIA
The FSG partition is propbaly never touched by Jolla (it’s digitally signed by either Qualcomm or Sony) but depends on the AOSP release. I’m on 8.1.0_4.4_nile_v16 but I’ve also downloaded H3113_Customized DE_50.2.A.3.77-R1B
and in fsg_X-FLASH-ALL-18AE.sin
you will find the same certs.
# zcat fsg_X-FLASH-ALL-18AE.sin| tar xvf -
# tail -c +1065 fsg.000| tar tvf -
...
-rw-rw-rw- root/root 804 1970-01-01 01:00 /SUPL/Equifax.crt
-rw-rw-rw- root/root 958 1970-01-01 01:00 /SUPL/GlobalSignR2.crt
-rwxrwxrwx root/root 879 1970-01-01 01:00 /SUPL/SuplRootCert
I doubt that will help because without the GlobalSign Root CA - R2
available in the SOC SUPL requests will fail. Without flashing at least the FSG partition (and probably also modemst1 and modemst2) you are probably out of luck and I’ve no idea if that’s sufficient. As @nekron already explained, to keep SUPL working after Dec. 15 or make it work at all we either need a way to upload a new cert to the SOC or a way to switch TLS off.
Anyway here is my /etc/location/location.conf
:
[location]
agreement_accepted=true
enabled=true
gps\enabled=true
mls\enabled=true
custom_mode=false
mls\online_enabled=true
mls\agreement_accepted=true
allowed_data_sources\online=true
allowed_data_sources\device_sensors=true
allowed_data_sources\bt_addr=true
allowed_data_sources\wlan_data=true
allowed_data_sources\cell_data=true
allowed_data_sources\gps=true
allowed_data_sources\glonass=true
allowed_data_sources\beidou=true
allowed_data_sources\galileo=true
allowed_data_sources\qzss=true
allowed_data_sources\sbas=true
And here are my changes on /etc/gps.conf
:
# diff -ub gps.conf.orig gps.conf
--- gps.conf.orig
+++ gps.conf
@@ -19,11 +19,11 @@
# Asia
# NTP_SERVER=asia.pool.ntp.org
# Europe
-# NTP_SERVER=europe.pool.ntp.org
+NTP_SERVER=europe.pool.ntp.org
# North America
# NTP_SERVER=north-america.pool.ntp.org
-NTP_SERVER = time.google.com
+# NTP_SERVER = time.google.com
# If NTP_SERVER is commented NTP_SERVER=time.izatcloud.net is used
@@ -33,7 +33,7 @@
DEBUG_LEVEL = 2
# Intermediate position report, 1=enable, 0=disable
-INTERMEDIATE_POS=0
+INTERMEDIATE_POS=1
# GPS Capabilities bit mask
# SCHEDULING = 0x01
@@ -60,8 +61,12 @@
# AGPS_CERT_WRITABLE_MASK=0
# FOR SUPL SUPPORT, set the following
-SUPL_HOST=supl.sonyericsson.com
+SUPL_HOST=supl.google.com
SUPL_PORT=7275
+SUPL_MODE=1
+SUPL_ES=1
+SUPL_VER=0x10000
################################
# EXTRA SETTINGS
In my DNS I blocked location.services.mozilla.com
but only to speed things up, since that request will fail anyhow. The same can obviously also be achieved by adding a line to /etc/hosts
:
127.0.0.1 location.services.mozilla.com
Hello Martin,
Thanks for your investigations. You are right that there is no RootCA slot in gps.conf hence injecting should not work for Xperia devices even if you would call the certificate inject API somehow.
As for Xperia X (F5121) the FSG partition is mmcblk0p17
and sadlly you find only this SuplRootCert in the signed MBN blob:
# tail -c +1065 /dev/mmcblk0p17 | tar xvf -
$ openssl x509 -in ./SUPL/SuplRootCert -inform der --text
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 0 (0x0)
Signature Algorithm: sha1WithRSAEncryption
Issuer: C = SE, L = Lund, O = Sony Ericsson Mobile Communications AB, OU = Sony Ericsson Secure E2E
Validity
Not Before: Jan 1 11:01:29 2000 GMT
Not After : Dec 31 11:01:29 2019 GMT
Subject: C = SE, L = Lund, O = Sony Ericsson Mobile Communications AB, OU = Sony Ericsson Secure E2E
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public-Key: (2048 bit)
Modulus:
A long gone SE certificate for the long gone supl.sonyericsson.com
service.
I think we are doomed regarding SUPL support in any of the current available devices. FSG partition must be updated by some signed MBN blob that only Sony can provide.
Why the heck is a SUPL root CA anyway statically included in the modem firmware? That makes no sense to me as it’s planned obsolescence and degrading the function of fast GPS fix.
But wth is it then working on Android (or AOSP) devices?
–
answer myself:
because it is injected?
Good question.
Since GPS works with the original Android OS the problem has to be Sailfish related and therefore there is most likely a Sailfish fix than can be implemented.
In my experience GPS also works in Sailfish for about a week after flashing to Android and back to Sailfish. I’ve done this a few times and it always has a noticeable effect.
I flashed to Android quite recently and once again confirmed this behaviour.
Unfortunately my XA2 got water damaged so I’m unlikely to continue fiddling with it. It was dieing anyways with increasing number of crashes.
Edit: One more thing. Using MLS manager from openrepos breaks the GPS completely. There’s no lock at all. Device only mode is the only one that’s some what working. I’m in Finland.
Just thinking out loud: One possible solution could be to configure modem NVRAM ID 3758* to false
and use non-TLS port 7276 instread of 7275 or explore EFS and upload an updated certificate if possible.
However to get this working we would need diag
port available via USB but I don’t see /sys/class/android_usb/android0/f_diag/clients
on Xperia XA2 or 10 even if kernel was compiled with F_DIAG=y (Xperia X, Jolla 1 and Jolla C have this configfs path available):
# Xperia 10 Mark I
[root@Sailfish ~]# uname -a
Linux Sailfish 4.9.230 #1 SMP PREEMPT Wed Feb 24 23:02:15 UTC 2021 aarch64 GNU/Linux
[root@Sailfish ~]# zcat /proc/config.gz | grep DIAG
CONFIG_PACKET_DIAG=y
CONFIG_UNIX_DIAG=y
CONFIG_INET_DIAG=y
CONFIG_INET_TCP_DIAG=y
CONFIG_INET_UDP_DIAG=y
CONFIG_INET_DIAG_DESTROY=y
CONFIG_NETLINK_DIAG=y
CONFIG_DIAG_CHAR=y
CONFIG_DIAG_OVER_USB=y
CONFIG_USB_F_DIAG=y
CONFIG_USB_CONFIGFS_F_DIAG=y
# Xperia 10 Mark I -> No diag :(
[root@Sailfish ~]# ls -l /sys/class/android_usb/
total 0
lrwxrwxrwx 1 root root 0 May 24 15:21 android0 -> ../../devices/virtual/android_usb/android0
lrwxrwxrwx 1 root root 0 May 24 15:21 f_audio_source -> ../../devices/virtual/android_usb/android0/f_audio_source
lrwxrwxrwx 1 root root 0 May 24 15:21 f_audio_source1 -> ../../devices/virtual/android_usb/android0/f_audio_source1
lrwxrwxrwx 1 root root 0 May 24 15:21 f_midi -> ../../devices/virtual/android_usb/android0/f_midi
lrwxrwxrwx 1 root root 0 May 24 15:21 f_ncm -> ../../devices/virtual/android_usb/android0/f_ncm
[root@Sailfish ~]#
# Xperia X -> Diag available :)
[nemo@Sailfish ~]$ ls -l /sys/class/android_usb/
total 0
lrwxrwxrwx 1 root root 0 May 24 10:52 android0 -> ../../devices/virtual/android_usb/android0
lrwxrwxrwx 1 root root 0 May 24 18:39 f_accessory -> ../../devices/virtual/android_usb/android0/f_accessory
lrwxrwxrwx 1 root root 0 May 24 18:39 f_acm -> ../../devices/virtual/android_usb/android0/f_acm
lrwxrwxrwx 1 root root 0 May 24 18:39 f_audio -> ../../devices/virtual/android_usb/android0/f_audio
lrwxrwxrwx 1 root root 0 May 24 18:39 f_audio_source -> ../../devices/virtual/android_usb/android0/f_audio_source
lrwxrwxrwx 1 root root 0 May 24 18:39 f_ccid -> ../../devices/virtual/android_usb/android0/f_ccid
lrwxrwxrwx 1 root root 0 May 24 18:39 f_charging -> ../../devices/virtual/android_usb/android0/f_charging
lrwxrwxrwx 1 root root 0 May 24 18:39 f_diag -> ../../devices/virtual/android_usb/android0/f_diag
lrwxrwxrwx 1 root root 0 May 24 18:39 f_ecm -> ../../devices/virtual/android_usb/android0/f_ecm
lrwxrwxrwx 1 root root 0 May 24 18:39 f_ecm_qc -> ../../devices/virtual/android_usb/android0/f_ecm_qc
lrwxrwxrwx 1 root root 0 May 24 18:39 f_ffs -> ../../devices/virtual/android_usb/android0/f_ffs
lrwxrwxrwx 1 root root 0 May 24 18:39 f_gps -> ../../devices/virtual/android_usb/android0/f_gps
lrwxrwxrwx 1 root root 0 May 24 18:39 f_hid -> ../../devices/virtual/android_usb/android0/f_hid
lrwxrwxrwx 1 root root 0 May 24 18:39 f_mass_storage -> ../../devices/virtual/android_usb/android0/f_mass_storage
lrwxrwxrwx 1 root root 0 May 24 18:39 f_midi -> ../../devices/virtual/android_usb/android0/f_midi
lrwxrwxrwx 1 root root 0 May 24 18:39 f_mtp -> ../../devices/virtual/android_usb/android0/f_mtp
lrwxrwxrwx 1 root root 0 May 24 18:39 f_ncm -> ../../devices/virtual/android_usb/android0/f_ncm
lrwxrwxrwx 1 root root 0 May 24 18:39 f_ptp -> ../../devices/virtual/android_usb/android0/f_ptp
lrwxrwxrwx 1 root root 0 May 24 18:39 f_qdss -> ../../devices/virtual/android_usb/android0/f_qdss
lrwxrwxrwx 1 root root 0 May 24 18:39 f_rmnet -> ../../devices/virtual/android_usb/android0/f_rmnet
lrwxrwxrwx 1 root root 0 May 24 18:39 f_rmnet_smd -> ../../devices/virtual/android_usb/android0/f_rmnet_smd
lrwxrwxrwx 1 root root 0 May 24 18:39 f_rndis -> ../../devices/virtual/android_usb/android0/f_rndis
lrwxrwxrwx 1 root root 0 May 24 18:39 f_rndis_qc -> ../../devices/virtual/android_usb/android0/f_rndis_qc
lrwxrwxrwx 1 root root 0 May 24 18:39 f_serial -> ../../devices/virtual/android_usb/android0/f_serial
lrwxrwxrwx 1 root root 0 May 24 18:39 f_uasp -> ../../devices/virtual/android_usb/android0/f_uasp
lrwxrwxrwx 1 root root 0 May 24 18:39 f_usb_mbim -> ../../devices/virtual/android_usb/android0/f_usb_mbim
[nemo@Sailfish ~]$
So adding diag settings to /etc/usb-moded/dyn-modes/developer_mode-android.ini
(config/dyn-modes/diag_mode.ini · master · mer-core / usb-moded · GitLab) will not expose diag port to remote host where you could use some tools to change the NVRAM AGPS setting.
*) 3758 == AAGPS Use Transport Security
UPDATE: Looks like configfs /config
folder is missing function for diag.diag
so no kernel module is loaded and hence no /sys folders for diag settings and exposing over USB via usb_moded.
[root@Sailfish functions]# pwd
/config/usb_gadget/g1/functions
[root@Sailfish functions]# ls -l
total 0
drwxr-xr-x 2 root root 0 May 24 15:18 accessory.gs2
drwxr-xr-x 2 root root 0 May 24 15:18 audio_source.gs2
drwxr-xr-x 2 root root 0 May 24 15:18 audio_source.gs3
drwxr-xr-x 2 root root 0 May 24 15:18 ffs.adb
drwxr-xr-x 2 root root 0 May 24 15:18 ffs.mtp
drwxr-xr-x 2 root root 0 May 24 15:18 ffs.ptp
drwxr-xr-x 3 root root 0 May 24 15:18 mass_storage.usb0
drwxr-xr-x 2 root root 0 May 24 15:18 midi.gs5
drwxr-xr-x 3 root root 0 May 24 15:18 mtp.gs0
drwxr-xr-x 2 root root 0 May 24 15:18 ncm.0
drwxr-xr-x 3 root root 0 May 24 15:18 ptp.gs1
drwxr-xr-x 2 root root 0 May 24 15:18 rmnet_bam.dpl
drwxr-xr-x 2 root root 0 May 24 15:18 rmnet_bam.rmnet
drwxr-xr-x 2 root root 0 May 24 15:18 rndis_bam.rndis
Hello. Having gone through most of the page, I am relatively confused. what is the best way to have a gps fix fast? (Or should I rather say is there a way … this OS becomes a real pain on a daily basis …)
(XA2-4.1.0.23)
A few days ago I tried to navigate with XA2. It took about one hour to get fix. I don’t think there will be working navigation for this device.
It should be better in 4.1. Did you set everything as recommended in release notes?
Yes i did it.Impossible to get a fix. In fact, i NEVER get a fix even in the past, on olders SFOS versions. But GPS was working on android …
Seriously, this is so frustrating.
I installed Positioning for my area and also activated GPS + Mozilla offline positioning. I have a working fix, though: I have got a cheap Android phone for navigation and Bluetooth LE usage. No SIM - no monthly costs for that.
I flashed 4.1.0.24 to my Xperia XA2 and Xperia X yesterday. I did not use/touch the location service then.
There is no SIM card in either phone.
As a preparation:
- Installed GPSinfo (Sailfish app) from Jolla Store.
- Installed Positioning Northern Europe from Jolla Store
At about 15:10:
-
Enabled the following settings on the phone:
- Settings > System > Location > Custom settings: ON
- Settings > System > Location > Select custom settings:
- GPS positioning: ON
- Offline position lock: ON
- Online position lock: OFF
-
Put both phones to my window with good visibility to the south-eastern sky
At about 15:12 (after ~2 minutes), both phones were still without the location. XA2 had 0/23 and X had 0/16 satellites.
At about 15:13 (after ~3 minutes), XA2 had 5/29 satellites and the location. X had 1/17 satellites.
At about 15:12 (after ~5 minutes), both phones had the location and 7/29 satellites.
This cold start inside my house was sluggish but it worked.
Pretty much what I did, the only difference is I have updated my XA2 via UI several times during last year. Often it takes 10…20 minutes to get fix, sometimes even one hour. Yes, it will get a fix but often after I’m back at home already. Not good test results.
Xperia 10 ii is much quicker. I flashed clean system and set location settings exactly as in my XA2 (and what you did, @jovirkku). 10 ii gets location fix within one minute even inside house far away from windows.
Today I took XA2 to glazed terrace with view to sky. 10 min and no location, wlan 2.4 GHz active. Then I disconnected wlan and got a fix within 10 seconds. Coincidence or HW interference?