+ [ -n "$plmn" ] && {
+ local mcc mnc
+ if [ "$plmn" = 0 ]; then
+ mcc=0
+ mnc=0
+ echo "Setting PLMN to auto"
+ else
+ mcc=${plmn:0:3}
+ mnc=${plmn:3}
+ echo "Setting PLMN to $plmn"
+ fi
+ uqmi -s -d "$device" --set-plmn --mcc "$mcc" --mnc "$mnc" > /dev/null 2>&1 || {
+ echo "Unable to set PLMN"
+ proto_notify_error "$interface" PLMN_FAILED
+ proto_block_restart "$interface"
+ return 1
+ }
+ }
+
+ # Cleanup current state if any
+ uqmi -s -d "$device" --stop-network 0xffffffff --autoconnect > /dev/null 2>&1
+
+ # Set IP format
+ uqmi -s -d "$device" --set-data-format 802.3 > /dev/null 2>&1
+ uqmi -s -d "$device" --wda-set-data-format 802.3 > /dev/null 2>&1
+ dataformat="$(uqmi -s -d "$device" --wda-get-data-format)"
+
+ if [ "$dataformat" = '"raw-ip"' ]; then
+
+ [ -f /sys/class/net/$ifname/qmi/raw_ip ] || {
+ echo "Device only supports raw-ip mode but is missing this required driver attribute: /sys/class/net/$ifname/qmi/raw_ip"
+ return 1
+ }
+
+ echo "Device does not support 802.3 mode. Informing driver of raw-ip only for $ifname .."
+ echo "Y" > /sys/class/net/$ifname/qmi/raw_ip
+ fi
+
+ uqmi -s -d "$device" --sync > /dev/null 2>&1