Add GPS support #228

Open
lolmc0587 wants to merge 5 commits from lolmc0587/main into main
lolmc0587 commented 2025-07-10 05:47:16 -04:00 (Migrated from github.com)
No description provided.
huakim commented 2025-07-12 01:22:20 -04:00 (Migrated from github.com)

Thanks! I have merged this to my forked repository

Thanks! I have merged this to my forked repository
onny commented 2025-07-14 04:13:36 -04:00 (Migrated from github.com)

Thanks for the PR.

Tried to use it on my postmarketOS Linux phone

  1. Starting a fake GPS stream
virtualgps.py -c virtualgps.conf -p warsaw --verbose
Streaming virtual location (Lat: 52.13791, Lon: 21.00704, El: 100.0) to serial GPS device /dev/pts/3
  1. configured gpsd
cat /etc/conf.d/gpsd 
GPSD_OPTIONS="-n -D 1"
DEVICES="/dev/pts/3"
  1. started gpsd
sudo rc-service gpsd start
  1. installed gps with your waydroid_script fork
    supplied /var/run/gpsd.sock with baudrate 9600
  2. opened comaps on waydroid but cant get any position
Thanks for the PR. Tried to use it on my postmarketOS Linux phone 1) Starting a fake GPS stream ``` virtualgps.py -c virtualgps.conf -p warsaw --verbose Streaming virtual location (Lat: 52.13791, Lon: 21.00704, El: 100.0) to serial GPS device /dev/pts/3 ``` 2) configured gpsd ``` cat /etc/conf.d/gpsd GPSD_OPTIONS="-n -D 1" DEVICES="/dev/pts/3" ``` 3) started gpsd ``` sudo rc-service gpsd start ``` 4) installed gps with your waydroid_script fork supplied `/var/run/gpsd.sock` with baudrate 9600 5) opened comaps on waydroid but cant get any position
onny commented 2025-07-14 04:16:07 -04:00 (Migrated from github.com)

@Lolmc0587 updated my comment, not yet working for me

@Lolmc0587 updated my comment, not yet working for me
lolmc0587 commented 2025-07-14 04:22:16 -04:00 (Migrated from github.com)

Have you updated your LineageOS version to the latest or added the dialout group? Mine works perfectly on Ubuntu.
If it doesn’t work, can you send me the waydroid_logcat.log?

Have you updated your LineageOS version to the latest or added the dialout group? Mine works perfectly on Ubuntu. If it doesn’t work, can you send me the waydroid_logcat.log?
onny commented 2025-07-14 06:18:46 -04:00 (Migrated from github.com)

Yes it's running Android 13 now. On the host system (postmarketOS/Alpine Linux) I added my user to the dialout group.

Maybe I'm going to test it on my desktop PC first (NixOS)

Yes it's running Android 13 now. On the host system (postmarketOS/Alpine Linux) I added my user to the dialout group. Maybe I'm going to test it on my desktop PC first (NixOS)
buri-at-make (Migrated from github.com) reviewed 2025-07-14 08:52:44 -04:00
buri-at-make (Migrated from github.com) commented 2025-07-14 08:52:44 -04:00

Should this be offset?

Should this be offset?
lolmc0587 (Migrated from github.com) reviewed 2025-07-14 09:00:16 -04:00
@@ -0,0 +171,4 @@
# lxc.mount.entry = /dev/ttyGPSD dev/ttyGPSD none bind,create=file,optional 0 0
with open(config_nodes, "a") as f:
f.write(f"lxc.mount.entry = {self.gps_host} dev/{self.usb_name} none bind,create=file,optional 0 0\n")
lolmc0587 (Migrated from github.com) commented 2025-07-14 09:00:16 -04:00

if i do container.upgrade(), this config will be reset.
i don't know how to solve this, so in this case it must be that

if i do `container.upgrade()`, this config will be reset. i don't know how to solve this, so in this case it must be that
doeni98 commented 2025-09-02 15:45:40 -04:00 (Migrated from github.com)

Thanks for your work!

Unfortunately this does not work for me either. I tried using it with the gpsfake tool since I have no gps receiver laying around. Running on Ubuntu 24.04 and waydroid 1.5.4

What I did:

GPS NMEA file to feed:

$GPGGA,192420.216,5231.722,N,01324.570,E,1,12,1.0,0.0,M,0.0,M,,*63
$GPGSA,A,3,01,02,03,04,05,06,07,08,09,10,11,12,1.0,1.0,1.0*30
$GPRMC,192420.216,A,5231.722,N,01324.570,E,909.9,029.7,020925,000.0,W*7E
$GPGGA,192421.216,5231.941,N,01324.776,E,1,12,1.0,0.0,M,0.0,M,,*6D
$GPGSA,A,3,01,02,03,04,05,06,07,08,09,10,11,12,1.0,1.0,1.0*30
$GPRMC,192421.216,A,5231.941,N,01324.776,E,1201.5,354.6,020925,000.0,W*46
$GPGGA,192422.216,5232.273,N,01324.725,E,1,12,1.0,0.0,M,0.0,M,,*61
$GPGSA,A,3,01,02,03,04,05,06,07,08,09,10,11,12,1.0,1.0,1.0*30
$GPRMC,192422.216,A,5232.273,N,01324.725,E,1425.3,004.1,020925,000.0,W*4D
$GPGGA,192423.216,5232.668,N,01324.771,E,1,12,1.0,0.0,M,0.0,M,,*6F
$GPGSA,A,3,01,02,03,04,05,06,07,08,09,10,11,12,1.0,1.0,1.0*30
$GPRMC,192423.216,A,5232.668,N,01324.771,E,1403.4,004.6,020925,000.0,W*47
$GPGGA,192424.216,5233.056,N,01324.822,E,1,12,1.0,0.0,M,0.0,M,,*6B
$GPGSA,A,3,01,02,03,04,05,06,07,08,09,10,11,12,1.0,1.0,1.0*30
$GPRMC,192424.216,A,5233.056,N,01324.822,E,908.1,006.4,020925,000.0,W*71
$GPGGA,192425.216,5233.307,N,01324.869,E,1,12,1.0,0.0,M,0.0,M,,*62
$GPGSA,A,3,01,02,03,04,05,06,07,08,09,10,11,12,1.0,1.0,1.0*30
$GPRMC,192425.216,A,5233.307,N,01324.869,E,908.1,006.4,020925,000.0,W*78

Run the gpsfake service:

sudo gpsfake --speed 9600 --slow <nmea data file>.nmea -D4

(...)
gpsd:INFO: <= control(8): adding /dev/pts/14
gpsd:INFO: stashing device /dev/pts/14 at slot 0
(...)

Setup waydroid (lineage-20.0-20250809-MAINLINE-waydroid_x84_64):

sudo waydroid init

Install the gps using your script:

sudo ./venv/bin/python main.py
-> Android 13
-> Install
-> gapps, gps
-> /dev/pts/14
-> 9600

Then waydroid session start and waydroid show-full-ui but there is no location available in any navigation app (google maps, OsmAnd).

Thanks for your work! Unfortunately this does not work for me either. I tried using it with the `gpsfake` tool since I have no gps receiver laying around. Running on Ubuntu 24.04 and waydroid 1.5.4 What I did: GPS NMEA file to feed: ``` $GPGGA,192420.216,5231.722,N,01324.570,E,1,12,1.0,0.0,M,0.0,M,,*63 $GPGSA,A,3,01,02,03,04,05,06,07,08,09,10,11,12,1.0,1.0,1.0*30 $GPRMC,192420.216,A,5231.722,N,01324.570,E,909.9,029.7,020925,000.0,W*7E $GPGGA,192421.216,5231.941,N,01324.776,E,1,12,1.0,0.0,M,0.0,M,,*6D $GPGSA,A,3,01,02,03,04,05,06,07,08,09,10,11,12,1.0,1.0,1.0*30 $GPRMC,192421.216,A,5231.941,N,01324.776,E,1201.5,354.6,020925,000.0,W*46 $GPGGA,192422.216,5232.273,N,01324.725,E,1,12,1.0,0.0,M,0.0,M,,*61 $GPGSA,A,3,01,02,03,04,05,06,07,08,09,10,11,12,1.0,1.0,1.0*30 $GPRMC,192422.216,A,5232.273,N,01324.725,E,1425.3,004.1,020925,000.0,W*4D $GPGGA,192423.216,5232.668,N,01324.771,E,1,12,1.0,0.0,M,0.0,M,,*6F $GPGSA,A,3,01,02,03,04,05,06,07,08,09,10,11,12,1.0,1.0,1.0*30 $GPRMC,192423.216,A,5232.668,N,01324.771,E,1403.4,004.6,020925,000.0,W*47 $GPGGA,192424.216,5233.056,N,01324.822,E,1,12,1.0,0.0,M,0.0,M,,*6B $GPGSA,A,3,01,02,03,04,05,06,07,08,09,10,11,12,1.0,1.0,1.0*30 $GPRMC,192424.216,A,5233.056,N,01324.822,E,908.1,006.4,020925,000.0,W*71 $GPGGA,192425.216,5233.307,N,01324.869,E,1,12,1.0,0.0,M,0.0,M,,*62 $GPGSA,A,3,01,02,03,04,05,06,07,08,09,10,11,12,1.0,1.0,1.0*30 $GPRMC,192425.216,A,5233.307,N,01324.869,E,908.1,006.4,020925,000.0,W*78 ``` Run the `gpsfake` service: ``` sudo gpsfake --speed 9600 --slow <nmea data file>.nmea -D4 (...) gpsd:INFO: <= control(8): adding /dev/pts/14 gpsd:INFO: stashing device /dev/pts/14 at slot 0 (...) ``` Setup waydroid (lineage-20.0-20250809-MAINLINE-waydroid_x84_64): ``` sudo waydroid init ``` Install the gps using your script: ``` sudo ./venv/bin/python main.py -> Android 13 -> Install -> gapps, gps -> /dev/pts/14 -> 9600 ``` Then `waydroid session start` and `waydroid show-full-ui` but there is no location available in any navigation app (google maps, OsmAnd).
lolmc0587 commented 2025-09-02 19:45:30 -04:00 (Migrated from github.com)

I haven't tried the gpsfake yet. I will have a look at it.

I haven't tried the gpsfake yet. I will have a look at it.
lolmc0587 commented 2025-09-02 21:51:14 -04:00 (Migrated from github.com)

Maybe that will works

Maybe that will works
lolmc0587 commented 2025-09-03 00:51:45 -04:00 (Migrated from github.com)

Please don't use that pts device, you can set the fake gps device to like /dev/ttyGPSD
If you can't, follow the command below

sudo ln -s /dev/pts/<yourdevice> /dev/<nameyouwant>
sudo chmod 777 /dev/<nameyouwant>
Please don't use that pts device, you can set the fake gps device to like /dev/ttyGPSD If you can't, follow the command below ``` sudo ln -s /dev/pts/<yourdevice> /dev/<nameyouwant> sudo chmod 777 /dev/<nameyouwant> ```
doeni98 commented 2025-09-03 12:27:05 -04:00 (Migrated from github.com)

Did not find any way from the gpsfake docs to specify the tty device path. Anyhow with the symbolic link it works like charm!

Thank you very much!

Did not find any way from the `gpsfake` docs to specify the tty device path. Anyhow with the symbolic link it works like charm! Thank you very much!
mburucuyapy commented 2025-09-09 15:58:57 -04:00 (Migrated from github.com)

will this also read from /dev/ttyACM0 or just GPSD?

will this also read from /dev/ttyACM0 or just GPSD?
lolmc0587 commented 2025-09-09 19:24:09 -04:00 (Migrated from github.com)

will this also read from /dev/ttyACM0 or just GPSD?

Yeah
Just don't use /dev/pts/..

> will this also read from /dev/ttyACM0 or just GPSD? Yeah Just don't use /dev/pts/..
Checking for merge conflicts…
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin lolmc0587/main:lolmc0587/main
git checkout lolmc0587/main
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wbruno/waydroid_script#228