OpenWrt Forum Archive

Topic: HOWTO setup USB tethering via Huawei E5830/E5830S (hw_cdc_driver)

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.

Hi. I've tested Huawei's cdc driver on trunk/AR71xx. The driver seems work fine on kernel 3.3 (at least in normal situation). I understand this may be a temporarily solution, thankfully, cdc_ether driver is growing everyday. I hope this will help someone who want to use a mobile-router (pocket wifi) both indoors and outdoors. If you have E5830/S and AR71xx device, please try attached ipk.

My environment

                                ~ ~ ~ [wlan0: AG300H :wlan1] ~ ~ ~
Internet <--3G--> (E5830/S) <--USB--> [eth2: /OpenWRT :eth0] <--GbLAN--> [PC1]..[PCn]

192.168.1.1: d25hw(E5830S JP_Localized) -- Firewall, DHCP/DNS-Server, Default-gateway
192.168.1.2: WZR-HP-AG300H / Trunk (r32895) -- Bridge-only
192.168.1.5: PC1

Some wireless devices connected to wlan0/1 and wired PCs can share E5830's 3G connection. I always disable WiFi on E5830 indoors.

How to setup
1. Install module and packages.

# Install packages for accessing microsd card.

opkg install kmod-usb-storage
opkg install kmod-fs-msdos kmod-fs-vfat
opkg install kmod-nls-utf8 kmod-nls-cp437 kmod-nls-iso8859-1

# Install packages for communication between devices.

opkg install usb-modeswitch usb-modeswitch-data
opkg install kmod-usb-serial-option kmod-usb-net

# Install hw_cdc_driver package.
(I am afraid you won't success to install this. Please read #4,#6 first.)
http://galapago.sakura.ne.jp/openwrt/bi … ar71xx.ipk

2. Adjust bridge configuration.
  (or edit luci's bridge setting after reboot)

IFNAME=`uci get network.lan.ifname`
uci set network.lan.ifname="$IFNAME eth2"
uci commit network

(e5830 is shown in my environment as "eth2")

3. Plug the egg and see outputs.

usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
 :
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver usbserial
USB Serial support registered for generic
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial Driver core
USB Serial support registered for GSM modem (1-port)
usbcore: registered new interface driver option
option: v0.7.2:USB Driver for GSM modems
usbcore: registered new interface driver huawei_ether
 :
usb 1-1: new high-speed USB device number 2 using ehci-platform
scsi0 : usb-storage 1-1:1.0
usb 1-1: USB disconnect, device number 2
usb 1-1: new high-speed USB device number 3 using ehci-platform
option 1-1:1.0: GSM modem (1-port) converter detected
usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
scsi1 : usb-storage 1-1:1.1
device eth2 entered promiscuous mode
br-lan: port 4(eth2) entered forwarding state
br-lan: port 4(eth2) entered forwarding state
br-lan: port 4(eth2) entered disabled state
scsi 1:0:0:0: CD-ROM        HUAWEI Mass storage  ffff PQ: 0 ANSI: 2
scsi 1:0:0:1: Direct-Access HUAWEI Mass storage  ffff PQ: 0 ANSI: 2
sd 1:0:0:1: [sda] 3932160 512-byte logical blocks: (2.01 GB/1.87 GiB)
sd 1:0:0:1: [sda] Write Protect is off
sd 1:0:0:1: [sda] Mode Sense: 00 00 00 00
sd 1:0:0:1: [sda] Asking for cache data failed
sd 1:0:0:1: [sda] Assuming drive cache: write through     # should to adjust.
sd 1:0:0:1: [sda] Asking for cache data failed
sd 1:0:0:1: [sda] Assuming drive cache: write through
 sda:
sd 1:0:0:1: [sda] Asking for cache data failed
sd 1:0:0:1: [sda] Assuming drive cache: write through
sd 1:0:0:1: [sda] Attached SCSI removable disk
hw_send_qmi_request: 0 Get response failed
hw_send_qmi_request: get the conn status req=22 resp
hw_cdc_check_status_work: carrier on
br-lan: port 4(eth2) entered forwarding state

4. Test connections from AG300H

ping 192.168.1.1
ping some_internet_host

5. How to access to microsd from AG300H
eg. 2GB microSD (single partition)

mkdir /mnt/microsd
mount /dev/sda /mnt/microsd
ls /mnt/microsd/

Module's original source code
is included in "Linux_Driver_4.19.07.00.tar.gz". Available at http://www.huaweidevice.com/worldwide/ (Please search the words, "linux driver")

How to build your own module.
I am new to OpenWRT, so please tell me anything if you can make this procedure better and righter.
I think I should to define such a lot of package dependencies in mk file. And I am sorry I know I should to build for all platform when I post. If you interested in this post, please try to compile your own module. Here is how I compiled for AR71xx.

# Get current config for AR71xx and check revision number (e.g. r32991)
mkdir work
cd ~/work
wget http://downloads.openwrt.org/snapshots/trunk/ar71xx/config
grep version: config

# Get the trunk for latest snapshot
svn co -r 32991 svn://svn.openwrt.org/openwrt/trunk/

cd trunk
cp ../config target/linux/ar71xx/config32991
mv ../config .config

make menuconfig
make -j2 V=99

# Get driver source
cd ~/work
wget <Linux_Driver_4.19.07.00.tar.gz>
tar xvf Linux_Driver_4.19.07.00.tar.gz
cp driver/ndis_driver/ndis_src/src/hw_cdc_driver.c trunk/build_dir/linux-ar71xx_generic/linux-3.3.8/drivers/net/usb/

# Apply patch
wget http://galapago.sakura.ne.jp/openwrt/hw_cdc_driver.patch
cd trunk
patch -p0 < ~/work/hw_cdc_driver.patch

make menuconfig  # set 'm' to HW_CDC_DRIVER 
make -j2 V=99

ls -l bin/ar71xx/packages/kmod-usb/*hw-cdc*
ls -l build_dir/linux-ar71xx_generic/packages/ipkg-ar71xx/*hw-cdc*

Thank you for you finished reading my cheap English!:)

(Last edited by cawcaw on 8 Aug 2012, 12:42)

Hi


Thanks for the howto. Right now, I'm trying to do the same, but with a Huawei k5005 (4g/lte) dongle. I've updated today to build r32991, so, your compiled ipk fails to install.

As I'm quite lazy smile, would you be so kind to compile the ipk for the newer code?

BTW, the cdc driver for kernel 3.3.8 doesn't yet support these lte dongles?


Thank you

Hi! I recompiled it for r32991 and update the link in first post. Please try.
I have only one running primary router now (I've ordered a cute tl-wr703n for development). And I don't have any stick type devices. So I am sorry, I've not tested it.
I hope you will get success. Thank you for your reply!

Tried to install your ipk and it failed. Why? Because the kernel in my router is different from yours. Although the version is the same, the checksum is different, because, the configuration is also different. Sorry for the incovenience.

So, looks like the solution is to follow your howto smile

There's also a nice "OpenWRT Build Guide: Start To Finish" here in case you or someone be interested.

Thank you for your help!



P.S.: While testing this, the router started working with my vodafone k5005 dongle. I've followed the instructions from the post before the last here, but this sets the device to work in serial mode, so, the speed is limited (~15Mb) when compared to ethernet emulation (your post) that has no speed limit.

(Last edited by marc22 on 7 Aug 2012, 22:20)

Hi @cawcaw, nice howto!

I have one simple question. Lets assume that the cdc_ether driver is working and you have managed to get your dongle recognized by the router's kernel. It seems that the dongle is recognized like an ethernet device. How you setup the settings needed to connect to the mobile network (apn, user, pass, etc...)? Typically you need a modem to do a ppp dial-up session to your mobile provider's data network.

One more question, I have an android smart phone that I setup with a custom rom over a custom kernel - now the usb tethering works out of the box, Do I need the same driver as I intend to connect my phone to the USB port of the router and use it to make my 3G WAN connection via it? My linux laptop recognizes my phone tethering as an ethernet usb0 interface and I can configure it as a normal ethernet device, since the modem operations and 3g connection is done only by the phone.

Probably this driver works for the router in exactly the same manner, but in the second scenario, we have the smart phone taking care about the connection to the mobile data network, and in the case of using only the dongle on the router, you seem not to configure those parameters.

Regards,
dir2cas

(Last edited by dir2cas on 8 Aug 2012, 08:49)

Hi @marc22, thank you very much for your advice. I am sorry to take your time, I found I needed to learn more about package...
For your covenience here is archived file contains the driver and script file. You can copy .ko and 66-xxx into /lib/.. and /etc/.. directly.

http://galapago.sakura.ne.jp/openwrt/bi … driver.zip

Hello @dir2cas, I am using E5830 (mobile router device), not usb data stick. This device has dhcp server, dns server and web setting page also. I have to configure apn etc... at the web setting page in advance. Then I open some web page in my PC's browser, the mobile router automatically begin to connect.

I am sorry I don't know how I operate data stick with this driver. Please download the Huawei's source code and look at scripts in it. On linux desktop, they seem to use "MobilePartner" in order to connect. Though I don't know how it works, I think probably you can do the same by scripting. I will try when I get my stick. Please go ahead!

cawcaw wrote:

I am sorry I don't know how I operate data stick with this driver. Please download the Huawei's source code and look at scripts in it. On linux desktop, they seem to use "MobilePartner" in order to connect. Though I don't know how it works, I think probably you can do the same by scripting. I will try when I get my stick. Please go ahead!

Hello,

I am obviously biased here, being the author, but I believe you should use the qmi_wwan driver for most of these devices instead of the Huawei driver.  It does require some userspace application talking QMI to the modem, but the advantage is that you can configure *anything* you want.  The qmi_wwan driver is part of the mainline 3.4 kernel and newer.  There is work going on adding QMI support to both oFono and ModemManager.  I don't know if either of those are suitable for OpenWRT?

The  hw_cdc_driver is a dead end, I'm afraid.  It is a combination of several drivers already part of the kernel (which makes it incompatible with those), and a few small QMI functions to get basic network attachment working.


Bjørn

Dear Bjørn,
I am really thankful to your development. I am living with OSS smile. I am very sorry to late reply and my cheap English.

Thank you for your advice. I totally agree with you. I wish I could explain new how to in modern way...

I am using my E5830 with two host devices these a month. One is this OpenWRT router at home and the other is an arm board embedded in my car which linux2.6 is running. These environments with Huawei's driver is enough to me now, so I will use old driver for the near future... But I am interested in seminal way too.

Someone who friendly to LTE stick and OpenWRT please open new topic about the qmi_wwan driver. Let's move to modern way!

Sorry to disturb here, but I am quiet "lost". I am seeking advise on how I could compile this driver for the E585 on a MIPS platform (Dreambox DM800se 2.6.18 Kernel OE1.6).

Here are the details, I was able to switch it to the data with he config below,

WAS :

T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#=  3 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=12d1 ProdID=1446 Rev= 1.00
S:  Manufacturer=Huawei Incorporated
S:  Product=HUAWEI Mobile Connect
S:  SerialNumber=1234567890ABCDEF
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms


WITH :

########################################################
# Huawei, newer modems

  DefaultVendor=      0x12d1
  DefaultProduct=     0x1446

  TargetVendor=       0x12d1
  TargetProductList= "1408,1432,1506"

  MessageEndpoint=0x01

  CheckSuccess=20

# makes 12d1:1408 on E585, 12d1:1506 on E367 (this is the Message I sniffed)
# MessageContent="55534243000000000000000000000011060000000100000000000000000000"

# makes 12d1:1432 on E585, 12d1:1506 on E367 (this Message is the default)
MessageContent="55534243123456780000000000000011062000000100000000000000000000"

TO:

T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#=  4 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=ef(unk. ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=12d1 ProdID=1432 Rev= 1.00
S:  Manufacturer=Huawei Incorporated
S:  Product=HUAWEI Mobile Connect
S:  SerialNumber=1234567890ABCDEF
C:* #Ifs= 4 Cfg#= 1 Atr=80 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=82(I) Atr=03(Int.) MxPS=  64 Ivl=1ms
I:  If#= 1 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:  If#= 2 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=ff Driver=(none)
E:  Ad=84(I) Atr=03(Int.) MxPS=  64 Ivl=1ms
I:  If#= 3 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=(none)
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

If someone can give me some tips to compile it and have a working environment for the DM800se MIPS, it would be just wonderfull,

Thanks !

TS

toysoft wrote:

Sorry to disturb here, but I am quiet "lost". I am seeking advise on how I could compile this driver for the E585 on a MIPS platform (Dreambox DM800se 2.6.18 Kernel OE1.6).

Try it.  See where it fails.  If it is obvious, fix it. If not, look through the changes from 2.6.18 to 3.5 and see if you can find an explanation there.  Attempt to backport or disable whatever feature was missing.  Try again.

That's the generic driver backport strategy I would use.  But 2.6.18 is reaaaally old.  There may be important API changes missing...

I was able to interface an E585 modem in Debian 7 for internet access  (set up as a wired connection)

Search for the Huawei download "HUAWEI Data Cards Linux Driver", and unpack the zip.  follow the instructions to install it. The version I use is 4.19.19.00 . My device was immediately detected as a Huawei USB serial thingo, uses a huawei_ether driver

The pocketwifi config page is accessible too.  Works well

(Last edited by gez on 31 Oct 2013, 07:24)

The discussion might have continued from here.