配置华为 E3276 调制解调器

配置华为 E3276 调制解调器

我在 Ubuntu 14.04 上使用移动宽带调制解调器(华为 E3276)时遇到了问题。

lsusb 输出:

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

当我插入调制解调器时,/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

我无法从日志中看出一切是否正常或配置是否有问题。无论如何,调制解调器没有显示在 Unity 的网络菜单中。

我在某处找到了尝试 wvdial 的说明。我编辑了 /etc/wvdial.conf 如下:

[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

vwdial 输出如下:

$ 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.

因此,看起来 vwdial 可以使用调制解调器,但无法连接到网络。对于可能出现的问题,您有什么建议吗?

编辑:当我插入设备时,下面是 ModemManager 和 NetworkManager 在系统日志中报告的内容:

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

答案1

通过创建以下文件,我让我的华为 E3276 在 (K)Ubuntu 14.04.3(和 14.04)上运行:

# 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 

我将其保存为/lib/udev/rules.d/70-usb-modeswitch.rules

答案2

插入 USB 后运行以下命令:

sudo usb_modeswitch -J -v 0x12d1 -p 0x14fe

如果不起作用,请下载并安装 usb_modeswitch 和 usb_modeswitch data 最新版本

https://launchpad.net/ubuntu/+source/usb-modeswitch/2.2.5+repack0-1ubuntu1/+build/8089712

http://packages.ubuntu.com/wily/all/usb-modeswitch-data/download

重新启动,插入设备并重试上面的 sudo usb_mode... 命令。

相关内容