Update README.md

main
Nekron City 2022-01-20 15:33:25 +00:00
parent 72d8b9d924
commit f59bf4d687
1 changed files with 171 additions and 62 deletions

235
README.md
View File

@ -1,93 +1,202 @@
# suplpatcher
### Sailfish OS Xperia devices A-GPS SUPL Patcher ###
SUPL Patcher
## Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Add your files
- [ ] [Create](https://gitlab.com/-/experiment/new_project_readme_content:fb76fb1cbbbb63ae975ed374c746309c?https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://gitlab.com/-/experiment/new_project_readme_content:fb76fb1cbbbb63ae975ed374c746309c?https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://gitlab.com/-/experiment/new_project_readme_content:fb76fb1cbbbb63ae975ed374c746309c?https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
```text
_____ __ ______ __ ____ __ __
/ ___// / / / __ \/ / / __ \____ _/ /______/ /_ ___ _____
\__ \/ / / / /_/ / / / /_/ / __ `/ __/ ___/ __ \/ _ \/ ___/
___/ / /_/ / ____/ /___ / ____/ /_/ / /_/ /__/ / / / __/ /
/____/\____/_/ /_____/ /_/ \__,_/\__/\___/_/ /_/\___/_/
```
cd existing_repo
git remote add origin https://gitlab.com/nekrondev/suplpatcher.git
git branch -M main
git push -uf origin main
#### 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
```
## Integrate with your tools
#### Who should use it? ####
1. You should be familar with Linux shell and have developer mode enabled on your device
2. Your device suffers from delayed GPS fixes and you want to speed things up
3. Your are aware of Google SUPL service and decreased privacy
- [ ] [Set up project integrations](https://gitlab.com/-/experiment/new_project_readme_content:fb76fb1cbbbb63ae975ed374c746309c?https://gitlab.com/nekrondev/suplpatcher/-/settings/integrations)
#### Requirements for working A-GPS solution ####
A-GPS / SUPL support is a modem-internal process. Therefor the modem must
## Collaborate with your team
1. have a valid SIM card in your device
2. have GPRS / data connection setup and activated, i.e. you can connect to the internet from your mobile *without* using wifi
3. have location service activated and high precision option selected (not exclusive device more nor custom settings)
4. have positioning package from harbour installed for the region you are living
5. nope, it's not working on wifi-only connections, go buy a mobile subscription
- [ ] [Invite team members and collaborators](https://gitlab.com/-/experiment/new_project_readme_content:fb76fb1cbbbb63ae975ed374c746309c?https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://gitlab.com/-/experiment/new_project_readme_content:fb76fb1cbbbb63ae975ed374c746309c?https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://gitlab.com/-/experiment/new_project_readme_content:fb76fb1cbbbb63ae975ed374c746309c?https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://gitlab.com/-/experiment/new_project_readme_content:fb76fb1cbbbb63ae975ed374c746309c?https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Automatically merge when pipeline succeeds](https://gitlab.com/-/experiment/new_project_readme_content:fb76fb1cbbbb63ae975ed374c746309c?https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
#### Preparation ####
Install binary
## Test and Deploy
1. copy `suplpatch` binary to your device (scp or use terminal app)
2. `devel-su`
3. `chmod +x suplpatch`
Use the built-in continuous integration in GitLab.
Optional: Backup your modem settings
- [ ] [Get started with GitLab CI/CD](https://gitlab.com/-/experiment/new_project_readme_content:fb76fb1cbbbb63ae975ed374c746309c?https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://gitlab.com/-/experiment/new_project_readme_content:fb76fb1cbbbb63ae975ed374c746309c?https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://gitlab.com/-/experiment/new_project_readme_content:fb76fb1cbbbb63ae975ed374c746309c?https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://gitlab.com/-/experiment/new_project_readme_content:fb76fb1cbbbb63ae975ed374c746309c?https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://gitlab.com/-/experiment/new_project_readme_content:fb76fb1cbbbb63ae975ed374c746309c?https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
4. `ls -l /dev/block/platform/soc.0/by-name/ | grep modemst`
***
Find the mmcblk devices with `modemst1` and `modemst2`.
# Editing this README
Example:
```
lrwxrwxrwx 1 root root 22 Jan 16 16:49 modemst1 -> ../../../../mmcblk0p14
lrwxrwxrwx 1 root root 22 Jan 16 16:49 modemst2 -> ../../../../mmcblk0p15
```
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com) for this template.
5. `dd if=/dev/mmcblk0p14 of=modemst1.bin`
6. `dd if=/dev/mmcblk0p15 of=modemst2.bin`
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
#### Option 1: Disable SUPL TLS transport ####
This is the easiest way and no certificates will be uploaded to modem.
However after this all SUPL request will be send unencrypted over the internet to Google or other unencrypted SUPL services.
## Name
Choose a self-explaining name for your project.
You can trigger TLS deactivation using the `--disable` flag.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
```
[root@Sailfish nemo]# ./suplpatch --disable
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
______ _____ __ ___ __ __
/ __/ / / / _ \/ / / _ \___ _/ /_____/ / ___ ____
_\ \/ /_/ / ___/ /__ / ___/ _ `/ __/ __/ _ \/ -_) __/
/___/\____/_/ /____/ /_/ \_,_/\__/\__/_//_/\__/_/
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
SailfishOS Xperia X devices A-GPS SUPL Patcher v0.0.1.6 (git: 6f1c86c, build: 20.01.2022 15:55)
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
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.
```
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
This setting can be reverted using the `--enable` flag to turn on SUPL TLS again.
Note: For a working TLS proteced SUPL request you need updated root certificats in your modem (see option 2).
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
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/etc/gps.conf` (Xperia 10 II).
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
```
# 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).
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
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.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
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.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
#### 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.
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
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.
## License
For open source projects, say how it is licensed.
This is triggered via the `--upload` flag.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
```
[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/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 secs 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