How to find whether Wifi and/or GPS are enabled?
I am working on system monitoring solution for Sailfish. For that, I'd like to write a module that reports the state of the radios. As far as I can see, stateFS reports whether cellular radio is enabled as well as bluetooth. However, how can I find out whether GPS is switched on and whether WIFI is on. As for WIFI, stateFS would suggest that its on if I use it for Internet, but that does not cover all situations (out of home with wifi scanning, for example). Ideally, it would have been reported by some file on pseudo-file system, like /proc, /sys, ...
Any idea where I can find data for GPS? For WiFi?
I would start using dbus-monitor and seeking appropriate threads here to find good dbus commands to see what signals are sent to dbus. Then trying to construct method calls to get the info.
Rikujolla ( 2016-07-17 09:41:10 +0200 )editI was hoping to avoid DBus. The monitoring is based around collectd (mostly in plain C and using standard Linux /proc & /sys interface) and dbus would be one extra dependency. In addition, DBus would probably mean that I'll have to implement the solution that would depend on current implementation.
In some sense, stateFS was made to avoid implementation details and export such data in clear way.
Turned out that for WiFi, in Nexus 4 port, I can use /sys/class/rfkill. However, GPS & cellular networks are not there. If you use some other device, could you check what is response to
cat /sys/class/rfkill/rfkill*/name
and
cat /sys/class/rfkill/rfkill*/type
cheers!
rinigus ( 2016-07-17 10:19:53 +0200 )editI have Jolla1.
gives
and
gives
Rikujolla ( 2016-07-17 17:02:50 +0200 )editThank you very much! OK, looks like WiFi is then covered. As far as I understand, rfkill tells whether the radio is on or off through state file.
GPS seems to be trickier.... Its probably linked to Android GPS stack.
rinigus ( 2016-07-17 18:09:21 +0200 )edit