-
Notifications
You must be signed in to change notification settings - Fork 1
/
tqmi-connect-usb-test.sh
executable file
·55 lines (41 loc) · 1.17 KB
/
tqmi-connect-usb-test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-2.0-only
# -*- coding: UTF-8 -*-
set -e
IFACE=wwan0
MUX1=112
MUX2=113
# Change APNs according to your provider.
APN1=web.omnitel.it
APN2=mobile.vodafone.it
PROFILE=0
if [[ $(ls /dev/cdc-wdm* | wc -l) -gt 1 ]]; then
echo [!] Automatic tests require only 1 modem connected
exit 1
fi
device=$(ls /dev/cdc-wdm*)
if [[ $PROFILE == 1 ]]; then
profile="--profile"
fi
cmd="./tqmi-connect --device $device --connect --apn $APN1 --iface $IFACE --muxid $MUX1 $profile"
echo $cmd
sudo $cmd
cmd="./tqmi-connect --device $device --connect --apn $APN2 --iface $IFACE --muxid $MUX2 $profile"
echo $cmd
sudo $cmd
QMIMUXA=$(grep QMUX_IFACE ip-session-qmimux0 | cut -d'=' -f2)
QMIMUXB=$(grep QMUX_IFACE ip-session-qmimux1 | cut -d'=' -f2)
sudo ip link set $QMIMUXA up
sudo ip link set $QMIMUXB up
ping -I $QMIMUXA -c 5 www.telit.com
[[ $? != "0" ]] && exit 1
ping -I $QMIMUXB -c 5 www.telit.com
[[ $? != "0" ]] && exit 1
cmd="./tqmi-connect --device $device --release --iface $QMIMUXA"
echo $cmd
sudo $cmd
[[ $? != "0" ]] && exit 1
cmd="./tqmi-connect --device $device --release --iface $QMIMUXB"
echo $cmd
sudo $cmd
[[ $? != "0" ]] && exit 1