Script to re-init modem && app Files

I’m using the script below to recover the modem when this goes “away”. Since some times this also pops up when it is executed the app Files saying something like “Phone Shell 16 GB Volume” and offers to open it, why is this?

#!/bin/sh

# from https://source.puri.sm/Librem5/linux-next/-/issues/303
#
# Clayton Craft @craftyguy
# Contributor
# 
# I've been using the following script to "recover" the modem when it
# disappears, it seems to work every time for me:

set -x
sudo rmmod xhci_plat_hcd xhci_hcd

echo 0 | sudo tee /sys/class/leds/wwan_en/brightness
sleep 2

sudo modprobe xhci_plat_hcd
sleep 5

echo 1 | sudo tee /sys/class/leds/wwan_en/brightness

# added by guru@unixarea.de
#
sleep 5
sudo systemctl restart ModemManager
3 Likes

What I understood is that the script resets an internal usb hub and my observation is that during reset (power off and drivers onloaded) the sdcard is gone also (didn’t verify against the schematics or anything - just explained to myself, why it would disappear and re-appear and why my backup would be interrupted in these moments).

So I’d guess that you have some sdcard and some partition on that card that would be automounted to /media/purism/.

I have the same message with some different wording each time the script resets my usb.

If this is all rubbish I’m writing I would be happy to learn the real explanation :wink: !