OpenWrt Forum Archive

Topic: Huawei 3G modem problem

The content of this topic has been archived on 30 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello!
I'm trying to attach 3g modem to the TP-Link MR3040v1 router. The modem is branded Huawei 420D. It has VID:PID 12d1:155b for storage and 12d1:1506 for modem.

These are packages installed:

base-files - 117-r36088
busybox - 1.19.4-6
dnsmasq - 2.62-2
dropbear - 2011.54-2
firewall - 2-55.1
hotplug2 - 1.0-beta-4
iptables - 1.4.10-4
iw - 3.6-1
jshn - 2013-01-29-0bc317aa4d9af44806c28ca286d79a8b5a92b2b8
kernel - 3.3.8-1-d6597ebf6203328d3519ea3c3371a493
kmod-ath - 3.3.8+2012-09-07-3
kmod-ath9k - 3.3.8+2012-09-07-3
kmod-ath9k-common - 3.3.8+2012-09-07-3
kmod-cfg80211 - 3.3.8+2012-09-07-3
kmod-crypto-aes - 3.3.8-1
kmod-crypto-arc4 - 3.3.8-1
kmod-crypto-core - 3.3.8-1
kmod-gpio-button-hotplug - 3.3.8-1
kmod-ipt-conntrack - 3.3.8-1
kmod-ipt-core - 3.3.8-1
kmod-ipt-nat - 3.3.8-1
kmod-ipt-nathelper - 3.3.8-1
kmod-leds-gpio - 3.3.8-1
kmod-ledtrig-default-on - 3.3.8-1
kmod-ledtrig-netdev - 3.3.8-1
kmod-ledtrig-timer - 3.3.8-1
kmod-ledtrig-usbdev - 3.3.8-1
kmod-lib-crc-ccitt - 3.3.8-1
kmod-mac80211 - 3.3.8+2012-09-07-3
kmod-nls-base - 3.3.8-1
kmod-ppp - 3.3.8-1
kmod-pppoe - 3.3.8-1
kmod-pppox - 3.3.8-1
kmod-scsi-core - 3.3.8-1
kmod-usb-acm - 3.3.8-1
kmod-usb-core - 3.3.8-1
kmod-usb-ohci - 3.3.8-1
kmod-usb-serial - 3.3.8-1
kmod-usb-serial-option - 3.3.8-1
kmod-usb-serial-wwan - 3.3.8-1
kmod-usb-storage - 3.3.8-1
kmod-usb-uhci - 3.3.8-1
kmod-usb2 - 3.3.8-1
kmod-wdt-ath79 - 3.3.8-1
libblobmsg-json - 2013-01-29-0bc317aa4d9af44806c28ca286d79a8b5a92b2b8
libc - 0.9.33.2-1
libgcc - 4.6-linaro-1
libip4tc - 1.4.10-4
libiwinfo - 36
libiwinfo-lua - 36
libjson - 0.9-2
liblua - 5.1.4-8
libnl-tiny - 0.1-3
libpthread - 0.9.33.2-1
librt - 0.9.33.2-1
libubox - 2013-01-29-0bc317aa4d9af44806c28ca286d79a8b5a92b2b8
libubus - 2013-01-13-bf566871bd6a633e4504c60c6fc55b2a97305a50
libubus-lua - 2013-01-13-bf566871bd6a633e4504c60c6fc55b2a97305a50
libuci - 2013-01-04.1-1
libuci-lua - 2013-01-04.1-1
libusb - 0.1.12-3
libusb-1.0 - 1.0.9-1
libxtables - 1.4.10-4
lua - 5.1.4-8
luci - 0.11.1-1
luci-app-firewall - 0.11.1-1
luci-i18n-english - 0.11.1-1
luci-lib-core - 0.11.1-1
luci-lib-ipkg - 0.11.1-1
luci-lib-nixio - 0.11.1-1
luci-lib-sys - 0.11.1-1
luci-lib-web - 0.11.1-1
luci-mod-admin-core - 0.11.1-1
luci-mod-admin-full - 0.11.1-1
luci-proto-core - 0.11.1-1
luci-proto-ppp - 0.11.1-1
luci-sgi-cgi - 0.11.1-1
luci-theme-base - 0.11.1-1
luci-theme-openwrt - 0.11.1-1
mtd - 18.1
netifd - 2013-01-29.2-4bb99d4eb462776336928392010b372236ac3c93
opkg - 618-3
ppp - 2.4.5-8
ppp-mod-pppoe - 2.4.5-8
swconfig - 10
uboot-envtools - 2012.04.01-1
ubus - 2013-01-13-bf566871bd6a633e4504c60c6fc55b2a97305a50
ubusd - 2013-01-13-bf566871bd6a633e4504c60c6fc55b2a97305a50
uci - 2013-01-04.1-1
uhttpd - 2012-10-30-e57bf6d8bfa465a50eea2c30269acdfe751a46fd
usb-modeswitch - 1.2.3-2
usbutils - 005-1
wpad-mini - 20120910-1
zlib - 1.2.7-1

dmesg:

usb 1-1: USB disconnect, device number 2
usb 1-1: new high-speed USB device number 3 using ehci-platform
scsi2 : usb-storage 1-1:1.0
scsi3 : usb-storage 1-1:1.1
scsi 2:0:0:0: CD-ROM                     Mass Storage     2.31 PQ                                   : 0 ANSI: 2
scsi 3:0:0:0: Direct-Access              SD Storage       2.31 PQ                                   : 0 ANSI: 2
sd 3:0:0:0: [sda] Attached SCSI removable disk

lsusb:

Bus 001 Device 003: ID 12d1:155b Huawei Technologies Co., Ltd.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

usb_modeswitch:

usb_modeswitch -v 12d1 -p 155b -P 1506 -V 12d1 -M "55534243123456780000000000000011062000000100000000000000000000"
Looking for target devices ...
 No devices in target mode or class found
Looking for default devices ...
   found matching product ID
   adding device
 Found device in default mode, class or configuration (1)
Accessing device 003 on bus 001 ...
Getting the current device configuration ...
 OK, got current device configuration (1)
Using first interface: 0x00
Using endpoints 0x01 (out) and 0x81 (in)
Inquiring device details; driver will be detached ...
Looking for active driver ...
 OK, driver found ("usb-storage")
 OK, driver "usb-storage" detached

SCSI inquiry data (for identification)
-------------------------
  Vendor String:
   Model String: Mass Storage
Revision String: 2.31
-------------------------

USB description data (for identification)
-------------------------
Manufacturer:
     Product: Mobile Connect
  Serial No.: not provided
-------------------------
Setting up communication with interface 0
Using endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
 OK, message successfully sent
Resetting response endpoint 0x81
 Could not reset endpoint (probably harmless): -19
Resetting message endpoint 0x01
 Could not reset endpoint (probably harmless): -19
 Device is gone, skipping any further commands
-> Run lsusb to note any changes. Bye.

lsusb again:

Bus 001 Device 004: ID 12d1:1506 Huawei Technologies Co., Ltd. E398 LTE/UMTS/GSM Modem/Networkcard
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

dmesg:

usb 1-1: usbfs: process 1144 (usb_modeswitch) did not claim interface 0 before use
usb 1-1: USB disconnect, device number 3
usb 1-1: new high-speed USB device number 4 using ehci-platform
scsi4 : usb-storage 1-1:1.4
scsi5 : usb-storage 1-1:1.5
scsi 4:0:0:0: CD-ROM                     Mass Storage     2.31 PQ: 0 ANSI: 2
scsi 5:0:0:0: Direct-Access              SD Storage       2.31 PQ: 0 ANSI: 2
sd 5:0:0:0: [sda] Attached SCSI removable disk

It doesn't get usb interface.
In the "Use 3g/UMTS USB Dongle for WAN connection" recipe it was written to execute "rmmod usbserial"

root@OpenWrt:~# rmmod usbserial
rmmod: can't unload 'usbserial': Resource temporarily unavailable

Is there anything else I can try to connect it?
Thanks a lot!

IgorS wrote:

It doesn't get usb interface.

I suppose you mean ttyUSB interfaces, maybe it shouldn't get any.
What does lsusb -v -d 12d1:1506 say?

root@OpenWrt:~# lsusb -v -d 12d1:1506

Bus 001 Device 003: ID 12d1:1506 Huawei Technologies Co., Ltd. E398 LTE/UMTS/GSM                                                                                         Modem/Networkcard
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          0x1506 E398 LTE/UMTS/GSM Modem/Networkcard
  bcdDevice            1.02
  iManufacturer           3
  iProduct                2 Mobile Connect
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          206
    bNumInterfaces          6
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      2
      bInterfaceProtocol     97
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
      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              32
      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              32
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      2
      bInterfaceProtocol    118
      iInterface              0
      ** UNRECOGNIZED:  05 24 00 10 01
      ** UNRECOGNIZED:  06 24 1a 00 01 1f
      ** UNRECOGNIZED:  0d 24 0f 01 05 00 00 00 ea 05 03 00 01
      ** UNRECOGNIZED:  05 24 06 01 01
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           3
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      2
      bInterfaceProtocol    118
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
      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              32
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      2
      bInterfaceProtocol     99
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x85  EP 5 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      2
      bInterfaceProtocol     98
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x86  EP 6 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        4
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x05  EP 5 OUT
        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     0x87  EP 7 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        5
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x06  EP 6 OUT
        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     0x88  EP 8 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0000
  (Bus Powered)

What interface could be used instead? I'm not good this subject, sorry if my questons are a bit stupid :-)

The interfaces are according to your lsusb listing:

If #0 serial ppp modem
If #1 composite ncm
If #2 serial diagnostics
If #3 serial cmd interface

The serial interfaces should be driven by the usb_wwan.ko and option.ko drivers
which you have to install from a kmod-package and load with modprobe.
That will create 3 ttyUSBx devices where ttyUSB0 is the modem device.

I assume that the 420D is a MiFi device, ie has a built in wifi hotspot, since there is
an ncm interface which with the usbnet.ko and cdc_ncm.ko drivers will create a wwan0 ethernet device. There is probably a built in web server in the 420D which you can access with a browser and configure the wifi hotspot.

Start with the serial drivers and see if you can get an old-fashion ppp connection on ttyUSB0.

I have both usb_wwan.ko and option.ko in modules folder.

root@OpenWrt:~# ls /lib/modules/3.3.8
aes_generic.ko          iptable_raw.ko          pppox.ko
arc4.ko                 leds-gpio.ko            scsi_mod.ko
ath.ko                  ledtrig-default-on.ko   sd_mod.ko
ath79_wdt.ko            ledtrig-netdev.ko       slhc.ko
ath9k.ko                ledtrig-timer.ko        uhci-hcd.ko
ath9k_common.ko         ledtrig-usbdev.ko       usb-common.ko
ath9k_hw.ko             mac80211.ko             usb-storage.ko
cdc-acm.ko              nf_conntrack.ko         usb_wwan.ko
cfg80211.ko             nf_conntrack_ftp.ko     usbcore.ko
compat.ko               nf_conntrack_ipv4.ko    usbserial.ko
crc-ccitt.ko            nf_conntrack_irc.ko     x_tables.ko
crypto_algapi.ko        nf_defrag_ipv4.ko       xt_CT.ko
ehci-hcd.ko             nf_nat.ko               xt_NOTRACK.ko
gpio-button-hotplug.ko  nf_nat_ftp.ko           xt_TCPMSS.ko
ip_tables.ko            nf_nat_irc.ko           xt_comment.ko
ipt_LOG.ko              nls_base.ko             xt_conntrack.ko
ipt_MASQUERADE.ko       ohci-hcd.ko             xt_limit.ko
ipt_REJECT.ko           option.ko               xt_mac.ko
iptable_filter.ko       ppp_async.ko            xt_multiport.ko
iptable_mangle.ko       ppp_generic.ko          xt_state.ko
iptable_nat.ko          pppoe.ko                xt_tcpudp.ko

kmod-usb-serial-option and kmod-usb-serial-wwan are installed in web-interface of router. Do they need any extra configuration? 3g modem looks like a usual usb-stick-dongle. It looks very similar to Huawei E3131 or E3121.

IgorS wrote:

root@OpenWrt:~# ls /lib/modules/3.3.8
.

Linux 3.3 is dead, upgrade!
The option driver you have does not include support for the 420D interfaces and that is the reason why you don't get any /dev/ttyUSBx devices.

Regarding cdc_ncm, it is a driver for devices with multiple functions like mobile phones or MiFi devices to name a few.
There are Huawei MiFi hotspots in the form of a USB dongle and there are others which are cigarette pack sized having external power adapter and a usb cable.
I suspect, since Huawei included an ncm interface, that your 420D have additional functions and a built in webserver to configure them but it is possible that they only
use the ncm interface for faster direct ethernet communication in 4G nets.
The serial ppp modem has speed limitations, especially in routers where the usb port is much slower than on a desktop computer.

I've installed cdc_ether driver, nothing changed. So I should try to build usb_wwan.ko and option.ko from new sources and replace the ones provided with the openwrt build?

IgorS wrote:

I've installed cdc_ether driver, nothing changed. So I should try to build usb_wwan.ko and option.ko from new sources and replace the ones provided with the openwrt build?

usb_wwan is dependent on usbserial so you may have to build that one as well.
These drivers are quite simple so I guess you can compile them from later sources without any problem.
cdc_ether will not work on the ncm interface, it has to be cdc_ncm and it has to be a
cdc_ncm driver from a later kernel. The 3.3 kernel cdc_ncm driver will not work with your dongle.

As I said, Linux 3.3 is dead, is no longer supported, doesn't get any updates, so the best for you is to install a later OpenWRT build for your router.

Firmware from http://ofmodemsandmen.com/ project works with my modem and I've also got help from TP-Link support, so it works now even on stock firmware. Thanks a lot for your help!

The discussion might have continued from here.