# net-misc/ofono-1.29 throws dbus-related errors

## penetrode

I am using net-misc/connman to manage my network.

I have an Ericsson 3507g UMTS card that I would like to manage with connman as well. I understand that this requires net-misc/ofono.

I've installed net-misc/ofono-1.29 and am using this as a guide: https://embexus.com/2017/06/04/add-a-mobile-broadband-connectivity-to-embedded-linux/

The list-modems command fails with this message:

```
# ./list-modems 

Traceback (most recent call last):

  File "/usr/lib64/python3.6/site-packages/dbus/bus.py", line 175, in activate_name_owner

    return self.get_name_owner(bus_name)

  File "/usr/lib64/python3.6/site-packages/dbus/bus.py", line 361, in get_name_owner

    's', (bus_name,), **keywords)

  File "/usr/lib64/python3.6/site-packages/dbus/connection.py", line 651, in call_blocking

    message, timeout)

dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NameHasNoOwner: Could not get owner of name 'org.ofono': no such name

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "./list-modems", line 7, in <module>

    manager = dbus.Interface(bus.get_object('org.ofono', '/'),

  File "/usr/lib64/python3.6/site-packages/dbus/bus.py", line 241, in get_object

    follow_name_owner_changes=follow_name_owner_changes)

  File "/usr/lib64/python3.6/site-packages/dbus/proxies.py", line 248, in __init__

    self._named_service = conn.activate_name_owner(bus_name)

  File "/usr/lib64/python3.6/site-packages/dbus/bus.py", line 180, in activate_name_owner

    self.start_service_by_name(bus_name)

  File "/usr/lib64/python3.6/site-packages/dbus/bus.py", line 278, in start_service_by_name

    'su', (bus_name, flags)))

  File "/usr/lib64/python3.6/site-packages/dbus/connection.py", line 651, in call_blocking

    message, timeout)

dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.ofono was not provided by any .service files

```

I don't know enough about dbus to understand what the first error message means, although the double exception does make me wonder if dbus is properly set up.

The list-modems script is short, so I'll include it here:

```

#!/usr/bin/python3

import dbus

bus = dbus.SystemBus()

manager = dbus.Interface(bus.get_object('org.ofono', '/'),

                                                'org.ofono.Manager')

modems = manager.GetModems()

for path, properties in modems:

        print("[ %s ]" % (path))

        for key in properties.keys():

                if key in ["Interfaces", "Features"]:

                        val = ""

                        for i in properties[key]:

                                val += i + " "

                else:

                        val = properties[key]

                print("    %s = %s" % (key, val))

        for interface in properties["Interfaces"]:

                object = dbus.Interface(bus.get_object('org.ofono', path),

                                                                interface)

                print("    [ %s ]" % (interface))

                try:

                        properties = object.GetProperties()

                except:

                        continue

                for key in properties.keys():

                        if key in ["Calls",

                                        "MultipartyCalls",

                                        "EmergencyNumbers",

                                        "SubscriberNumbers",

                                        "PreferredLanguages",

                                        "PrimaryContexts",

                                        "LockedPins",

                                        "Features",

                                        "AvailableTechnologies"]:

                                val = ""

                                for i in properties[key]:

                                        val += i + " "

                        elif key in ["ServiceNumbers"]:

                                val = ""

                                for i in properties[key]:

                                        val += "[" + i + "] = '"

                                        val += properties[key][i] + "' "

                        elif key in ["MobileNetworkCodeLength",

                                                "VoicemailMessageCount",

                                                "MicrophoneVolume",

                                                "SpeakerVolume",

                                                "Strength",

                                                "DataStrength",

                                                "BatteryChargeLevel"]:

                                val = int(properties[key])

                        elif key in ["MainMenu"]:

                                val = ", ".join([ text + " (" + str(int(icon)) +

                                        ")" for text, icon in properties[key] ])

                        elif key in ["Retries"]:

                                val = ""

                                for i in properties[key]:

                                        val +=  "[" + i + " = "

                                        val += str(int(properties[key][i])) + "] "

                        elif key in ["Settings"]:

                                val = "{"

                                for i in properties[key].keys():

                                        val += " " + i + "="

                                        if i in ["DomainNameServers"]:

                                                for n in properties[key][i]:

                                                        val += n + ","

                                        else:

                                                val += properties[key][i]

                                val += " }"

                        else:

                                val = properties[key]

                        print("        %s = %s" % (key, val))

        print('')

```

Here's some eix output:

```
[I] net-misc/ofono

     Available versions:  1.16 ~1.28 (~)1.29 {+atmodem bluetooth +cdmamodem +datafiles doc dundee examples +isimodem +phonesim +provision +qmimodem threads tools +udev upower}

     Installed versions:  1.29(07:41:15 08/27/19)(atmodem bluetooth cdmamodem datafiles doc examples isimodem phonesim provision qmimodem tools udev upower -dundee)

     Homepage:            https://01.org/ofono

     Description:         Open Source mobile telephony (GSM/UMTS) daemon

```

```
[I] net-misc/connman

     Available versions:  1.35-r1 1.37 {bluetooth debug doc +ethernet examples iptables iwd l2tp networkmanager nftables ofono openconnect openvpn policykit pptp tools vpnc +wifi wispr}

     Installed versions:  1.37(08:13:20 08/27/19)(bluetooth doc ethernet examples nftables ofono openvpn policykit tools wifi -debug -iptables -iwd -l2tp -networkmanager -openconnect -pptp -vpnc -wispr)

     Homepage:            https://01.org/connman

     Description:         Provides a daemon for managing internet connections

```

```
[I] dev-python/dbus-python

     Available versions:  1.2.0-r1 1.2.4 ~1.2.6-r1 ~1.2.6-r2^t ~1.2.8^t {doc examples test PYTHON_TARGETS="python2_7 python3_5 python3_6 python3_7"}

     Installed versions:  1.2.4(00:59:00 04/19/19)(-doc -examples -test PYTHON_TARGETS="python2_7 python3_6 -python3_5")

     Homepage:            https://www.freedesktop.org/wiki/Software/DBusBindings https://dbus.freedesktop.org/doc/dbus-python/

     Description:         Python bindings for the D-Bus messagebus

```

----------

## penetrode

Ok, it turns out that ofono has a service that must first be started with

```
rc-service ofono start

```

I now have the connection working:

```
# ifconfig wwp0s29f7u4i7

wwp0s29f7u4i7: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 10.137.47.124  netmask 255.255.255.248  broadcast 10.137.47.127

        ether 02:80:37:ec:02:00  txqueuelen 1000  (Ethernet)

        RX packets 3718  bytes 2490325 (2.3 MiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 3232  bytes 454365 (443.7 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

```

```
# connmanctl technologies

/net/connman/technology/cellular

  Name = Cellular

  Type = cellular

  Powered = True

  Connected = True

  Tethering = False

/net/connman/technology/ethernet

  Name = Wired

  Type = ethernet

  Powered = False

  Connected = False

  Tethering = False

/net/connman/technology/wifi

  Name = WiFi

  Type = wifi

  Powered = False

  Connected = False

  Tethering = False

/net/connman/technology/bluetooth

  Name = Bluetooth

  Type = bluetooth

  Powered = False

  Connected = False

  Tethering = False

```

Of course, there is more to the setup than simply starting the ofono service. The 3507g has proven temperamental: the order in which you perform the operations matters and sometimes modem and context activation do not work and have to be repeated.

----------

