background daemon and accessing location/gnss data
-
Hi all !
I'm kinda new to the Ubuntu Touch fury and got it installed on a Poco X3 NFC i got on the cheap. a tad quirky but surprisingly nice.
My goal, tbh, wasn't even have it as a daily, but replacing a small RockPi SBC I have running in my car that is underpowered, despite chewing over >1W.
This averages 0.3W idle, with GPS+Wifi+LTE ... I don't need any GPIOs (but seems i'd have to live without OTG USB, unsure about that yet)
I got Supervisor, Mosquitto, node.js installed, and it starts node-red on boot (ressources are mostly under the phablet user to keep / read-only)
One of my issues is accessing GPS data (sure enough, first fix takes ages, but that's something else)
I am totally at lost about the whole lomiri stack, dbus is already hard enough (I deal with hundreds of linux servers all day) This is almost "hey son, can you fix my printer" territory
I can eavesdrop on the system dbus if I start GPS toolkit on the UI side:
# dbus-monitor --system ... method call time=1747474346.025144 sender=:1.14 -> destination=:1.133 serial=117 path=/sessions/1; interface=com.lomiri.location.Service.Session; member=UpdatePosition double YY.096 double X.83785 boolean true double 74.9379 boolean true double 10.5377 boolean false int64 1747474346017862807 method call time=1747474346.028468 sender=:1.14 -> destination=:1.133 serial=118 path=/sessions/1; interface=com.lomiri.location.Service.Session; member=UpdateVelocity double 0 int64 1747474346019894752 ...
But I'd like to get things running using a python3 or node.js script, in the background.
import pydbus # Connect to the system bus bus = pydbus.SystemBus() # Access the location service location_service = bus.get('com.lomiri.location.Service') #location_service = bus.get('com.lomiri.location.Service','/com/lomiri/location') # Get the location location = location_service.GetLocation() print(f"Latitude: {location['latitude']}") print(f"Longitude: {location['longitude']}") print(f"Altitude: {location['altitude']}")
unfortunatly, that object doesn't export any interfaces (or GI is lacking stuff, dunno)
Ideally, i'd write i very light python3 daemon that would just update topics on the local mqtt so I can play with the data under node-red.
Thanks for any pointers in the right direction
JaXX./.
Sidequestions:
Would a USB-C hub be recognized ? (lsusb showed nothing) (damn, the thing draws 0.8W on it's own gotta find something else)
Under android, it was able to have an active hotspot (with clients) while being connected to home wifi, I'll explore that soon but if anyone had a clue on how to reproduce the same use-case, it'd be great (the idea would be having other wireless sensors connecting to the phone, but the phone using home wifi when available instead of being stuck on LTE) -
@jaxx If I understand your questions correctly:
- cannot get the location with Python
- USB-OTG
- Hotspot source auto switch between WiFi/LTE
1
The expected way of getting GPS coordinates is via the Qt interface. You can however check out this Python script which among other things obtains the location, by searching in the output of thetest_gps
command2
I remember usb devices working in Ubuntu Touch, could it be a problem with the specific hub?3
You can theoretically write a script with nmcli/network manager, I will test later if the default hotspot service can work this way.