Here are the steps to install Sim8202g m.2 alternative 5G global modem and the workaround to get the the modem persistently available in Librem 5. I guess @dos or someone can use it to make something permanent and built-in to PureOS.
Tested on PureOS basic Byzantium and Crimson backports.
Steps in general:
0. Physically install the modem. See some pointers for instance from the disassembly manual or video. Be careful with the antenna connectors, use ANT0 and ANT3.
.
Doing
lsusb
should show “1e0e:9001 Qualcom / Option…” somewhere in the list.
- Copy the two scripts from below to text files and name the as shown.
- Place both of the scripts to appropriate folders, as shown.
- Run the shown commands to make sure the scripts run.
- Reboot. Expect to see in the left corner the 5G icon (4G if you use old ModemManager, or maybe if you don’t have 5G service available or contract).
init-sim8202g.sh (script to add missing stuff with automatic fetch of modem path)
#!/bin/bash
# This is Sim8202g modem installation workaround persisntance script (part 1 0f 2) to Librem5: init-sim8202g.sh
# place this: sudo cp init-sim8202g.sh /usr/local/bin/
# and also do: sudo chmod +x /usr/local/bin/init-sim8202g.sh
# The other is init-sim8202g.service which should be placed: sudo cp init-sim8202g.service /etc/systemd/system/
# and also do: sudo systemctl enable init-sim8202g.service
# reboot and check logs if needed (journalctl -u init-sim8202g.service)
# Load kernel modules
modprobe option
modprobe qmi_wwan
modprobe cdc_wdm
# Dynamically find the USB device path for the modem
DEVICE_PATH=$(find /sys/bus/usb/devices/ -maxdepth 1 -name "1-*" -exec grep -l "1e0e" {}/idVendor 2>/dev/null \; | xargs -I{} dirname {})
if [ -n "$DEVICE_PATH" ]; then
echo 1 > "$DEVICE_PATH/authorized"
else
echo "Modem USB device not found" >&2
exit 1
fi
# Reload udev rules
udevadm control --reload-rules
udevadm trigger
# Wait for udev to settle
sleep 5
# Send AT+CFUN=1,1 to reset the modem via AT command port
if [ -e /dev/ttyUSB2 ]; then
echo -e "AT+CFUN=1,1\r" > /dev/ttyUSB2
else
echo "AT command port /dev/ttyUSB2 not found" >&2
fi
# Wait for modem to reinitialize
sleep 10
# Check for modem devices, report to log
if ls /dev/ttyUSB* 1>/dev/null 2>&1; then
echo "Modem Sim8202g initialized successfully."
else
echo "Modem Sim8202g ttyUSBs not detected." >&2
fi
Place this from the folder you have it with: sudo cp init-sim8202g.sh /usr/local/bin/
And also do: sudo chmod +x /usr/local/bin/init-sim8202g.sh
init-sim8202g.service (initialize the previous script at startup)
[Unit]
Description=Initialize Sim8202g modem
After=network.target
[Service]
ExecStart=/usr/local/bin/init-sim8202g.sh
Type=oneshot
[Install]
WantedBy=multi-user.target
Place this from the folder you have it with: sudo cp init-sim8202g.service /etc/systemd/system/
And also do: sudo systemctl enable init-sim8202g.service
Reboot:
- If success (which is very likely), check audio by making (unimportant) call (if no audio, check audio settings that you have right mic and output and that volume is up).
- If you don’t see the 5G (or 4G) icon, check logs if needed, start with:
journalctl -u init-sim8202g.service
If you see 4G (or lower) icon, check to see that you have 5G as an option in Settings → Mobile Network → Network Mode (it seems that without the rules and installed modules other icons may show up intermittently in crim).
[I’ve had one random occasion when the audio disappeared but haven’t been able to reproduce the problem and reboot has fixed it. Oh, and just to make a note of the “first” of it, I’ve now done the linux PureOS Librem5 5G to Librem5 5G call. The main parts of this thread have been added to the community wiki, where any further how-to steps and info can be edited.]
[Edit to add: Before anyone asks, Purism has responded they are aware of this development. I’d expect it to take a moment to do proper testing and commercial planning.]
[Edit to add: While testing a "FrankenLUKSCrim", I noticed that the scripts did not find the modem and I had to use the manual commands (three modprobes and echo+tee), which worked. No idea why or what’s changed.]