Where is /run/state/providers/ofono/Cellular/ gone in Koli?

I used to ask /run/state/providers/ofono/Cellular/Status, /run/state/providers/ofono/Cellular/, /DataTechnology etc., taking the result as condition for a “systemctl restart ofono” if the connection was broken. Now (in 4.0.1) I can’t find these informations any longer.
Any hint what’s used instead now?

BG-Info: Sailfish remains unusable in Germany. I have this problem since “X” appeared. I can connect 26 weak mobile cells in my 50m² flat, and just going from kitchen to bathroom means crossing at least 5 of them. After some useless tries the phone gives up to establish a stable connection and leaves me offline. My qualifications are too low to hunt this bug down on my own.
It was never taken as a serious issue by Jolla, and my only workaround is a cronjob, testing the connection status any minute and restarting ofono if necessary. This worked up to today… :frowning:

1 Like

Not exactly sure what you detected via statefs, but ofono does have a DBus interface with quite a lot to call. Maybe that can work for you?

Here’s an example call:

1 Like

And another evidence that statefs is obsoleted and removed.

1 Like

@nephros @peterleinchen Oh, I see, thanks for pointing this out.

Okay, so I have to learn about the DBus interface. Having a smartphone isn’t just fun anymore at this level…

1 Like

Oh, I’d say there it starts… :smiley:

1 Like

This call might show everything you are interested in

$ dbus-send --print-reply --system --dest=org.ofono /ril_0 org.ofono.NetworkRegistration.GetProperties

(Tested in Xperia X single SIM.)

1 Like

Ok on XA2 H4113 SFOS (and others…)

Yes, found it.
Have to test it. With the “old” stateFS-information I sometimes noticed one mean “intermediate” failstate, when all the network registration claimed “connected”, but wasn’t for real. The statusbar then showed a signal strength indicator, but no 2G/3G/4G. In that case I had to look for a state named “GPRSattached”. Couldn’t reproduce it so far with Koli, I’m on it.

Without fully analyzing what the old code https://git.sailfishos.org/mer-core-attic/statefs-providers/blob/master/src/ofono/provider_ofono.cpp#L535 did, I could guess a property Attached of some connection manager was exported to statefs under the name GPRSAttached.

Try whether

 $ dbus-send --print-reply --system --dest=org.ofono /ril_0 org.ofono.ConnectionManager.GetProperties

is what you are looking for.

1 Like

In the unlikely case someone finds himself in the same situation, here my final solution so far, a python script to run as root with ‘sailcron’. It seems to protect me from unnoticed offline times.
Thank you all for the help.


# Robomike's workaround to STAY mostly connected in Germany. 
# My Sailfish-devices have massive problems in weak, messy
# mobile cells. Maybe the problem is also related to my provider 
# (O2) or whatever, anyway, when in an area with multiple cells with 
# similar bad signal strength, something goes wrong and the phone is
# not only offline, but also does no attempt to regain a network anymore.
# This python script checks the situation and restarts ofono, if necessary.
# It should be run as root by cron or similar mechanics repeatedly.
# (Setting up event loops are possible, but I'm not sure if 
# battery friendly...)
# References:
# https://forum.sailfishos.org/t/where-is-run-state-providers-ofono-cellular-gone-in-koli/4920
# (thanks to the contributors in this thread)
# First discussions on this topic:
# https://together.jolla.com/question/128155/bug-mobile-data-connection-dies-since-201x/
# https://together.jolla.com/question/170394/xperia-x-loss-of-mobile-network/

import os
import dbus

bus = dbus.SystemBus()					#  define the bus
busObject = bus.get_object('org.ofono','/ril_0')	#  define the bus-object

def isCallActive():
	# Test if call is active.
	callsInterface = dbus.Interface(busObject,dbus_interface='org.ofono.VoiceCallManager')
	calls = callsInterface.GetCalls()
	return (len(calls) > 0)

def isNetworkActive():
	# Test if NetworkRegistration says 'registered' or 'roaming'
	# According to https://git.sailfishos.org/mer-core/ofono/blob/master/ofono/doc/network-api.txt we'll find
	# "unregistered"  Not registered to any network
	# "registered"    Registered to home network
	# "searching"     Not registered, but searching
	# "denied"        Registration has been denied
	# "unknown"       Status is unknown
	# "roaming"       Registered, but roaming

	netRegIface = dbus.Interface(busObject,dbus_interface='org.ofono.NetworkRegistration')
	netRegInfos = netRegIface.GetProperties()
	return ((netRegInfos['Status'] == 'registered') or (netRegInfos['Status'] == 'roaming'))	

def isDataPossible():
	# In many cases ofono seems just blocked. We can see a 'registered' state then,
	# but we are not able to make calls, recieve messages etc.
	# Then, the sailfish status bar shows a signal strength indicator, but no 
	# '2G/3G/4G' quality at all. AFAIK the only way to find out is asking the 
	# 'ConnectionManager', if it is  'attached'.   
	dataConnIface = dbus.Interface(busObject,dbus_interface='org.ofono.ConnectionManager')
	dataConnInfos = dataConnIface.GetProperties()
	return (dataConnInfos['Attached'] == True)

def phoneIsOffline():
	problem = False
	if isCallActive():
		# If a call is active, we shouldn't even try to disrupt. 
		if isNetworkActive():
			# This is not a guarantee that all is working!
			pass	# means problem remains 'False'
			# But here's a known problem.
			problem = True
		if isDataPossible():
			#Okay, seems running well. Do not disturb.
			problem = True	# Here's the annoying situation I try to work around
	return (problem)

if phoneIsOffline():
	# Thing here is, I tried several things to make 
	# ofono run properly again, but found no way to 
	# do it without restarting it. 
	# For some reasons restarting ofono in Sailfish 4.x is faster
	# than in older versions. Normally we'll have immediate success.
	# Ok then, finally:
	print ('checkOfono.py is restarting ofono service NOW')
	os.system("systemctl restart ofono")