summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO6
-rw-r--r--PKGBUILD6
-rw-r--r--mobile_mm44
-rw-r--r--mobile_mm.profile2
4 files changed, 33 insertions, 25 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 64aa68decd89..78e163af9095 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = netctl-mm
pkgdesc = Mobile broadband support for netctl using ModemManager
- pkgver = 0.0.9
+ pkgver = 0.0.11
pkgrel = 1
arch = any
license = GPL
@@ -8,8 +8,8 @@ pkgbase = netctl-mm
depends = modemmanager
source = mobile_mm.profile
source = mobile_mm
- md5sums = 7b317a1f78ad63bfb8fb4973309883f5
- md5sums = 9d3bcdaba9096d840bde6f4014bf175e
+ md5sums = 03d3c43f41396093c64348c89c9c6342
+ md5sums = 0f19810092c4600a13ea0aa5c5994658
pkgname = netctl-mm
diff --git a/PKGBUILD b/PKGBUILD
index 1c632b18aa2a..e29693357003 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,14 +1,14 @@
# Maintainer: Max Wölfing <ff0x@infr.cat>
pkgname=netctl-mm
-pkgver=0.0.9
+pkgver=0.0.11
pkgrel=1
pkgdesc="Mobile broadband support for netctl using ModemManager"
arch=(any)
license=('GPL')
depends=(netctl modemmanager)
source=(mobile_mm.profile mobile_mm)
-md5sums=('7b317a1f78ad63bfb8fb4973309883f5'
- '9d3bcdaba9096d840bde6f4014bf175e')
+md5sums=('03d3c43f41396093c64348c89c9c6342'
+ '0f19810092c4600a13ea0aa5c5994658')
package() {
install -Dm644 "$srcdir/mobile_mm.profile" "$pkgdir/etc/netctl/examples/mobile_mm"
diff --git a/mobile_mm b/mobile_mm
index 657d48fbc312..05c8ad151380 100644
--- a/mobile_mm
+++ b/mobile_mm
@@ -1,5 +1,5 @@
# Contributed by Max Wölfing <ff0x@infr.cat>
-# Version: 0.0.9
+# Version: 0.0.13
# KNOWN BUGS:
# - After suspend/hibernate the mobile broadband connection is not going to reconnect automatically (that's probably ok)
@@ -24,7 +24,7 @@ if [[ -z "$MODEM_ID" ]] || [[ ! "$MODEM_ID" =~ ^[0-9]+$ ]]; then
# Wait until ModemManager has initialised the modem
TIMEOUT_MODEM=${TimeoutModem:-5}
- until [[ $($__MMCLI -L 2>/dev/null | awk '/\/Modem\// {print $1}' | cut -d/ -f 6) =~ ^[0-9]+$ ]] || [ $TIMEOUT_MODEM -eq 0 ]; do
+ until [[ $($__MMCLI -L 2>/dev/null | awk '/\/Modem\// {print $1}' | cut -d/ -f 6) =~ ^[0-9]+$ ]] || [ "$TIMEOUT_MODEM" -eq 0 ]; do
sleep 1
((TIMEOUT_MODEM--))
done
@@ -46,13 +46,13 @@ if [[ -z "$MODEM" ]]; then
fi
# Get the modem status
-MODEM_STATUS=$($__MMCLI -m "$MODEM" | awk '/Status/ {for(i=1; i<5; i++) {getline; if ($2=="state:") {gsub("\047","",$3); print $3}}}')
+MODEM_STATUS=$($__MMCLI -m "$MODEM" 2>/dev/null | awk '/Status/ {for(i=1; i<5; i++) {getline; if ($2=="state:") {gsub("\047","",$3); print $3}}}')
if [[ "$MODEM_STATUS" == 'locked' ]]; then
report_notice "Modem is locked. Trying to supply PIN, if provided in the connection profile.."
if [[ $Pin ]]; then
PUK=""; [[ $Puk ]] && PUK="--puk=${Puk}"
SIM_PATH=$($__MMCLI -m "$MODEM" 2>/dev/null | grep 'SIM' | awk '{print $4}' | sed "s/'//g")
- if [[ ! -z "$SIM_PATH" ]]; then
+ if [[ -n "$SIM_PATH" ]]; then
$__MMCLI -m "$MODEM_ID" -i "$SIM_PATH" $PUK --pin="${Pin}" >/dev/null 2>&1
MODEM_STATUS=$($__MMCLI -L 2>/dev/null | sed -n "s/.*state: '\([^ \t]\+\)'.*/\1/p")
if [[ "$MODEM_STATUS" == 'locked' ]]; then
@@ -117,30 +117,38 @@ function mobile_mm_up {
fi
report_debug "Full connect string: $__MMCLI -m $MODEM --set-allowed-modes=ANY --set-preferred-mode=${Mode} --simple-connect=$connect_args"
- $__MMCLI -m "$MODEM" --set-allowed-modes=ANY --set-preferred-mode="${Mode}" --simple-connect="$connect_args" $(if [ "$NETCTL_DEBUG" == 'yes' ]; then echo '2>/dev/null'; fi)
- local bearer bearer_interface
- bearer=$($__MMCLI -m "$MODEM" $(if [ "$NETCTL_DEBUG" == 'yes' ]; then echo '2>/dev/null'; fi) | sed -n 's#.*\(/org/.*/Bearer/[0-9]\+\).*#\1#p')
+
+ # Trying to establish the broadband connection until the modem got its bearer (and the bearer_interface) or the timeout is reached
+ local bearer=''; bearer_interface=''; TIMEOUT_CONNECT=${TimeoutConnect:-30}
+ until [[ -n "$bearer_interface" ]] || [ "$TIMEOUT_CONNECT" -eq 0 ]; do
+ $__MMCLI -m "$MODEM" --set-allowed-modes=ANY --set-preferred-mode="${Mode}" --simple-connect="$connect_args"
+
+ if [[ -n "$bearer" ]]; then
+ report_debug "Bearer found on modem"
+ until [[ $($__MMCLI -m "$MODEM" -b "$bearer" 2>/dev/null | awk '/Status/ {for(i=1; i<5; i++) {getline; if ($2=="interface:") {gsub("\047","",$3); print $3}}}') ]] || [ "$TIMEOUT_CONNECT" -eq 0 ]; do
+ sleep 1
+ ((TIMEOUT_CONNECT--))
+ done
+ bearer_interface=$($__MMCLI -m "$MODEM" -b "$bearer" 2>/dev/null | awk '/Status/ {for(i=1; i<5; i++) {getline; if ($2=="interface:") {gsub("\047","",$3); print $3}}}')
+ else
+ sleep 1
+ bearer=$($__MMCLI -m "$MODEM" 2>/dev/null | sed -n 's#.*\(/org/.*/Bearer/[0-9]\+\).*#\1#p')
+ ((TIMEOUT_CONNECT--))
+ fi
+ done
if [[ -z "$bearer" ]]; then
report_error "No bearer found!"
return 1
fi
- get_bearer_interface="$__MMCLI -m $MODEM -b $bearer | awk '/Status/ {for(i=1; i<5; i++) {getline; if ($2=="interface:") {gsub("\047","",$3); print $3}}}'"
-
- # Some modems need some time for the initialisation the connection
- TIMEOUT_CONNECTION=${TimeoutConnect:-30}
- until [[ $($__MMCLI -m $MODEM -b $bearer | awk '/Status/ {for(i=1; i<5; i++) {getline; if ($2=="interface:") {gsub("\047","",$3); print $3}}}') ]] || [ $TIMEOUT_CONNECTION -eq 0 ]; do
- sleep 1
- ((TIMEOUT_CONNECTION--))
- done
-
- bearer_interface=$($__MMCLI -m "$MODEM" -b "$bearer" $(if [ "$NETCTL_DEBUG" == 'yes' ]; then echo '2>/dev/null'; fi) | awk '/Status/ {for(i=1; i<5; i++) {getline; if ($2=="interface:") {gsub("\047","",$3); print $3}}}')
-
if [[ -z "$bearer_interface" ]]; then
report_error "No bearer interface found. Consider increasing \$TimeoutConnect a bit."
return 1
fi
+
+ report_debug "Interface found on modem bearer"
+
if [[ "$bearer_interface" != "$Interface" ]]; then
report_notice "Network interface used by the bearer is not the same as provided by your connection profile. Please update the profile using the right bearer interface: '$bearer_interface'"
Interface=$bearer_interface
diff --git a/mobile_mm.profile b/mobile_mm.profile
index 9d17077351cf..e0da3f977976 100644
--- a/mobile_mm.profile
+++ b/mobile_mm.profile
@@ -42,7 +42,7 @@ AccessPointName=apn
#TimeoutModem=10
# Amount of seconds, we will wait for the connection is established (default: 30)
-#TimeoutConnect=60
+#TimeoutConnect=35
# Preferred mode can be one of {ANY, 2G, 3G, 4G} (default: 4G)
#Mode=4G