Trouble getting started with Huawei E8372H-320 LTE dongle on WRT3200ACM

I'm moving to a new residence and will sadly need to switch to 4G(LTE) for a bit. I decided after much reading on this forum to go for the Huawei E8372H-320 which is an LTE dongle with built in WiFi and plug it in to my current router.

My setup

  • Linksys WRT3200ACM running OpenWrt 19.07.7 r11306-c4a6851c72 / LuCI openwrt-19.07 branch git-21.044.30835-34e0d65

  • Now new Huawei E8372H-320

My goal

The plan was to use this dongle to get an external IP address from my ISP to my WRT3200ACM.

My "research"

To get external IP I need to put the dongle in "Stick Mode" or NCM/NDIS mode to get high speeds (LTE). This openwrt wiki shows how to do this, although I'm not sure if the information is outdated as this thread describes a much different way.

My current problem and debugging

I knew this was going to have its challenges and might require asking here on the forum. Unfortunately I got stuck quite fast. Please correct me if I got any of my facts wrong.

Following the mentioned ncm setup wiki I started with installing the packages, rebooting my router and connecting the dongle. Upon running ls -l /dev/cdc-wdm0 I get an error that there is no such file or directory


root@OpenWrt:~# ls -l /dev/cdc-wdm0

ls: /dev/cdc-wdm0: No such file or directory

I then took a look at dmesg which shows the following output.


[ 5566.163126] usb 2-1: USB disconnect, device number 64

[ 5566.662449] usb 2-1: new high-speed USB device number 65 using xhci-hcd

[ 5569.174921] usb 2-1: USB disconnect, device number 65

[ 5569.673455] usb 2-1: new high-speed USB device number 66 using xhci-hcd

[ 5569.865318] usb-storage 2-1:1.0: USB Mass Storage device detected

[ 5569.871839] scsi host2: usb-storage 2-1:1.0

[ 5569.914336] usb 2-1: USB disconnect, device number 66

[ 5570.413703] usb 2-1: new high-speed USB device number 67 using xhci-hcd

[ 5572.926131] usb 2-1: USB disconnect, device number 67

[ 5573.424704] usb 2-1: new high-speed USB device number 68 using xhci-hcd

[ 5573.606190] usb-storage 2-1:1.0: USB Mass Storage device detected

[ 5573.617287] scsi host2: usb-storage 2-1:1.0

[ 5573.655666] usb 2-1: USB disconnect, device number 68

[ 5574.154946] usb 2-1: new high-speed USB device number 69 using xhci-hcd

This goes on forever in a loop with the device number running up to 127 before going around.

When running usbmode -l I get different output where the device sometimes shows up, but for the most part is is abcent.


root@OpenWrt:~# usbmode -l

root@OpenWrt:~# usbmode -l

root@OpenWrt:~# usbmode -l

root@OpenWrt:~# usbmode -l

root@OpenWrt:~# usbmode -l

root@OpenWrt:~# usbmode -l

Found device: 12d1:1f01 (Manufacturer: "HUAWEI_MOBILE", Product: "HUAWEI_MOBILE", Serial: "0123456789ABCDEF")

root@OpenWrt:~# usbmode -l

I now thought that USB power may be the problem so I plugged the dongle to a powered USB HUB. This made no difference at all. I tried to use another powered USB HUB with the same result. Worth mentioning is that these two HUB's both work without the external power supply if that can change things in any way. I also tried both hubs connected to a laptop and it worked good.

Worth noticing is that this dongle has its own WiFi and this works without interruption to connect to from other devices (tested with bandwidth tests and continues ping, it is stable). This is the case for when the dongle is connected directly to any of the routers USBports (USB2 and USB3) or via any of the USB HUB's. At this point I'm thinking that this is not a power issue at all. (I also tried turning WiFi off on the dongle if that pulled the extra juice).

I then installed and ran lsusb which showed something interesting. The result here is also different every time but with the difference that there is always a device present. This I hope can shed some light into what is going on. It would seem that the dongle is switching modes back and forth.


root@OpenWrt:~# lsusb

Bus 002 Device 110: ID 12d1:1f01 Huawei Technologies Co., Ltd. E353/E3131 (Mass storage mode)

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

root@OpenWrt:~# lsusb

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 002 Device 111: ID 12d1:14db Huawei Technologies Co., Ltd. E353/E3131

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

Here is the output from lsusb -v just in case for the two detected devices.


Bus 002 Device 109: ID 12d1:14db Huawei Technologies Co., Ltd. E353/E3131

Device Descriptor:

  bLength                18

  bDescriptorType         1

  bcdUSB               2.00

  bDeviceClass            2 Communications

  bDeviceSubClass         0

  bDeviceProtocol         0

  bMaxPacketSize0        64

  idVendor           0x12d1 Huawei Technologies Co., Ltd.

  idProduct          0x14db E353/E3131

  bcdDevice            1.02

  iManufacturer           1 HUAWEI_MOBILE

  iProduct                2 HUAWEI_MOBILE

  iSerial                 0

  bNumConfigurations      1

  Configuration Descriptor:

    bLength                 9

    bDescriptorType         2

    wTotalLength           88

    bNumInterfaces          2

    bConfigurationValue     1

    iConfiguration          0

    bmAttributes         0x80

      (Bus Powered)

    MaxPower                2mA

    Interface Association:

      bLength                 8

      bDescriptorType        11

      bFirstInterface         0

      bInterfaceCount         2

      bFunctionClass          2 Communications

      bFunctionSubClass       6 Ethernet Networking

      bFunctionProtocol       0

      iFunction               8 CDC ECM

    Interface Descriptor:

      bLength                 9

      bDescriptorType         4

      bInterfaceNumber        0

      bAlternateSetting       0

      bNumEndpoints           1

      bInterfaceClass         2 Communications

      bInterfaceSubClass      6 Ethernet Networking

      bInterfaceProtocol      0

      iInterface              5 CDC Ethernet Control Model (ECM)

      CDC Header:

        bcdCDC               1.10

      CDC Union:

        bMasterInterface        0

        bSlaveInterface         1

      CDC Ethernet:

        iMacAddress                      7 001E101F0000

        bmEthernetStatistics    0x00000000

        wMaxSegmentSize               1514

        wNumberMCFilters            0x0000

        bNumberPowerFilters              0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x83  EP 3 IN

        bmAttributes            3

          Transfer Type            Interrupt

          Synch Type               None

          Usage Type               Data

        wMaxPacketSize     0x0010  1x 16 bytes

        bInterval               5

    Interface Descriptor:

      bLength                 9

      bDescriptorType         4

      bInterfaceNumber        1

      bAlternateSetting       0

      bNumEndpoints           0

      bInterfaceClass        10 CDC Data

      bInterfaceSubClass      0 Unused

      bInterfaceProtocol      0

      iInterface              0

    Interface Descriptor:

      bLength                 9

      bDescriptorType         4

      bInterfaceNumber        1

      bAlternateSetting       1

      bNumEndpoints           2

      bInterfaceClass        10 CDC Data

      bInterfaceSubClass      0 Unused

      bInterfaceProtocol      0

      iInterface              6 CDC Ethernet Data

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x82  EP 2 IN

        bmAttributes            2

          Transfer Type            Bulk

          Synch Type               None

          Usage Type               Data

        wMaxPacketSize     0x0200  1x 512 bytes

        bInterval               0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x02  EP 2 OUT

        bmAttributes            2

          Transfer Type            Bulk

          Synch Type               None

          Usage Type               Data

        wMaxPacketSize     0x0200  1x 512 bytes

        bInterval               0


Bus 002 Device 072: ID 12d1:1f01 Huawei Technologies Co., Ltd. E353/E3131 (Mass storage mode)

Device Descriptor:

  bLength                18

  bDescriptorType         1

  bcdUSB               2.00

  bDeviceClass            0 (Defined at Interface level)

  bDeviceSubClass         0

  bDeviceProtocol         0

  bMaxPacketSize0        64

  idVendor           0x12d1 Huawei Technologies Co., Ltd.

  idProduct          0x1f01 E353/E3131 (Mass storage mode)

  bcdDevice            1.02

  iManufacturer           1 HUAWEI_MOBILE

  iProduct                2 HUAWEI_MOBILE

  iSerial                 3 0123456789ABCDEF

  bNumConfigurations      1

  Configuration Descriptor:

    bLength                 9

    bDescriptorType         2

    wTotalLength           32

    bNumInterfaces          1

    bConfigurationValue     1

    iConfiguration          0

    bmAttributes         0x80

      (Bus Powered)

    MaxPower                2mA

    Interface Descriptor:

      bLength                 9

      bDescriptorType         4

      bInterfaceNumber        0

      bAlternateSetting       0

      bNumEndpoints           2

      bInterfaceClass         8 Mass Storage

      bInterfaceSubClass      6 SCSI

      bInterfaceProtocol     80 Bulk-Only

      iInterface              4 Mass Storage

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x81  EP 1 IN

        bmAttributes            2

          Transfer Type            Bulk

          Synch Type               None

          Usage Type               Data

        wMaxPacketSize     0x0200  1x 512 bytes

        bInterval               0

      Endpoint Descriptor:

        bLength                 7

        bDescriptorType         5

        bEndpointAddress     0x01  EP 1 OUT

        bmAttributes            2

          Transfer Type            Bulk

          Synch Type               None

          Usage Type               Data

        wMaxPacketSize     0x0200  1x 512 bytes

        bInterval      

One question that remains is if I need to try to switch mode on the device for it to stop doing this. In this also previusly mentioned thread they discuss running either a command or editing a file /etc/usb-mode.json to flip this dongle to stick mode. The 8372H from what I've read does not store this setting permanently but it needs to be done every boot.

The discussed command:


usb_modeswitch -v 12d1 -p 1f01 -M 55534243123456780000000000000011063000000000010000000000000000

Although I've had to change usb_modeswitch for usbmode to make it run. It did not stop the device from behaving the way it does.

Lastly here is a list of my installed usb and kmod packages in case they can cause trouble.


root@OpenWrt:~# opkg list | grep usb

kmod-usb-core - 4.14.221-1

kmod-usb-ehci - 4.14.221-1

kmod-usb-net - 4.14.221-1

kmod-usb-net-cdc-ncm - 4.14.221-1

kmod-usb-net-huawei-cdc-ncm - 4.14.221-1

kmod-usb-net-qmi-wwan - 4.14.221-1

kmod-usb-serial - 4.14.221-1

kmod-usb-serial-option - 4.14.221-1

kmod-usb-serial-wwan - 4.14.221-1

kmod-usb-storage - 4.14.221-1

kmod-usb-uhci - 4.14.221-1

kmod-usb-wdm - 4.14.221-1

kmod-usb2 - 4.14.221-1

libusb-1.0-0 - 1.0.22-2

usb-modeswitch - 2017-12-19-f40f84c2-2

usbutils - 007-10


root@OpenWrt:~# opkg list | grep kmod

kmod-bluetooth - 4.14.221-1

kmod-btmrvl - 4.14.221-1

kmod-cfg80211 - 4.14.221+4.19.161-1-1

kmod-crypto-aead - 4.14.221-1

kmod-crypto-cmac - 4.14.221-1

kmod-crypto-ecb - 4.14.221-1

kmod-crypto-ecdh - 4.14.221-1

kmod-crypto-hash - 4.14.221-1

kmod-crypto-kpp - 4.14.221-1

kmod-crypto-manager - 4.14.221-1

kmod-crypto-null - 4.14.221-1

kmod-crypto-pcompress - 4.14.221-1

kmod-gpio-button-hotplug - 4.14.221-3

kmod-hid - 4.14.221-1

kmod-input-core - 4.14.221-1

kmod-input-evdev - 4.14.221-1

kmod-ip6tables - 4.14.221-1

kmod-ipt-conntrack - 4.14.221-1

kmod-ipt-core - 4.14.221-1

kmod-ipt-nat - 4.14.221-1

kmod-ipt-offload - 4.14.221-1

kmod-lib-crc-ccitt - 4.14.221-1

kmod-lib-crc16 - 4.14.221-1

kmod-mac80211 - 4.14.221+4.19.161-1-1

kmod-mii - 4.14.221-1

kmod-mmc - 4.14.221-1

kmod-mwifiex-sdio - 4.14.221+4.19.161-1-1

kmod-mwlwifi - 4.14.221+2019-03-02-31d93860-1

kmod-nf-conntrack - 4.14.221-1

kmod-nf-conntrack6 - 4.14.221-1

kmod-nf-flow - 4.14.221-1

kmod-nf-ipt - 4.14.221-1

kmod-nf-ipt6 - 4.14.221-1

kmod-nf-nat - 4.14.221-1

kmod-nf-reject - 4.14.221-1

kmod-nf-reject6 - 4.14.221-1

kmod-nls-base - 4.14.221-1

kmod-ppp - 4.14.221-1

kmod-pppoe - 4.14.221-1

kmod-pppox - 4.14.221-1

kmod-regmap-core - 4.14.221-1

kmod-scsi-core - 4.14.221-1

kmod-slhc - 4.14.221-1

kmod-usb-core - 4.14.221-1

kmod-usb-ehci - 4.14.221-1

kmod-usb-net - 4.14.221-1

kmod-usb-net-cdc-ncm - 4.14.221-1

kmod-usb-net-huawei-cdc-ncm - 4.14.221-1

kmod-usb-net-qmi-wwan - 4.14.221-1

kmod-usb-serial - 4.14.221-1

kmod-usb-serial-option - 4.14.221-1

kmod-usb-serial-wwan - 4.14.221-1

kmod-usb-storage - 4.14.221-1

kmod-usb-uhci - 4.14.221-1

kmod-usb-wdm - 4.14.221-1

kmod-usb2 - 4.14.221-1


root@OpenWrt:~# opkg list | grep luci-proto

luci-proto-3g - git-21.189.23240-7b931da-1

luci-proto-ipv6 - git-21.044.30835-34e0d65-1

luci-proto-ncm - git-21.189.23240-7b931da-1

luci-proto-ppp - git-21.044.30835-34e0d65-1

luci-proto-qmi - git-21.189.23240-7b931da-1

EDIT
I just ran into this thread from 13d ago. The router in question is running pfSense but it is the exact same Huawei E8372H-320 dongle and issue. No solution found in that thread so far.

I've got some progress! Installed the package kmod-usb-net-rndis and the dongle/modem stopped switching between modes. The device then stayed as 12d1:14db or CDC Ethernet Control Model (ECM). I got an ip via DHCP on my router and everything.
Then I also managed to fix the dongle into NCM mode (showing up as 12d1:155e) which is what I want. This by editing /etc/usb-mode.json by adding the msg 55534243123456780000000000000011063000000000010000000000000000 to the "messages" list and changing the proper section with Alt mode and the correct msg index as follows:

		"12d1:1f01": {
			"*": {
				"t_vendor": 4817,
				"t_product": [
					5339,
					5340,
					5470
				],
				"mode": "HuaweiAlt",
				"msg": [
					59
				]
			}
		},

Further problems or questions now are:

  • Even though the dongle/modem is in the right mode the WiFi is still active and working for other devices (using NAT) which seems odd in my opinion. These modes should be mutually exclusive?
  • I do not get any ip address on my newly added interface but keep getting errors Connection attempt failed. This is in my /etc/config/network
config interface 'LTE'
        option ifname 'wwan0'
        option proto 'ncm'
        option ipv6 'auto'
        option pdptype 'IP'
        option service 'preferlte'
        option metric '100'
        option device '/dev/ttyUSB1'
        option apn '4g.tele2.se'

I am not sure how to debug this further.

I don't know this modem, but I believe it's possible/likely that the firmware doesn't allow you to disable its routing mode. Which means that the firmware keeps control of the modem functions and will not allow access to any modem management at all. You'll just get different types of ethernet emulation over the USB connection, but the functionality will be identical to what you get over Wifi. I.e, NATed addresses allocated by DHCP and a web GUI as the only form of management.

If you have an NCM interface without any cdc-wdmX device, then you're using the standard class driver cdc_ncm. You cannot configure this as a modem with APN etc. It's an ethernet interface, and the APN etc is configured in the modem web GUI as before.

Your hunch might just be right. But to understand what you are saying about the driver. Is it the modem itself which defines which driver is used (e.g. cdc_ncm)?
I tried setting it up as a DHCP client instead. I am not getting any ip and the MAC address looks a little simple perhaps 00:1E:10:1F:00:00. It would still feel strange if I was able to get an external ip here as the modem has taken one already (still running NAT and WiFi...).
Might this mean that the modem will not work in NCM mode at all? I might have better luck with the "poor mans solution" using DMZ etc I saw posted here somewhere.

Yes, basically. USB drivers match device functions based on the class/subclass/protocol triplet. You can see these in the verbose lsusb output or in /sys/kernel/debug/usb/devices. NCM is a subclass of the USB CDC (communication devices). Its control function uses the codes 02/0D/00, and this is what the driver matches on.

Vendor specific functions (all those with class code FF) complicates this a bit, since you have to take the vendor and device ids into account too. Huawei have defined their own scheme where they use the subclass and protocol to match different functions independent of the specific device-id. This is how we know the huawei_cdc_ncm driver is the right one. It's mactching vendor-id Huawei (12D1) and FF/02/16 and a few more other variants.

Thanks for your input, I'm learning a lot. I'm still confused though as the ncm wiki seems very similar to my case. In their example they get the following device with a drivers name containing also cdc_ncm. Although they configure the modem as a NCM device with APN settings.

I:  If#= 2 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=03 Prot=16 Driver=huawei_cdc_ncm

Here is partial output from my /sys/kernel/debug/usb/devices which has the cdc_ncm driver and not the huwaie_cdc_ncm driver.

T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 10 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=02(comm.) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=12d1 ProdID=155e Rev= 1.02
S:  Manufacturer=HUAWEI_MOBILE
S:  Product=HUAWEI_MOBILE
C:* #Ifs= 5 Cfg#= 1 Atr=80 MxPwr=  2mA
A:  FirstIf#= 3 IfCount= 2 Cls=02(comm.) Sub=0d Prot=00
I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=02 Prot=01 Driver=option
E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=02 Prot=03 Driver=option
E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=02 Prot=02 Driver=option
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0d Prot=00 Driver=cdc_ncm
E:  Ad=87(I) Atr=03(Int.) MxPS=  16 Ivl=2ms
I:  If#= 4 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=01 Driver=cdc_ncm
I:* If#= 4 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=01 Driver=cdc_ncm
E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

In your opinion with my driver, is this a correct configuration? Unfortunatelly not working as stated before unless I did something wrong. But I'm now thinking the modem does not really support this mode. I've read mentions of AT commands after switching modes. Could there be a solution there you think? Then it may be worth taking further look at.

config interface 'LTE'
        option ifname 'wwan0'
        option proto 'dhcp'
        option metric '100'

All I can say is that it looks promising. You even got serial functions which might be used to manage the modem. Limited to whatever the firmware allows, of course. But the fact that they're there is a good sign.

You'll just have to keep experimenting to figure out what works or not, unfortunately. You are using parts of the modem firmware which probably never was tested, and which no one else is using. If it works, then great. If not, then you'll just have to try something else.

I think I'm in over my head with these commands so I thought I'd give the DMZ, or even just port forwarding with double NAT a try as an alternative to running this device in stick mode. Unfortunatelly I am getting a lot of kevent 12 events, which I guess is the driver crashing. So it would seem that I'm running out of luck with this modem. The last idea I had was to use my router (WRT3200ACM) to connect to the sticks WiFi as a client instead of using USB. This is of course a real bad outcome but the only one I am getting to work ATM.