About DBus permissions related to oFono

Hi fellow sailors!

I’m currently trying to make a normal QML based Sailfish application for toggling between for instance 3G and 4G networks but I have so little knowledge on DBus so it’s been a real struggle for now. It doesn’t help either that there’s so little clear information on several things. I use Situations app to switch 4G when the screen is on and to 3G when it’s off. However, sometimes I have the screen on but I wouldn’t want to use 4G all the time since it consumes quite a lot battery on my XA2 Dual-Sim.

So basically what I’ve found out

  • Service: org.ofono
  • Interface: org.ofono.RadioSettings
  • Bus: SystemBus
  • Path (to the modem): /ril_0 (on my case)
  • Method: SetProperty(“TechnologyPreference”, variant string) with signature a{s,v}

I have already tried to use the Nemo QML module QDBusInterface with the result

Call failed:  org.ofono.Error.AccessDenied  Message:  Operation not permitted

I have also successfully changed it after devel-su with the following DBus command

dbus-send --print-reply --system --dest=org.ofono /ril_0 org.ofono.RadioSettings.SetProperty string:"TechnologyPreference" variant:string:"umts"

So executing that method requires root privileges. I’ve found out that there are some XML config files for DBus under /etc/dbus-1/ and ofono.conf under system.d/. However, I’m not too sure what kind of allow send_destination, send_interface or rules in general should be added in there let alone the fact that do they even work on that specific config.

I’m also aware of libqofono and libqofonoext libraries but I’m not too interested in adding other libraries unless necessary. On the other hand, when I tried to skim through those libraries, I didn’t really come across anything related changing the network preference. I’ve also seen applications for toggling the network but somewhere after Sailfish 2.0 they were abandoned and told not to work any longer.

Does anyone know how this could be done or a better way to do it? Or has something changed on oFono level, which makes this so complicated? Nevertheless, I would really appreciate any help!