@@ -54,6 +54,15 @@ LE910Cx_modes=$(cat << EOF
54546 1251 RNDIS+NMEA+MODEM+MODEM+SAP
5555EOF
5656)
57+ LE910_V2_modes=$( cat << EOF
58+ 0 0036 NCM
59+ 1 0034
60+ 2 0035
61+ 3 0032 MBIM+NCM
62+ 4 0037 NCM
63+ 5 0033 MBIM+NCM
64+ EOF
65+ )
5766LM9x0_modes=$( cat << EOF
58670 1042 RNDIS DIAG ADB NMEA MODEM MODEM AUX
59681 1040 DIAG ADB RMnet NMEA MODEM MODEM AUX
@@ -100,15 +109,25 @@ set -e
100109check_dependencies
101110check_pid_exists
102111case ${_pid} in
112+
113+ 0036|0034|0035|0032|0037|0033)
114+ modem=" LE910_V2"
115+ tty=/dev/ttyACM0
116+ NEED_RESET=1
117+ ;;
103118 1040|1042|1041|1043)
104119 modem=" LM9x0"
105120 tty=/dev/ttyUSB3
106121 ;;
107- 1201|1203|1204|1205|1206|1250| 1251)
122+ 1201|1203|1204|1205|1206|1251)
108123 modem=" LE910Cx"
109124 tty=/dev/ttyUSB3
110125 ;;
111- 1062|1060|1061|1063|1064)
126+ 1250)
127+ modem=" LE910Cx"
128+ tty=/dev/ttyUSB1
129+ ;;
130+ 1062|1060|1061|1063|1064|1066)
112131 modem=" LN920"
113132 tty=/dev/ttyUSB3
114133 ;;
@@ -147,13 +166,22 @@ set -x
147166sudo sendat -p $tty -c ' at#usbcfg=' $mode
148167set +x
149168
150- echo [+] waiting $_timeout seconds for the modem to reconfigure into $next_pid ...
169+ if [[ -n $NEED_RESET ]]; then
170+ sudo sendat -p $tty -c ' at#reboot'
171+ fi
172+
173+ dmesg_minor_version=$( dmesg --version | cut -d" " -f4 | cut -d" ." -f2)
174+
175+ # dmesg --follow-new flag is supported from minor version 37 only
176+ if [[ $dmesg_minor_version -ge 37 ]]; then
177+ echo [+] waiting $_timeout seconds for the modem to reconfigure into $next_pid ...
151178/usr/bin/expect << EOF
152179set timeout $_timeout
153- spawn dmesg -TW
180+ spawn dmesg --ctime --follow-new
154181expect {
155182 timeout { send_user "\nWait timed out. Either the modem is slower or did not reconfigure correctly, please check manually.\n"; exit 1 }
156183 eof { send_user "\ncould not get dmesg\n"; exit 1 }
157184 "New USB device found*idProduct=$next_pid *" { send_user "\nModem reconfigured correctly\n"; exit 0 }
158185}
159186EOF
187+ fi
0 commit comments