Activation Codes and Methods, Hardware Details, Sniffing
Post Reply
zxdavb
Posts: 5
Joined: 30 Jan 2012, 00:21
Location: United Kingdom

Huawei E585 / E367 Setup on Linux (OpenWRT)

Post by zxdavb » 30 Jan 2012, 00:45

Hi,

Has anyone seen a 3G modem with TWO switchable modes?

I was unable to get a Huawei E585 to work on OpenWRT (linux). However, I was able to get a Huawei E367 working. In both cases, I made no changes to the /etc/usb_modeswitch.d/12d1:1446 configuration file.

But I had noticed that the E585 switched to device 12d1:1432, whereas on my Windows machine it was 12d1:1408! I thought if I could get the modem to switch to 12d1:1408, then I could use it as a CDC_ETHER device (RNDIS on windows).

A bit of hacking ensued, and I found a new message as follows:

Code: Select all

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

  DefaultVendor=      0x12d1
  DefaultProduct=     0x1446

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

  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"
This is what the E585 looks like with the current Message (newlines added by me for readability):

Code: Select all

T:  Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 12 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=ef(misc ) 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
A:  FirstIf#= 2 IfCount= 2 Cls=02(comm.) Sub=06 Prot=00

I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
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
This is what the E585 looks like with the new Message:

Code: Select all

T:  Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 14 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=12d1 ProdID=1408 Rev= 1.00
S:  Manufacturer=Huawei Incorporated
S:  Product=HUAWEI Mobile Connect
S:  SerialNumber=1234567890ABCDEF
C:* #Ifs= 3 Cfg#= 1 Atr=80 MxPwr=500mA

I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
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= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=84(I) Atr=03(Int.) MxPS=  64 Ivl=2ms
E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms

FWIW, the E367 looks like this before switching:

Code: Select all

T:  Bus=01 Lev=02 Prnt=02 Port=01 Cnt=02 Dev#= 24 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= 0.00
S:  Manufacturer=Huawei Technologies
S:  Product=HUAWEI Mobile
C:* #Ifs= 2 Cfg#= 1 Atr=c0 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

I:* If#= 1 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms


FWIW, the E585 looks like this before switching:

Code: Select all

T:  Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 22 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 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
Last edited by zxdavb on 10 Feb 2012, 20:17, edited 1 time in total.

zxdavb
Posts: 5
Joined: 30 Jan 2012, 00:21
Location: United Kingdom

Post by zxdavb » 30 Jan 2012, 23:04


Josh
Site Admin
Posts: 6570
Joined: 03 Nov 2007, 00:30

Post by Josh » 31 Jan 2012, 14:03

Posting some links, they might explain a bit.

In the beginning:
http://permalink.gmane.org/gmane.linux. ... eral/55289

Later this:
http://permalink.gmane.org/gmane.linux. ... eral/57232

So the driver developer went back to the default setting. This is work in progress though, I'm not sure if the WDC interface is usable yet.


zxdavb
Posts: 5
Joined: 30 Jan 2012, 00:21
Location: United Kingdom

Huawei E367 & E585 - How to setup in OpenWRT

Post by zxdavb » 01 Feb 2012, 03:49

Admin: I will move this post to a more suitable thread in 'Setup Discussion' later today.

Thanks for the links, things are becoming more understood.

I have struggled for a long time to get the E585 working with OpenWRT 10.03.1, r29592 (Linux 2.6.32.27), and I guess it's only fair if I post what I have learned discovered so far. If I am lucky, someone will provide the final pieces of the puzzle here...

My goal is to get the Huawei E585 working on my OpenWRT router. I am trying to attach cdc_ether to it via the new_id feature, but am struggling to do so. Maybe someone could take a look and give me an idea?

As background, I was able to get the E367 working easy enough (using comgt), but have failed with the E585 (should be using cdc_ether?).


Step 1 - install USB support (and lsusb command):

Code: Select all

opkg update
opkg install kmod-usb-core 
opkg install usbutils    # this is the lsusb command

# the command to confirm (you've plugged-in your E367/E585?):
lsusb | grep 12d1
If everything worked so far, you should see 'Huawei Technologies' (ie.e the E367/E585 USB device). Please take a note of the 4-digit PID after 12d1 (it should be 1446).


Step 2 - install USB storage - the E367/E585 both have a micro-SD slot (Note that I had to change the loading order of the modules):

Code: Select all

opkg install kmod-usb-storage 
opkg install block-hotplug block-mount # ?optional: for hot-plug support

opkg install kmod-fs-ext3 e2fsprogs tune2fs # the EXT FS & core utilities
opkg install kmod-fs-msdos dosfsck # the FAT FS & core utilities
opkg install kmod-fs-vfat  kmod-nls-cp437 kmod-nls-iso8859-1 # needed for FAT32/VFAT LFNs

# NB: I needed to change from 60-xxx to 59-xxx so that 60-usb-storage load BEFORE 60-usb-serial
mv /etc/modules.d/60-usb-storage /etc/modules.d/59-usb-storage
# If you don't do this, then usb-serial/usb-serial-option (see later) will 'steal' the storage interfaces

# the command to confirm what's been done so far...
cat /proc/bus/usb/devices | grep Driver
ls /dev/sd*
If everything worked so far, you should see 'usb-storage' and you should see the sd* devices (and you can fstab, etc).


Step 3 - install USB-Modeswitch (yay!)

Code: Select all

opkg install usb-modeswitch usb-modeswitch-data

# the following should automatically execute, but you can run it manually if required...
# usb_modeswitch -c /etc/usb_modeswitch.d/12d1:1446

# the command to confirm what's been done so far...
cat /proc/bus/usb/devices | grep Driver
If everything worked so far, you should see the switched 4-digit PID after 12d1. Write this number down, you'll need it later - for the E367 it's 1506.

Tip: I believe the command to do the equivalent of the script is: usb_modeswitch -v 12d1 -p 1446 -P 1432 -V "1408,1432,1506" -M "55534243000000000000000000000011060000000100000000000000000000".


WHAT FOLLOWS IS SPECIFIC TO THE E367 - VID:PID 12D1:1506 (and works for me).

Step 4a (E367 only) - install the driver for the 3G modem (part 1/2)

Code: Select all

opkg install kmod-usb-serial kmod-usb-serial-option # option module is not required?

# This step is required to force the serial module to attach to the interface
echo usbserial vendor=0x12d1 product=0x1506 maxSize=4096 > /etc/modules.d/60-usb-serial

# to save rebooting, do the following:
rmmod usbserial
insmod usbserial vendor=0x12d1 product=0x1506 maxSize=4096

# the command to confirm what's been done so far...
lsusb | grep 12d1
ls /dev/ttyUSB*
If everything worked so far, you should see 'usbserial_generic', where before it said '(none)' and you should see the ttyUSB* devices.


Step 4a (E367 only) - install the driver for the 3G modem (part 2/2)

Code: Select all

opkg install comgt chat

# the command to confirm what's been done so far (you may need to use a different ttyUSB*)...
gcom -d /dev/ttyUSB0 info
If everything worked so far, you should see 'OK', etc (and I'll leave the rest up to the reader).


WHAT FOLLOWS IS SPECIFIC TO THE E585 - VID:PID 12D1:1432 (and isn't working).

Step 4b (part 1/2) - At this stage, it is worth considering the output of cat /proc/bus/usb/devices, which should include the following output (if all is OK so far) - note that I have added newlines for readability:

Code: Select all

T:  Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 15 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=ef(misc ) 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
A:  FirstIf#= 2 IfCount= 2 Cls=02(comm.) Sub=06 Prot=00

I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
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
The four interfaces, in order are vend. (vendor-specific), stor. (storage), comm. (communications channel) and data (data channel).

In my case, the option driver attached to the vendor-specific interface (although I guess I could have made serial do so, see step 4a, part ) - I am not sure if the vendor-specific interface can be used with comgt/ppp or not (I certainly couldn't get it to work). The storage driver is for the interface so that the micro-SD card can be accessed.

Now my assumption is that The cdc-ether module should attach to the communications / data interfaces...


Step 4b (E585 only) - install the driver for the CDC network device (part 2/2, version 1)

Code: Select all

opkg install kmod-usb-net-cdc-ether

# get the module to 'attach' to the device interfaces using new_id feature (this doesn't seem to work)
echo "12d1 1432" > /sys/bus/usb/drivers/cdc_ether/new_id

# the command to confirm what's been done so far...
cat /proc/bus/usb/devices | grep Driver
If everything worked so far, you should see 'cdc_ether', but I don't. Note that there doesn't appear to be any modprobe command for OpenWRT.


Step 4b (E585 only) - install the driver for the CDC network device (part 2/2, version 2). If you execute grep 12D1 /sys/bus/usb/devices/*/modalias | grep 1432, you'll get the following (Warning: this stuff appears to be very specific to different implementations of Linux)

Code: Select all

/sys/bus/usb/devices/1-1.1:1.0/modalias:usb:v12D1p1432d0100dcEFdsc02dp01icFFiscFFipFF
/sys/bus/usb/devices/1-1.1:1.1/modalias:usb:v12D1p1432d0100dcEFdsc02dp01ic08isc06ip50
/sys/bus/usb/devices/1-1.1:1.2/modalias:usb:v12D1p1432d0100dcEFdsc02dp01ic02isc06ipFF
/sys/bus/usb/devices/1-1.1:1.3/modalias:usb:v12D1p1432d0100dcEFdsc02dp01ic0Aisc00ip00
You can compare that to the output of step 4b, step1, and then try:

Code: Select all

echo "usb:v12D1p1432d0100dcEFdsc02dp01ic02isc06ipFF" > /sys/bus/usb/drivers/cdc_ether/new_id
But it don't work either!

References:
http://www.ha19.no/usb/
http://irclogs.ubuntu.com/2009/04/04/%2 ... kernel.txt
http://ubuntuforums.org/showpost.php?p= ... stcount=59
Last edited by zxdavb on 02 Feb 2012, 00:27, edited 1 time in total.

Josh
Site Admin
Posts: 6570
Joined: 03 Nov 2007, 00:30

Post by Josh » 01 Feb 2012, 14:18

zxdavb, no need to move the thread. It's about information regarding specific devices, so it's perfectly categorized now.

I should have gone more into detail in my previous post. There is an effort underway to support this and other Huawei modems which provide the respective ports. These devices will not work with the standard "cdc_ether" driver, because there is a proprietary protocol from Qualcomm involved (QMI).

To get a handle to the relevant discussion threads, search for the new driver's author in the mailing list archive of "linux-usb":
http://search.gmane.org/?query=bjorn%40 ... sb.general


zxdavb
Posts: 5
Joined: 30 Jan 2012, 00:21
Location: United Kingdom

Post by zxdavb » 01 Feb 2012, 21:01

Then I accept defeat!

Thanks for the valuable input. -Dave

keene
Posts: 1
Joined: 11 Mar 2012, 16:32

Re: Huawei E367 & E585 - How to setup in OpenWRT

Post by keene » 11 Mar 2012, 16:40

hi zxdavb

I m trying to get my td1043nd get to work with E367

i have been searching solutions for usbmodeswitch for weeks

thanks for your work
i follow your instructions finally got the usbmodeswitch done.

however until step 4
i got this

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

could you help me what i can do?

zxdavb
Posts: 5
Joined: 30 Jan 2012, 00:21
Location: United Kingdom

Post by zxdavb » 05 May 2012, 11:56

Answer to previous post: in the newer build of OpenWRT, it doesn't work for me either...

Anyway, here is my latest version of the script...

Code: Select all

    opkg update

### Install the LuCI (Web Admin UI)...
    opkg install luci                    ## alternatively, for a LuCI installation with HTTPS: luci-ssl
	
### Enable & start the LuCI (Web Admin UI)...	
	/etc/init.d/uhttpd enable
	/etc/init.d/uhttpd start

### Install lsusb (libpthread libusb-1.0 zlib libr, usbutils)
    opkg install usbutils

# confirm: lsusb | grep 12d1 # look for 1446

### Install usb-modeswitch (libusb usb-modeswitch usb-modeswitch-data)
    opkg install usb-modeswitch-data

### This line may not be required (if you wait a while, or reboot?)...
    usb_modeswitch -v 12d1 -p 1446 -P 1432 -V "1408,1432,1506" -M "55534243000000000000000000000011060000000100000000000000000000"

# confirm: lsusb | grep 12d1 # look for 1506, after waiting for a few secs...

### Install kmod-usb-storage, BEFORE kmod-usb-serial to stop usb-serial stealing the usb-storage ports
    opkg install kmod-usb-storage 

# Confirm: cat /proc/bus/usb/devices | grep Driver

### This step is neccessary so that usb-stroage loads before usb-serial (see later)
  mv /etc/modules.d/60-usb-storage /etc/modules.d/59-usb-storage

### Install block-mount (now includes block-hotplug)
    opkg install block-mount

    opkg install kmod-fs-ext4  e2fsprogs tune2fs
    opkg install kmod-fs-msdos dosfsck 
    opkg install kmod-fs-vfat  kmod-nls-cp437 kmod-nls-iso8859-1 

#   fix a (output) bug in fsck.sh...
    cp  /lib/functions/fsck.sh                              /lib/functions/fsck.sh.original
    sed -i '/no known/  s:type \$fstype:type $fsck_fstype:' /lib/functions/fsck.sh

### NB: these will be lost on next boot, a better solution is up to the reader...	
    mount -t vfat /dev/sda1 /root
    mount -t ext3 /dev/sda5 /opt
    mount -t ext3 /dev/sda6 /opt/var/cache

# Confirm: df -h 
# Confirm: logread | grep fstab # after removing & re-inserting USB storage (or grep fsck, or sda)

### Install kmod-usb-serial-option (kmod-usb-serial)
    opkg install kmod-usb-serial-option

### Maybe this step no longer required (anyway, I'm still doing it)
  echo usbserial vendor=0x12d1 product=0x1506              > /etc/modules.d/60-usb-serial

### This step saves having to reboot (not working any more? but a sleep seems to do the trick?)
#    rmmod usbserial
#   insmod usbserial vendor=0x12d1 product=0x1506 maxSize=4096

    sleep 5

# Confirm: cat /proc/bus/usb/devices | grep Driver
# Confirm: ls /dev/ttyUSB*

	
### Install luci-proto-3g (requires comgt package, which includes gcom command) 
    opkg install luci-proto-3g

# Confirm: gcom -d /dev/ttyUSB0 info

### Configure WWAN interface - essential (base) configuration
    uci set network.wwan=interface
    uci set network.wwan.proto=3g
    uci set network.wwan.device=/dev/ttyUSB0
    uci set network.wwan.service=umts
    uci set network.wwan.apn=3internet

    uci set firewall.@zone[1].network='wan wwan'  # NB: were keeping the etehrnet WAN port as is

	
### Configure WAN interface - use 3rd-party DNS servers
    uci set network.wwan.peerdns=0
    uci set network.wwan.dns='208.67.222.222 208.67.220.220'

    uci commit
	
   /etc/init.d/network restart
   
   sleep 5 # enough time?
	
# Confirm: ifconfig | grep 3g-wwan -A 9 # after a few secs...
# Confirm: ping 8.8.8.8
[/code]

CawCaw
Posts: 4
Joined: 03 Aug 2012, 17:57

I've got success with E5830.

Post by CawCaw » 03 Aug 2012, 18:59

Hi, thank you for you sharing this.

I used Huawei's optimized driver (hw_cdc_driver) instead of cdc_ether. With my devices (E5830, E5830S and Buffalo wifi router) the driver worked very fine on OpenWRT/Trunk (Linux 3.3.8 ). I found we have to make device switched to "12d1:1432" instead of "12d1:1408" with the driver.

I posted my how-to to OpenWRT forum. If you interested in the driver, please visit
https://forum.openwrt.org/viewtopic.php?id=38452

Almost I had to know to modify OpenWRT I learned on this topic. :) Thank you!

toysoft
Posts: 1
Joined: 27 Aug 2012, 02:31

Post by toysoft » 27 Aug 2012, 02:33

I would like to use a E585 with my dreambox MIPS,

Does someone can help to build the proper environment and compile the Huawei driver for the OE1.6 Dreambox 2.6.18 kernel ?

Thanks,

TS

Post Reply