4

I have been trying to get 4G LTE functionality using the Huawei E3372 USB Modem. I followed this tutorial, but the device id didn't change after the reboot. What might be the problem? It worked fine on an windows PC. Any solutions?

lsusb

pi@raspberrypi:~ $ lsusb
Bus 001 Device 005: ID 1a2c:2c27 China Resource Semico Co., Ltd
Bus 001 Device 006: ID 12d1:157c Huawei Technologies Co., Ltd.
Bus 001 Device 004: ID 10c4:8103 Cygnal Integrated Products, Inc.
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

ifconfig

pi@raspberrypi:~ $ ifconfig
docker0   Link encap:Ethernet  HWaddr 02:42:f2:60:fb:47
          inet addr:172.17.0.1  Bcast:172.17.255.255  Mask:255.255.0.0
          inet6 addr: fe80::ea19:3bdb:6334:6754/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth0      Link encap:Ethernet  HWaddr b8:27:eb:98:5e:b7
          inet6 addr: fe80::88f8:da84:cb7e:3804/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:352 errors:0 dropped:0 overruns:0 frame:0
          TX packets:352 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:34045 (33.2 KiB)  TX bytes:34045 (33.2 KiB)

wlan0     Link encap:Ethernet  HWaddr b8:27:eb:cd:0b:e2
          inet addr:192.168.1.3  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::b957:488b:72c8:6546/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:309 errors:0 dropped:0 overruns:0 frame:0
          TX packets:431 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:21675 (21.1 KiB)  TX bytes:48330 (47.1 KiB)

wwan0     Link encap:Ethernet  HWaddr 46:b7:f0:cb:22:c2
          inet6 addr: fe80::d47d:591e:63c:8136/64 Scope:Link
          UP BROADCAST RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:31 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:8057 (7.8 KiB)

lsusb -vv -d 12d1:157c

> pi@raspberrypi:~ $ lsusb -vv -d 12d1:157c
> 
> Bus 001 Device 007: ID 12d1:157c Huawei Technologies Co., Ltd.
> Couldn't open device, some information will be missing Device
> Descriptor:   bLength                18   bDescriptorType         1  
> bcdUSB               2.10   bDeviceClass            0 (Defined at
> Interface level)   bDeviceSubClass         0   bDeviceProtocol      
> 255   bMaxPacketSize0        64   idVendor           0x12d1 Huawei
> Technologies Co., Ltd.   idProduct          0x157c   bcdDevice        
> 1.02   iManufacturer           1   iProduct                2   iSerial                 3   bNumConfigurations      2   Configuration Descriptor:
>     bLength                 9
>     bDescriptorType         2
>     wTotalLength           32
>     bNumInterfaces          1
>     bConfigurationValue     1
>     iConfiguration          0
>     bmAttributes         0xa0
>       (Bus Powered)
>       Remote Wakeup
>     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
>       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               1   Configuration Descriptor:
>     bLength                 9
>     bDescriptorType         2
>     wTotalLength          118
>     bNumInterfaces          3
>     bConfigurationValue     2
>     iConfiguration          0
>     bmAttributes         0xa0
>       (Bus Powered)
>       Remote Wakeup
>     MaxPower                2mA
>     Interface Association:
>       bLength                 8
>       bDescriptorType        11
>       bFirstInterface         0
>       bInterfaceCount         2
>       bFunctionClass          2 Communications
>       bFunctionSubClass      14
>       bFunctionProtocol       0
>       iFunction               8
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        0
>       bAlternateSetting       0
>       bNumEndpoints           1
>       bInterfaceClass         2 Communications
>       bInterfaceSubClass     14
>       bInterfaceProtocol      0
>       iInterface              5
>       CDC Header:
>         bcdCDC               1.10
>       CDC MBIM:
>         bcdMBIMVersion       1.00
>         wMaxControlMessage   1024
>         bNumberFilters       32
>         bMaxFilterSize       128
>         wMaxSegmentSize      1500
>         bmNetworkCapabilities 0x20
>           8-byte ntb input size
>       UNRECOGNIZED CDC:  08 24 1c 00 01 10 dc 05
>       CDC Union:
>         bMasterInterface        0
>         bSlaveInterface         1
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x82  EP 2 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      2
>       iInterface              6
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        1
>       bAlternateSetting       1
>       bNumEndpoints           2
>       bInterfaceClass        10 CDC Data
>       bInterfaceSubClass      0 Unused
>       bInterfaceProtocol      2
>       iInterface              6
>       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               0
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        2
>       bAlternateSetting       0
>       bNumEndpoints           2
>       bInterfaceClass         8 Mass Storage
>       bInterfaceSubClass      6 SCSI
>       bInterfaceProtocol     80 Bulk-Only
>       iInterface              4
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x83  EP 3 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               1

This what i get for sudo ip link set wwan up sudo dhclient -v wwan

pi@raspberrypi:~ $ sudo ip link set wwan0 up
pi@raspberrypi:~ $ sudo dhclient -v wwan0
Internet Systems Consortium DHCP Client 4.3.1
Copyright 2004-2014 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wwan0/f6:48:0b:c6:9f:a6
Sending on   LPF/wwan0/f6:48:0b:c6:9f:a6
Sending on   Socket/fallback
DHCPDISCOVER on wwan0 to 255.255.255.255 port 67 interval 4
DHCPDISCOVER on wwan0 to 255.255.255.255 port 67 interval 5
DHCPDISCOVER on wwan0 to 255.255.255.255 port 67 interval 9
DHCPDISCOVER on wwan0 to 255.255.255.255 port 67 interval 19
DHCPDISCOVER on wwan0 to 255.255.255.255 port 67 interval 18
DHCPDISCOVER on wwan0 to 255.255.255.255 port 67 interval 5
No DHCPOFFERS received.
No working leases in persistent database - sleeping.

when I run:

 sudo qmi-network /dev/cdc-wdm0 start 

I get:

root@raspberrypi:/home/pi# sudo qmi-network /dev/cdc-wdm0 start 
Loading profile... APN: airtelgprs.com 
Starting network with: 
qmicli -d /dev/cdc-wdm0 --wds-start-network=airtelgprs.com --client-no-release-cid
... error: couldn't create client for the 'wds' service: 
CID allocation failed in the CTL client: Transaction timed out error: 
network start failed, client not allocated
  • Could you add the exact sub-type of the Huawei E3372 you have, as seen on the label? E3372s-*, E3372h-* etc.. (* is for different numbers indicating frequency band compatibility, should not matter here; but s is the older and h the newer version). – tanius Mar 18 '18 at 16:14
4

I have the same setup (Raspberry Pi 3, operating system from 2017-11-29-raspbian-stretch-lite.img, USB mobile broadband modem Huawei E3372h-153). The modem shows up in lsusb a bit differently than yours though:

Bus 001 Device 005: ID 12d1:15b7 Huawei Technologies Co., Ltd.

So maybe, as mentioned here, I have a different variant of the device. The instructions below that worked for me may still work for you.

1. Transform the modem to stick mode

The Huawei E3372h-153, without any change in model number or exterior appearance, comes in two versions: "HiLink mode" where it is configured with a web interface and works like a router accessed by IP address, and "Stick mode", where it acts as a regular mobile broadband modem.

For /dev/ttyUSB… to exist and wvdial etc. to work, the modem has to be in stick mode. The fact that no /dev/ttyUSB0 and /dev/ttySUB1 (modem interfaces) are created on your system seems to indicate your device is in HiLink mode. The presence of wwan0 in ifconfig output could be an indicator for that as well – it does not appear there on my setup. However, other sources suggest that the device in HiLink mode would rather be eth1.

If you can access the web UI configuration interface at http://192.168.8.1/ when using the device under Windows, it also proves the device is in HiLink mode. This interface should also be accessible under Linux (worked for me with another Huawei HiLink modem), but only after your wwan0 is configured with a suitable IP address to access this subnet.

Changing it from HiLink to stick mode is possible by exchanging the firmware, but it's a somewhat difficult procedure. I did not try it myself yet, but the best set of instructions seem to be these.

2. Connect with it in stick mode

  1. Make sure your user is in group dialout (or it won't be able to access /dev/ttyUSB…): groups. If not, add it: sudo adduser <username> dialout and re-login.

  2. Install wvdial: sudo apt install wvdial.

  3. Create a wvdial configuration file in /etc/wvdial.conf. Mine is shown below. Use /dev/ttyUSB1 instead of /dev/ttyUSB0 to access the modem (reason). After hotplugging, the devices may be switched (not sure yet), but when booting with the modem plugged in, the right device was so far always /dev/ttyUSB1 for me.

  4. Execute wvdial to create a connection:

    sudo wvdial & disown
    

    The & disown allows you to close the terminal window / SSH connection while keeping the Internet connection up.

  5. Confirm you have an Internet connection: the wvdial output should show that a remote IP was assigned to the connection, and ifconfig should show you proper values for inet, netmask and destination for the ppp0 device. If so, a ping should work, for example on the omnipresent Google nameserver: ping 8.8.8.8.

  6. To close the Internet connection, we have to kill the process since it's not interactively controlled by the terminal the way we started it: sudo killall wvdial

My /etc/wvdial.conf looks like this (with most identical to here):

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0
Init3 = AT+CGDCONT=1,"IP","apn.example.com" ;Use your APN name, which may be empty.
;Init3 = AT^NDISDUP=1,1,"apn.example.com"   ;Alternative, may also work.
Modem Type = Analog Modem
Baud = 9600
New PPPD = yes
Modem = /dev/ttyUSB1
ISDN = 0
Phone = *99#
Password = ;Use your APN settings password, if any.
Username = ;Use your APN settings username, if any.
Stupid Mode = 1
Dialer Attemps = 2
Carrier Check = off
  • I would be grateful if this works. I just want to know if you have used any externally powered usb for the dongle? some people in other forums were saying they got this to work after powering the dongle externally. Is this the same case for you? – shyam Mar 17 '18 at 17:10
  • Cannot open /dev/ttyUSB1: No such file or directory . This is what I get :( – shyam Mar 17 '18 at 18:15
  • I plug the dongle directly into the RPi, and the RPi has a 5 V 2.5 A power supply connected to it. Your issue might be the HiLink / stick mode issue, I added instructions to the post. – tanius Mar 18 '18 at 16:10
  • AT+CGDCONT=1 made it for me – eftshift0 May 23 '18 at 16:21
3

I suspect that tutorial is relying on this (from man usb_modeswitch):

Usually, the program is distributed with a set of configurations for many known devices, which in combination with a wrapper script launched from the udev daemon allows a fully automatic handling of a device upon insertion.

Which is why all you do is install the package and reboot; the included udev script should then perform the switch for you.

It may be doing it anyway; this thread from the usb_modeswitch forum implies some work was put in for the "Huawei E3372" several years ago, and the man page notes that "Some devices keep their original vendor/product ID after successful switching...". Unfortunately, it's also implied there are several variants on this device and the IDs there do not exactly match yours.

The lengthy output in that thread is from lsusb -vv. This is so long that it is tedious to do on all devices, so you will want to use:

lsusb -vv -s 1:6

or:

lsusb -vv -d 12d1:157c

To get just the modem. That's based on the bus and ID specs from your question. You could compare that to the output in the thread, which includes more than one variant. The last one is "not what this thread is about", lol, but on the bright side, the person in the know there mentions that that device probably has a generic driver which already works.

Check lsmod | grep cdc_mbim. If nothing shows, try sudo modprobe cdc_mbim and check again. If that shows, it is probably a good sign.

I would try moving on to see if the modem already works. Also, edit the lsusb -vv output into your question.

You should also have a look at the usage instructions from the developer of usb modeswitch (part of the same site as that forum).


Since the interface seems to be listed, you could try:

sudo ip link set wwan up
sudo dhclient -v wwan

Presuming you have a valid SIM this may work -- I haven't used a cellular modem dongle, so I don't know if there is more to it. I have used a cell modem via UART, and that was a matter of a few simple AT commands. I would presume the dongle is smart enough to deal with that automatically, since the driver presents it as a normal network interface and not a low level device.

  • Edited with lsusb -vv -d 12d1:157c. This is what i get for lsmod | grep cdc_mbim: pi@raspberrypi:~ $ lsmod | grep cdc_mbim cdc_mbim 5931 0 cdc_wdm 12090 1 cdc_mbim cdc_ncm 19717 1 cdc_mbim – shyam Feb 15 '18 at 16:11
  • sudo modprobe cdc_mbim shows nothing. BTW ifconfig shows a wwan0 interface , is this a good sign? – shyam Feb 15 '18 at 16:15
  • There's no point in doing the modprobe if lsmod shows the module is already loaded (which is why I wrote "if nothing shows..."). You should at least glance at manual pages for commands you are using (man lsmod, etc). I would guess that wwan0 is listed is a good sign, did not consider that before! In which case the use of the kernel driver (cdc_mbim) is probably the answer here (usb_modeswitch isn't doing anything because it doesn't have to). – goldilocks Feb 15 '18 at 16:49
  • But I can't open /dev/gsmmodem or /dev/ttyUSB0 :-( (using wvdial) . Should I go ahead and use these commands directly: echo -e "AT^NDISDUP=1,1,\"internet\"\r" > /dev/ttyUSB0 and dhclient wwan0 (to get the IP address for wwan0 interface) . – shyam Feb 16 '18 at 2:53
  • I've added a bit at the end about that. I think the reason it isn't in /dev is because of what I wrote in the last sentence (notice that your other network devices, although they are physical peripherals, do not have device nodes either). – goldilocks Feb 16 '18 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.