ModemManager: Difference between revisions

Manu (talk | contribs)
Create ModemManager page. Add Configuration, Tips and Tricks and Troubleshooting sections.
 
Manu (talk | contribs)
m Minor corrections, such as using "computer code" style instead of backticks (which did not work as expected).
Line 4: Line 4:
It is possible to enable the modem with:<syntaxhighlight lang="nix">
It is possible to enable the modem with:<syntaxhighlight lang="nix">
networking.modemmanager.enable = true;
networking.modemmanager.enable = true;
</syntaxhighlight>A good rule of thumb is to use NetworkManager as much as possible and rely on ModemManager functionality directly only when necessary (e.g., when having to insert a PIN).
</syntaxhighlight>A good rule of thumb is to use NetworkManager as much as possible and rely on ModemManager functionality directly only when necessary (e.g., when having to insert a PIN to unlock the SIM card).


== Tips and Tricks ==
== Tips and Tricks ==
Line 23: Line 23:
     ExecStart = "${pkgs.networkmanager}/bin/nmcli radio wwan off";
     ExecStart = "${pkgs.networkmanager}/bin/nmcli radio wwan off";
   };
   };
};</syntaxhighlight>Note that the cellular connection will retain the state after resuming from suspend. This is intended for scenarios such as changing trains. However, if the intended goal is to never establish a cellular connection on resume as well, then simply remove the `RemainAfterExit` line.
};</syntaxhighlight>Note that the state of the cellular connection will be retained after resuming from suspend. This is intended for scenarios such as changing trains. However, if the intended goal is to never establish a cellular connection on resume as well, then simply remove the <code>RemainAfterExit</code> line.


== Troubleshooting ==
== Troubleshooting ==
Line 30: Line 30:
Some modems, such as the Fibocom 350-GL, cause the system to automatically wake up from sleep. The behavior is inconsistent: sometimes it happens immediately, but it can also happen a few seconds or minutes after the machine is in suspended. Other times the machine correctly stays in sleep mode and does not wake up. Other times a loop of continuous suspensions and resumes is experienced.
Some modems, such as the Fibocom 350-GL, cause the system to automatically wake up from sleep. The behavior is inconsistent: sometimes it happens immediately, but it can also happen a few seconds or minutes after the machine is in suspended. Other times the machine correctly stays in sleep mode and does not wake up. Other times a loop of continuous suspensions and resumes is experienced.


As a workaround to the unreliability of such WWAN modules, the user needs to stop the `ModemManager` service before sleep. At this point, suspend should no longer cause the problems mentioned above. The user needs to restart `ModemManager` once the computer is resumed if they intend to connect to cellular data.
As a workaround to the unreliability of such WWAN modules, the user needs to stop the <code>ModemManager</code> service before sleep. At this point, suspend should no longer cause the problems mentioned above. The user needs to restart the <code>ModemManager</code> service once the computer is resumed if they intend to connect to cellular data.


It is possible to automate this behavior by creating tailored Systemd services:<syntaxhighlight lang="nixos">
It is possible to automate this behavior by creating tailored Systemd services:<syntaxhighlight lang="nixos">