[PATCH] mbim-network: query ready status and registration state before connecting

Aleksander Morgado aleksander at lanedo.com
Mon Jun 3 00:46:48 PDT 2013


On 31/05/13 18:56, Shawn J. Goff wrote:
> 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.
> 

Nah, it's fine for me. Merged the branch along with your patch.

Thanks!


>  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`
> 


-- 
Aleksander


More information about the libmbim-devel mailing list