-
Notifications
You must be signed in to change notification settings - Fork 1
/
tqmi-connect-pcie-test.sh
52 lines (39 loc) · 1.15 KB
/
tqmi-connect-pcie-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
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-2.0-only
# -*- coding: UTF-8 -*-
set -e
IFACE=mhi_hwip0
# This is the device name in kernel v5.15, but it might change in other
# versions (e.g. v5.13 is /dev/wwan0p3QMI).
DEVICE=/dev/wwan0qmi0
MUX1=112
MUX2=113
# Change APNs according to your provider.
APN1=ibox.tim.it
APN2=wap.tim.it
PROFILE=0
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-rmnet0 | cut -d'=' -f2)
QMIMUXB=$(grep QMUX_IFACE ip-session-rmnet1 | 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