aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/utils/umbim/files/lib
diff options
context:
space:
mode:
authorJulio Gonzalez Gil <git@juliogonzalez.es>2022-08-14 23:06:31 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2022-12-15 00:42:54 +0100
commitb1204ce28cf259e86c442df759c92127f5e6e678 (patch)
tree4be9ac0e6fa114de6f63fca7e94faea6c5fbc2e1 /package/network/utils/umbim/files/lib
parent15bc6b23c7554cfb7005d1fa6e43d2db690de345 (diff)
downloadupstream-b1204ce28cf259e86c442df759c92127f5e6e678.tar.gz
upstream-b1204ce28cf259e86c442df759c92127f5e6e678.tar.bz2
upstream-b1204ce28cf259e86c442df759c92127f5e6e678.zip
umbim: Allow roaming and partner connections
Allow registration if the SIM is roaming or partner mode, by adding two new options to the protocol. Until now, such registration failed because umbim returns exit codes 4 and 5 for such situations. Signed-off-by: Julio Gonzalez Gil <git@juliogonzalez.es> (cherry picked from commit 840ce0a65bbb7ba13a547f90cb94452b290475ef)
Diffstat (limited to 'package/network/utils/umbim/files/lib')
-rwxr-xr-xpackage/network/utils/umbim/files/lib/netifd/proto/mbim.sh31
1 files changed, 25 insertions, 6 deletions
diff --git a/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh b/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh
index 3fa411c6c6..64bb8176a0 100755
--- a/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh
+++ b/package/network/utils/umbim/files/lib/netifd/proto/mbim.sh
@@ -14,6 +14,8 @@ proto_mbim_init_config() {
proto_config_add_string apn
proto_config_add_string pincode
proto_config_add_string delay
+ proto_config_add_boolean allow_roaming
+ proto_config_add_boolean allow_partner
proto_config_add_string auth
proto_config_add_string username
proto_config_add_string password
@@ -25,8 +27,8 @@ _proto_mbim_setup() {
local tid=2
local ret
- local device apn pincode delay $PROTO_DEFAULT_OPTIONS
- json_get_vars device apn pincode delay auth username password $PROTO_DEFAULT_OPTIONS
+ local device apn pincode delay allow_roaming allow_partner $PROTO_DEFAULT_OPTIONS
+ json_get_vars device apn pincode delay auth username password allow_roaming allow_partner $PROTO_DEFAULT_OPTIONS
[ -n "$ctl_device" ] && device=$ctl_device
@@ -108,14 +110,31 @@ _proto_mbim_setup() {
tid=$((tid + 1))
echo "mbim[$$]" "Register with network"
- umbim $DBG -n -t $tid -d $device registration || {
- echo "mbim[$$]" "Subscriber registration failed"
+ connected=0
+ umbim $DBG -n -t $tid -d $device registration
+ reg_status=$?
+ case $reg_status in
+ 0) echo "mbim[$$]" "Registered in home mode"
+ tid=$((tid + 1))
+ connected=1;;
+ 4) if [ "$allow_roaming" = "1" ]; then
+ echo "mbim[$$]" "Registered in roaming mode"
+ tid=$((tid + 1))
+ connected=1
+ fi;;
+ 5) if [ "$allow_partner" = "1" ]; then
+ echo "mbim[$$]" "Registered in partner mode"
+ tid=$((tid + 1))
+ connected=1
+ fi;;
+ esac
+ if [ $connected -ne 1 ]; then
+ echo "mbim[$$]" "Subscriber registration failed (code $reg_status)"
tid=$((tid + 1))
umbim $DBG -t $tid -d "$device" disconnect
proto_notify_error "$interface" NO_REGISTRATION
return 1
- }
- tid=$((tid + 1))
+ fi
echo "mbim[$$]" "Attach to network"
umbim $DBG -n -t $tid -d $device attach || {