Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

umbim / wwan: bugfixes + support for non-dhcp devices #2759

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
86 changes: 64 additions & 22 deletions package/network/utils/umbim/files/lib/netifd/proto/mbim.sh
Expand Up @@ -17,6 +17,7 @@ proto_mbim_init_config() {
proto_config_add_string auth
proto_config_add_string username
proto_config_add_string password
proto_config_add_boolean dhcp
proto_config_add_defaults
}

Expand All @@ -25,8 +26,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 auth username password dhcp $PROTO_DEFAULT_OPTIONS
json_get_vars device apn pincode delay auth username password dhcp $PROTO_DEFAULT_OPTIONS

[ -n "$ctl_device" ] && device=$ctl_device

Expand Down Expand Up @@ -134,28 +135,69 @@ _proto_mbim_setup() {
done
tid=$((tid + 1))

uci_set_state network $interface tid "$tid"
echo "mbim[$$]" "Connected"

echo "mbim[$$]" "Connected, starting DHCP"
proto_init_update "$ifname" 1
proto_send_update "$interface"
if [ "$dhcp" = 0 ]; then
echo "mbim[$$]" "Setting up $ifname"
eval $(umbim $DBG -n -t $tid -d $device config | sed 's/: /=/g')
tid=$((tid + 1))

json_init
json_add_string name "${interface}_4"
json_add_string ifname "@$interface"
json_add_string proto "dhcp"
proto_add_dynamic_defaults
json_close_object
ubus call network add_dynamic "$(json_dump)"

json_init
json_add_string name "${interface}_6"
json_add_string ifname "@$interface"
json_add_string proto "dhcpv6"
json_add_string extendprefix 1
proto_add_dynamic_defaults
json_close_object
ubus call network add_dynamic "$(json_dump)"
proto_init_update "$ifname" 1
proto_send_update "$interface"

json_init
json_add_string name "${interface}_4"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While already touching this - as I mentioned in the comment, I would selectively enable sub-interfaces basing on IP type selection.
Otherwise - LGTM.

json_add_string ifname "@$interface"
json_add_string proto "static"
json_add_array ipaddr
json_add_string "" "$ipv4address"
json_close_array
json_add_string gateway "$ipv4gateway"
json_add_array dns
json_add_string "" "$ipv4dnsserver"
json_close_array
proto_add_dynamic_defaults
json_close_object
ubus call network add_dynamic "$(json_dump)"

json_init
json_add_string name "${interface}_6"
json_add_string ifname "@$interface"
json_add_string proto "static"
json_add_array ip6addr
json_add_string "" "$ipv6address"
json_close_array
json_add_string ip6gw "$ipv6gateway"
json_add_array dns
json_add_string "" "$ipv6dnsserver"
json_close_array
proto_add_dynamic_defaults
json_close_object
ubus call network add_dynamic "$(json_dump)"
else
echo "mbim[$$]" "Starting DHCP on $ifname"
proto_init_update "$ifname" 1
proto_send_update "$interface"

json_init
json_add_string name "${interface}_4"
json_add_string ifname "@$interface"
json_add_string proto "dhcp"
proto_add_dynamic_defaults
json_close_object
ubus call network add_dynamic "$(json_dump)"

json_init
json_add_string name "${interface}_6"
json_add_string ifname "@$interface"
json_add_string proto "dhcpv6"
json_add_string extendprefix 1
proto_add_dynamic_defaults
json_close_object
ubus call network add_dynamic "$(json_dump)"
fi

uci_set_state network $interface tid "$tid"
}

proto_mbim_setup() {
Expand Down
2 changes: 1 addition & 1 deletion package/network/utils/wwan/Makefile
Expand Up @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=wwan
PKG_VERSION:=2019-04-29
PKG_RELEASE=5
PKG_RELEASE=6

PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=
Expand Down
5 changes: 5 additions & 0 deletions package/network/utils/wwan/files/data/1e2d-005d
@@ -0,0 +1,5 @@
{
"desc": "Cinterion ELS61/ELS81 MBIM",
"type": "mbim",
"dhcp": 0
}
4 changes: 4 additions & 0 deletions package/network/utils/wwan/files/data/1e2d-00b3
@@ -0,0 +1,4 @@
{
"desc": "Cinterion MV31-W MBIM",
"type": "mbim"
}
8 changes: 6 additions & 2 deletions package/network/utils/wwan/files/wwan.sh
Expand Up @@ -36,7 +36,7 @@ proto_wwan_init_config() {
}

proto_wwan_setup() {
local driver usb devicename desc bus
local driver usb devicename desc bus dhcp

json_get_vars bus

Expand Down Expand Up @@ -79,7 +79,7 @@ proto_wwan_setup() {
json_init
json_load "$(cat "$usb")"
json_select
json_get_vars desc control data
json_get_vars desc control data dhcp
json_set_namespace "$old_cb"

[ -n "$control" -a -n "$data" ] && {
Expand Down Expand Up @@ -115,6 +115,10 @@ proto_wwan_setup() {
return 1
}

[ -n "$dhcp" ] && {
json_add_string dhcp "$dhcp"
}

uci_set_state network "$interface" driver "$driver"
uci_set_state network "$interface" ctl_device "$ctl_device"
uci_set_state network "$interface" dat_device "$dat_device"
Expand Down
4 changes: 4 additions & 0 deletions target/linux/mediatek/dts/mt7623a-unielec-u7623-02-emmc.dtsi
Expand Up @@ -298,6 +298,10 @@
};
};

&mt6323keys {
mediatek,long-press-mode = <0>;
};

&uart2 {
pinctrl-names = "default";
pinctrl-0 = <&uart2_pins_b>;
Expand Down