Ubuntu – Configuring Huawei E3276 modem

modemnetworkingusb-modemusb-modeswitchwvdial

I'm having trouble with my mobile broadband modem (Huawei E3276) on Ubuntu 14.04.

lsusb output:

Bus 002 Device 024: ID 12d1:1506 Huawei Technologies Co., Ltd. E398 LTE/UMTS/GSM Modem/Networkcard

When I plugged the modem in, the following appeared in /var/log/usb_modeswitch.log:

USB_ModeSwitch log from Fri Dec  5 22:52:36 2014

Use global config file: /etc/usb_modeswitch.conf


Started via upstart
Raw args from udev: /2-2

Bus ID for device not given by udev.
 Trying to determine it from kernel name (2-2) ...
Use top device dir /sys/bus/usb/devices/2-2

USB dir exists: /sys/bus/usb/devices/2-2
Warning: USB attribute "serial" not readable.

SCSI dir exists: /sys/bus/usb/devices/2-2
Warning: SCSI attribute "vendor" not readable.
Warning: SCSI attribute "model" not readable.
Warning: SCSI attribute "rev" not readable.
Use interface /sys/bus/usb/devices/2-2/2-2:1.0
----------------
USB values from sysfs:
  idVendor  12d1
  idProduct 14fe
  manufacturer  HUAWEI Technology
  product   HUAWEI Mobile
  serial    (null)
  bNumConfigurations    1
----------------
bNumConfigurations is 1 - don't check for active configuration
Found packed config collection /usr/share/usb_modeswitch/configPack.tar.gz
Searching entries named: /usr/share/usb_modeswitch/12d1:14fe*
Searching overriding entries named: /etc/usb_modeswitch.d/12d1:14fe*
SCSI attributes not needed, move on.

Extract config 12d1:14fe from collection /usr/share/usb_modeswitch/configPack.tar.gz
config: TargetVendor set to 12d1
config: TargetProduct set to 1506,150f,151d
Driver module is "option", ID path is /sys/bus/usb-serial/drivers/option1
! matched, now switching
Command to be run:
/usr/sbin/usb_modeswitch -W -D -s 20 -c /run/usb_modeswitch/current_cfg -u -1   -v 12d1 -p 14fe 2>&1

Verbose debug output of usb_modeswitch and libusb follows
(Note that some USB errors are expected in the process)
--------------------------------

Read config file: /run/usb_modeswitch/current_cfg

 * usb_modeswitch: handle USB devices with multiple modes
 * Version 2.1.1 (C) Josua Dietze 2014
 * Based on libusb1/libusbx

 ! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor=  0x12d1
DefaultProduct= 0x14fe
TargetVendor=   0x12d1
TargetProductList="1506,150f,151d"
MessageContent="55534243123456780000000000000011062000000101000100000000000000"
NeedResponse=0
Success check enabled, max. wait time 20 seconds
System integration mode enabled

Look for target devices ...
  found USB ID 12d1:14fe
   vendor ID matched
  found USB ID 1d6b:0002
  found USB ID 1d6b:0001
  found USB ID 046d:c05f
  found USB ID 1d6b:0001
  found USB ID 1d6b:0001
  found USB ID 1d6b:0002
  found USB ID 1d6b:0001
  found USB ID 1d6b:0001
  found USB ID 1d6b:0001
 No devices in target mode or class found
Look for default devices ...
  found USB ID 12d1:14fe
   vendor ID matched
   product ID matched
  found USB ID 1d6b:0002
  found USB ID 1d6b:0001
  found USB ID 046d:c05f
  found USB ID 1d6b:0001
  found USB ID 1d6b:0001
  found USB ID 1d6b:0002
  found USB ID 1d6b:0001
  found USB ID 1d6b:0001
  found USB ID 1d6b:0001
 Found devices in default mode (1)
Access device 027 on bus 002
Use interface number 0
Use endpoints 0x01 (out) and 0x81 (in)

USB description data (for identification)
-------------------------
Manufacturer: HUAWEI Technology
     Product: HUAWEI Mobile
  Serial No.: not provided
-------------------------
Looking for active driver ...
 OK, driver detached
Set up interface 0
Use endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
 OK, message successfully sent
Reset response endpoint 0x81
 Could not reset endpoint (probably harmless): -99
Reset message endpoint 0x01
 Could not reset endpoint (probably harmless): -4
 Device is gone, skip any further commands

Check for mode switch (max. 20 times, once per second) ...
 Search for target devices ...
  found USB ID 12d1:1506
   vendor ID matched
   product ID matched
  found USB ID 1d6b:0002
  found USB ID 1d6b:0001
  found USB ID 046d:c05f
  found USB ID 1d6b:0001
  found USB ID 1d6b:0001
  found USB ID 1d6b:0002
  found USB ID 1d6b:0001
  found USB ID 1d6b:0001
  found USB ID 1d6b:0001

Found target device, open it

Found target device 028 on bus 002

Target device description data
-------------------------
Manufacturer: HUAWEI Technology
     Product: HUAWEI Mobile
  Serial No.: not provided
-------------------------
 Found correct target device

Mode switch succeeded. Bye!

ok:no_data
--------------------------------
(end of usb_modeswitch output)
Check success of mode switch for max. 20 seconds ... Read attributes ...
USB dir exists: /sys/bus/usb/devices/2-2
Warning: USB attribute "serial" not readable.
 All attributes matched
Mode switching was successful, found 12d1:1506 (HUAWEI Technology: HUAWEI Mobile)Now check for bound driver ...
 no driver has bound to interface 0 yet
Device not in "bind_list" yet, bind it now
Module loader is /sbin/modprobe
Module is active already
Try to add ID to driver "option"
 ID added to driver; check for new devices in /dev
 driver binding failed
Check for AVOID_RESET_QUIRK kernel attribute
 AVOID_RESET_QUIRK activated

All done, exit

I don't understand from the log whether everything is OK or there is something wrong with the config. Anyway, the modem doesn't show up in Unity's network menu.

I found somewhere instructions to try wvdial. I edited /etc/wvdial.conf as follows:

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0
Modem Type = Analog Modem
Baud = 9600
New PPPD = yes
Modem = /dev/ttyUSB0
ISDN = 0
; Phone = <Target Phone Number>
; Password = <Your Password>
; Username = <Your Login Name>

[Dialer tele2]
Modem = /dev/ttyUSB0
Phone = *99#
Username =;
Password =;
Init1 = ATZ
Init2 = AT+CPIN=1689
Init3 = AT+CGDCONT=1,"IP","4g.tele2.ee"
Auto DNS = on

And vwdial output was as follows:

$ wvdial tele2
--> WvDial: Internet dialer version 1.61
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: AT+CPIN=1689
AT+CPIN=1689
OK
--> Sending: AT+CGDCONT=1,"IP","4g.tele2.ee"
AT+CGDCONT=1,"IP","4g.tele2.ee"
OK
--> Modem initialized.
--> Sending: ATDT*99#
--> Waiting for carrier.
ATDT*99#
CONNECT
--> Carrier detected.  Waiting for prompt.
--> Connected, but carrier signal lost!  Retrying...
--> Sending: ATDT*99#
--> Waiting for carrier.
--> Timed out while dialing.  Trying again.
--> Sending: ATDT*99#
--> Waiting for carrier.
--> Timed out while dialing.  Trying again.
--> Sending: ATDT*99#
--> Waiting for carrier.

So it appears that vwdial can use the modem, but doesn't connect to the network. Any suggestions on what might be wrong?

Edit: here's what ModemManager and NetworkManager report in syslog when I plug the device in:

Dec  6 08:57:45 dell-vostro-1015 NetworkManager[1269]:    SCPlugin-Ifupdown: devices added (path: /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.1/net/wwan0, iface: wwan0)
Dec  6 08:57:45 dell-vostro-1015 NetworkManager[1269]:    SCPlugin-Ifupdown: device added (path: /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.1/net/wwan0, iface: wwan0): no ifupdown configuration found.
Dec  6 08:57:45 dell-vostro-1015 ModemManager[1057]: <warn>  (ttyUSB0): port attributes not fully set
Dec  6 08:57:45 dell-vostro-1015 usb_modeswitch: switched to 12d1:ffffffff on 002/046
Dec  6 08:57:46 dell-vostro-1015 kernel: [12557.405169] scsi 93:0:0:0: Direct-Access     HUAWEI   TF CARD Storage  2.31 PQ: 0 ANSI: 2
Dec  6 08:57:46 dell-vostro-1015 kernel: [12557.405173] scsi 92:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2
Dec  6 08:57:46 dell-vostro-1015 kernel: [12557.405796] sd 93:0:0:0: Attached scsi generic sg2 type 0
Dec  6 08:57:46 dell-vostro-1015 kernel: [12557.419892] sr1: scsi-1 drive
Dec  6 08:57:46 dell-vostro-1015 kernel: [12557.420173] sr 92:0:0:0: Attached scsi CD-ROM sr1
Dec  6 08:57:46 dell-vostro-1015 kernel: [12557.420345] sr 92:0:0:0: Attached scsi generic sg3 type 5
Dec  6 08:57:46 dell-vostro-1015 kernel: [12557.420929] sd 93:0:0:0: [sdb] Attached SCSI removable disk
Dec  6 08:57:46 dell-vostro-1015 usb_modeswitch[20728]: usb_modeswitch: switched to 12d1:1506 on 2/47
Dec  6 08:57:47 dell-vostro-1015 usb_modeswitch[20728]: usb_modeswitch: add device ID 12d1:1506 to driver option
Dec  6 08:57:47 dell-vostro-1015 usb_modeswitch[20728]: usb_modeswitch: please report the device ID to the Linux USB developers!
Dec  6 08:57:53 dell-vostro-1015 ModemManager[1057]: <info>  Creating modem with plugin 'Huawei' and '3' ports
Dec  6 08:57:53 dell-vostro-1015 ModemManager[1057]: <warn>  Could not grab port (usbmisc/cdc-wdm0): 'Cannot add port 'usbmisc/cdc-wdm0', unsupported'
Dec  6 08:57:53 dell-vostro-1015 ModemManager[1057]: <warn>  Couldn't create modem for device at '/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1': Failed to find primary AT port

Best Answer

I got my Huawei E3276 running on (K)Ubuntu 14.04.3 (and 14.04) by creating the following file:

# custom udev rules for UMTS modems
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="14fe", RUN+="/usr/sbin/usb_modeswitch -v 12d1 -p 14fe -M '55534243123456780000000000000011062000000100000000000000000000'"
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1506", RUN+="/bin/bash -c 'modprobe option && echo 12d1 1506 > /sys/bus/usb-serial/drivers/option1/new_id 

I saved this as /lib/udev/rules.d/70-usb-modeswitch.rules.

Related Question