use USB vendor ID for modem upness

This commit is contained in:
Adeeb Shihadeh
2024-08-22 15:57:36 -07:00
parent 2e03eabbfe
commit 7020d829da
+10 -2
View File
@@ -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