diff --git a/userspace/usr/comma/lte/lte.sh b/userspace/usr/comma/lte/lte.sh index 61ab9e1..22c1c62 100755 --- a/userspace/usr/comma/lte/lte.sh +++ b/userspace/usr/comma/lte/lte.sh @@ -10,6 +10,14 @@ LTE_RST_N=50 LTE_BOOT=52 LTE_PWRKEY=116 +function is_modem_up { + if lsusb -d "0x05c6:" >/dev/null 2>&1 || lsusb -d "0x2c7c:" >/dev/null 2>&1; then + return 0 + else + return 1 + fi +} + function reset { echo " Resetting..." gpio $LTE_RST_N 1 @@ -28,7 +36,7 @@ function is_online { echo " Waiting until the modem comes online..." for i in {0..30}; do - if lsusb | grep -q "Quectel"; then + if is_modem_up; then echo " Modem is online!" return 0 fi @@ -44,7 +52,7 @@ function is_offline { echo " Waiting until the modem goes offline..." for i in {0..30}; do - if ! lsusb | grep -q "Quectel"; then + if ! is_modem_up; then echo " Modem is offline!" return 0 fi