[PATCH] mbim-network: query ready status and registration state before connecting
Shawn J. Goff
shawn7400 at gmail.com
Fri May 31 09:56:01 PDT 2013
From: "Shawn J. Goff" <shawn.goff at accelecon.com>
Some modems (such as the 340u) requre these two queries before it
will attach to the packet service.
Signed-off-by: Shawn J. Goff <shawn.goff at accelecon.com>
---
As promised...
This patch does the dumbest thing possible, so there are a couple of not-perfect things:
1) There is now repeated code of build-command->echo-command->do-command->grab-trid. This could go into a function.
2) We could poll the ready-status and registration-state until they're good (with a reasonable timeout)
Let me know if you'd like either of those two things addressed or if you see any other problems.
utils/mbim-network | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/utils/mbim-network b/utils/mbim-network
index 4b4ed41..404d511 100755
--- a/utils/mbim-network
+++ b/utils/mbim-network
@@ -105,7 +105,32 @@ connect ()
clear_state
fi
- ATTACH_CMD="mbimcli -d $DEVICE --attach-packet-service --no-close"
+ SUBSCRIBER_READY_CMD="mbimcli -d $DEVICE --query-subscriber-ready-status --no-close"
+ echo "Querying subscriber ready status '$SUBSCRIBER_READY_CMD'..."
+
+ SUBSCRIBER_READY_OUT=`$SUBSCRIBER_READY_CMD`
+ echo $SUBSCRIBER_READY_OUT
+
+ # Save the new TRID
+ TRID=`echo "$SUBSCRIBER_READY_OUT" | sed -n "s/.*TRID.*'\(.*\)'.*/\1/p"`
+ if [ "x$TRID" != "x" ]; then
+ save_state "TRID" $TRID
+ fi
+
+
+ REGISTRATION_STATE_CMD="mbimcli -d $DEVICE --query-registration-state --no-open=$TRID --no-close"
+ echo "Querying registration state '$REGISTRATION_STATE_CMD'..."
+
+ REGISTRATION_STATE_OUT=`$REGISTRATION_STATE_CMD`
+ echo $REGISTRATION_STATE_OUT
+
+ # Save the new TRID
+ TRID=`echo "$REGISTRATION_STATE_OUT" | sed -n "s/.*TRID.*'\(.*\)'.*/\1/p"`
+ if [ "x$TRID" != "x" ]; then
+ save_state "TRID" $TRID
+ fi
+
+ ATTACH_CMD="mbimcli -d $DEVICE --attach-packet-service --no-open=$TRID --no-close"
echo "Attaching to packet service with '$ATTACH_CMD'..."
ATTACH_OUT=`$ATTACH_CMD`
--
1.8.2.3
More information about the libmbim-devel
mailing list