How to start Huawei K5150 LTE modem (Hilink Mode)?

Hello I have
Aerohive AP350 router with OpenWrt 19.07.3, r11063-85e04e9f46
Huawei K5150 LTE modem

On windows 7 modem works as a network interface, and no problems with it.
When I plug it into router the purpure indicator blinking that indicates 4G connection.

dmesg->
usb 1-1: new high-speed USB device number 3 using fsl-ehci

lsusb ->
Bus 001 Device 002: ID 12d1:1f16 Huawei Technologies Co., Ltd. K5150 LTE modem (Mass Storage Mode)

What shoul I do to use modem as a WAN interface?

UPD. When LED is blinking its not connected, its says that network has been found – modem could connect

hilink mode:

opkg update
opkg install kmod-usb-net-cdc-ether usb-modeswitch

a new network interface should come up in luci (with dhcp proto), add that to wan firewall zone.

edit: you may need to reboot router once after kmod install for the interface to show up.

I followed that instruction. And after that new devices appeared. But it didn't work.

root@OpenWrt:~# lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=fsl-ehci/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=, 480M

opkg install kmod-usb-net-rndis usb-modeswitch
reboot

root@OpenWrt:~# lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=fsl-ehci/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Communications, Driver=, 480M
    |__ Port 1: Dev 2, If 1, Class=CDC Data, Driver=, 480M
    |__ Port 1: Dev 2, If 2, Class=Mass Storage, Driver=, 480M

I'm not completely understand how it works, so tryed a lot of instructions.
So finally I found solution (start connection manually)-

root@OpenWrt:~# mbim-network /dev/cdc-wdm0 start
Loading profile at /etc/mbim-network.conf...
    APN: internet
    APN auth protocol: unset
    APN user: unset
    APN password: unset
    mbim-proxy: no
Querying subscriber ready status 'mbimcli -d /dev/cdc-wdm0 --query-subscriber-re                                                                                        ady-status --no-close '...
[/dev/cdc-wdm0] Subscriber ready status retrieved: Ready state: 'initialized' Su                                                                                        bscriber ID: '255072000488097' SIM ICCID: '8938007200004930972F' Ready info: 'no                                                                                        ne' Telephone numbers: (0) 'unknown' [/dev/cdc-wdm0] Session not closed: TRID: '                                                                                        4'
Saving state at /tmp/mbim-network-state-cdc-wdm0... (TRID: 4)
Querying registration state 'mbimcli -d /dev/cdc-wdm0 --query-registration-state                                                                                         --no-open=4 --no-close '...
error: operation failed: Transaction timed out
[/dev/cdc-wdm0] Session not closed: TRID: '5'
Saving state at /tmp/mbim-network-state-cdc-wdm0... (TRID: 5)
Attaching to packet service with 'mbimcli -d /dev/cdc-wdm0 --attach-packet-servi                                                                                        ce --no-open=5 --no-close '...
error: operation failed: Transaction timed out
Saving state at /tmp/mbim-network-state-cdc-wdm0... (TRID: 6)
Starting network with 'mbimcli -d /dev/cdc-wdm0 --connect=apn='internet' --no-op                                                                                        en=6 --no-close '...
error: operation failed: Transaction timed out
Network start failed
[/dev/cdc-wdm0] Session not closed: TRID: '7'
Saving state at /tmp/mbim-network-state-cdc-wdm0... (TRID: 7)

Network connection is succsessful, even despite the 'Network start failed' .
Maybe it didn't work because it needs more time than I aspected.
I will try restart router and be more patience.

Thank you for help!

UPD. unfortunately connection doesn't start autommaticaly. I will try to Hard Reset the device, maybe it will help.

unplug dongle.. reboot.. logread -f re-plug dongle.. and post output here if you can.. you should read something like cdc_ether 1-1:1.0 eth1: register (with the above packages installed if you already did an hard reset)

root@OpenWrt:~# logread -f
Sun Sep 27 16:14:58 2020 kern.info kernel: [  306.316863] usb 1-1: new high-speed USB device number 3 using fsl-ehci

UPD.
I found out what configuration make it work:

  1. opkg update
  2. opkg install usb-modeswitch kmod-usb-net-cdc-mbim mbim-utils
  3. Check if interfsce exists
    ls -l /dev/cdc-wdm0 ->>>
    crw------- 1 root root 180, 176 Sep 27 16:50 /dev/cdc-wdm0
  4. Check for usb interface
    dmesg |grep usb ->>>
    cdc_mbim 1-1:2.0 **wwan0:** register 'cdc_mbim' at usb-fsl-ehci.0-1, CDC MBIM, ee:d1:29:0d:4e:67
  5. Create New Interface -> wwan0 - DHCP
  6. mbim-network /dev/cdc-wdm0 start
Profile at '/etc/mbim-network.conf' not found...
Querying subscriber ready status 'mbimcli -d /dev/cdc-wdm0 --query-subscriber-ready-status --no-close '...
[/dev/cdc-wdm0] Subscriber ready status retrieved: Ready state: 'initialized' Subscriber ID: '255072000488097' SIM ICCID: '8938007200004930972F' Ready info: 'none' Telephone numbers: (0) 'unknown' [/dev/cdc-wdm0] Session not closed: TRID: '3'
Saving state at /tmp/mbim-network-state-cdc-wdm0... (TRID: 3)
Querying registration state 'mbimcli -d /dev/cdc-wdm0 --query-registration-state --no-open=3 --no-close '...
[/dev/cdc-wdm0] Registration status: Network error: 'unknown' Register state: 'roaming' Register mode: 'automatic' Available data classes: 'umts, hsdpa, hsupa, custom' Current cellular class: 'gsm' Provider ID: '25501' Provider name: 'MTS UKR' Roaming text: 'unknown' Registration flags: 'packet-service-automatic-attach' [/dev/cdc-wdm0] Session not closed: TRID: '4'
Saving state at /tmp/mbim-network-state-cdc-wdm0... (TRID: 4)
Attaching to packet service with 'mbimcli -d /dev/cdc-wdm0 --attach-packet-service --no-open=4 --no-close '...
Saving state at /tmp/mbim-network-state-cdc-wdm0... (TRID: 5)
Starting network with 'mbimcli -d /dev/cdc-wdm0 --connect=apn='' --no-open=5 --no-close '...
Network started successfully
Saving state at /tmp/mbim-network-state-cdc-wdm0... (TRID: 7)

That all I have managed to find out at the moment.

needed packages (please reboot after installing kmod packages!):

opkg update
opkg install kmod-usb-net-cdc-ether kmod-usb-net-cdc-mbim kmod-usb-net-cdc-ncm kmod-usb-net-huawei-cdc-ncm umbim usb-modeswitch
reboot

add lte interface vi /etc/config/network:

config interface 'lte'
	option proto 'wwan'
	option ifname 'wwan0'
	option apn 'your-apn-here'

add lte interface to wan zone vi /etc/config/firewall:

config zone
	option name 'wan'
	option input 'REJECT'
	option output 'ACCEPT'
	option forward 'REJECT'
	option masq '1'
	option mtu_fix '1'
	option network 'lte wan wan6'

restart network:

/etc/init.d/network restart

edit: FWIW i always remove pin request for sim card.

I will try do this at weekend.