I detect modems by looking at the output of the
One thing to watch out for is at boot time your script might start before the USB subsystem is all the way up (I typically start things from
/etc/rc.local). You can mitigate that by going all-in with
systemd or with some guard code in your startup script like this:
# this is here because usb comes up in parallel with rc.local and might not be ready yet
# usually ten seconds is more than sufficient for usb to come up properly
while [ $found -le 1 ]
if lsusb | egrep Telit; then
echo "[start] Found Telit"
echo "[start] Telit not found"
found=`expr $found + 1`
if [ $found -eq 99 ]; then
python3 ./gps.py --verbose --init --retries 6
python3 ./ecm.py --verbose --start --setclock