Issues with cellular data

I wanted to gather here some general info that might help others having issues with cellular data.

It was explained to me that:

The “Settings → Mobile Network” menus and toggles in UI talk to NetworkManager (nmcli, nmtui). In turn, NetworkManager talks to ModemManager (mmcli), which should talk to the modem. However, in Droidian, ModemManager can’t talk to the modem, because the modem requires ofono. So there is ofono2mm installed, which translates between ofono and ModemManager “languages” (e.g. you can have a look at /usr/lib/ofono2mm/ofono2mm/mm_modem.py).

The following set of commands are useful in figuring out what information ofono2mm, ModemManager (mmcli) and NetworkManager (nmcli, nmtui) each have:

/usr/share/ofono/scripts/list-contexts # list ofono2mm's context info
/usr/share/ofono/scripts/list-modems # list ofono2mm's modem info
mmcli -L # list available modems
mmcli -m any # list info about the modem
mmcli -b 0 # list info about bearer zero(0)
nmcli con show # show all NetworkManager connections
nmcli radio # show radio switches status
nmcli dev show # show detailed info about all interfaces
nmcli dev show ril_0 # show detailed info about interface ril_0
nmtui # configure/edit/activate NetworkManager connections

I also found that if, for some reason, the UI settings are not properly passed on to ofono2mm, ofono2mm seems to default to trying to set the APN info based on mobile-broadband-provider-info. You can set the APN settings (Name, AccessPointName, Username, Password) directly via the ofono2mm script /usr/share/ofono/scripts/set-context-property. For example, for my APN, the info was:

sudo su
cd /usr/share/ofono/scripts/
./set-context-property 0 Name 'iijmio'
./set-context-property 0 AccessPointName 'iijmio'
./set-context-property 0 Username 'mio@iij'
./set-context-property 0 Password 'iij'
./activate-context 1 # Activates the context you just set
./list-contexts # See if the info now matches what you entered

Obviously, you’d have to replace the entries in quote above with your correct APN info.

Hopefully, understanding what parts set what info, and the above commands, can help someone struggling with their cellular data to identify which part (ofono2mm, NetworkManager or ModemManager) might be causing the issue.