Bug 178773 - [usbdevs] [patch] Huawei E303 USB 3G modem support
Summary: [usbdevs] [patch] Huawei E303 USB 3G modem support
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: usb (show other bugs)
Version: 9.1-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Christian Brueffer
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2013-05-19 16:40 UTC by Peter Sopko
Modified: 2018-03-02 04:16 UTC (History)
4 users (show)

See Also:


Attachments
file.diff (1.10 KB, patch)
2013-05-19 16:40 UTC, Peter Sopko
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Sopko 2013-05-19 16:40:02 UTC
Huawei E303 USB 3G modem is considered as an unknown device. It is possible to use camcontrol and/or sysutils/usb_modeswitch port to manually force it to become a 3g modem recognised by cdce, u3g and ue drivers, but  no /dev/cua* and /dev/ttyU* /dev-entires are created.

After usb_modeswitch* there is a message in dmesg stating 
May 19 16:05:03 avantgarde root: Unknown USB device: vendor 0x12d1 product 0x1506 bus uhub1

*usb_modeswitch command used was 'usb_modeswitch -v 0x12d1 -p 0x14fe -V 0x12d1 -P 0x1506 -s 20 -M "55534243123456780000000000000a11062000000000000100000000000000"'

Fix: Please see the attached patch (two-line additions to sys/dev/usb/usbdevs and sys/dev/usb/serial/u3g.c). Apply in /usr/src using 'patch -p0 <usb_huawei_e303.txt'

output of usbconfig after the patch:

ugen1.2: <HUAWEI Mobile HUAWEI> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON
ugen1.2.0: u3g0: <HUAWEI HUAWEI Mobile, class 0/0, rev 2.00/1.02, addr 2>
ugen1.2.1: cdce0: <HUAWEI HUAWEI Mobile, class 0/0, rev 2.00/1.02, addr 2>
ugen1.2.4: umass0: <HUAWEI HUAWEI Mobile, class 0/0, rev 2.00/1.02, addr 2>
ugen1.2.5: umass1: <HUAWEI HUAWEI Mobile, class 0/0, rev 2.00/1.02, addr 2>

  bLength = 0x0012 
  bDescriptorType = 0x0001 
  bcdUSB = 0x0200 
  bDeviceClass = 0x0000 
  bDeviceSubClass = 0x0000 
  bDeviceProtocol = 0x0000 
  bMaxPacketSize0 = 0x0040 
  idVendor = 0x12d1 
  idProduct = 0x1506 
  bcdDevice = 0x0102 
  iManufacturer = 0x0003  <HUAWEI>
  iProduct = 0x0002  <HUAWEI Mobile>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0001 


Patch attached with submission follows:
How-To-Repeat: Just plug the usb 3g modem into the machine
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2013-05-19 17:04:31 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-usb

Over to maintainer(s).
Comment 2 Christian Brueffer freebsd_committer 2014-02-05 14:01:03 UTC
State Changed
From-To: open->feedback

These product IDs were added as Huawei E3131 in r238493, can you confirm this works 
with your device?  They are both in 10-STABLES and 9-STABLE.  Sorry for the delay 
in processing this PR! 


Comment 3 Christian Brueffer freebsd_committer 2014-02-05 14:01:03 UTC
Responsible Changed
From-To: freebsd-usb->brueffer

These product IDs were added as Huawei E3131 in r238493, can you confirm this works 
with your device?  They are both in 10-STABLES and 9-STABLE.  Sorry for the delay 
in processing this PR!
Comment 4 bordjukov 2014-03-31 14:56:10 UTC
Hello,

I can confirm that the Huawei E303 is not recognised by the u3g module on
the following platform:

root@chernobyl:~ # uname -a
FreeBSD chernobyl.rogueconf.com 11.0-CURRENT FreeBSD 11.0-CURRENT #0
r263769M: Wed Mar 26 18:19:38 EET 2014
root@barnswallow.local:/usr/obj/mips.mips/usr/src/sys/ROUTERSTATION
mips

The usb_modeswitch command with the parameters specified above works. What
bugs me is that the product id is not getting changed to 0x1506 but to
0x1c05 instead.

Device description without the u3g module loaded:

root@chernobyl:~ # usbconfig -u 0 -a 6 dump_device_desc
ugen0.6: <HUAWEI Mobile HUAWEI> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps)
pwr=ON (500mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x0000
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0040
  idVendor = 0x12d1
  idProduct = 0x14fe
  bcdDevice = 0x0102
  iManufacturer = 0x0002  <HUAWEI>
  iProduct = 0x0001  <HUAWEI Mobile>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0001

Device description with the u3g module loaded:

root@chernobyl:~ # usbconfig -u 0 -a 6 dump_device_desc
ugen0.6: <HUAWEI Mobile HUAWEI> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps)
pwr=ON (500mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x0000
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0040
  idVendor = 0x12d1
  idProduct = 0x1c05
  bcdDevice = 0x0102
  iManufacturer = 0x0002  <HUAWEI>
  iProduct = 0x0001  <HUAWEI Mobile>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0001

dmesg output after the device is connected while the u3g module is loaded:

ugen0.6: <HUAWEI> at usbus0
ugen0.6: <HUAWEI> at usbus0 (disconnected)
ugen0.6: <HUAWEI> at usbus0
umass2: <HUAWEI HUAWEI Mobile, class 0/0, rev 2.00/1.02, addr 6> on usbus0
umass2:  SCSI over Bulk-Only; quirks = 0x0000
umass2:2:2: Attached to scbus2
umass3: <HUAWEI HUAWEI Mobile, class 0/0, rev 2.00/1.02, addr 6> on usbus0
umass3:  SCSI over Bulk-Only; quirks = 0x0000
umass3:3:3: Attached to scbus3
da2 at umass-sim3 bus 3 scbus3 target 0 lun 0
da2: <HUAWEI SD Storage 2.31> Removable Direct Access SCSI-2 device
da2: 40.000MB/s transfers
da2: Attempt to query device size failed: NOT READY, Medium not present
da2: quirks=0x2<NO_6_BYTE>
Comment 5 bordjukov 2014-04-01 12:01:16 UTC
Observed the same behaviour on x86_64.
Comment 6 Alan 2014-10-15 12:47:21 UTC
I have the same trouble that bordjukov@gmail.com.
My system is 9.2 and no option to update/upgrade since no copper or fiber connection in my home. The hardware is old PIII/i443BX used as a testbench. My versions of u3g.c (v.253292), usb_serial.h (v.244813) and usb_serial.c (v.248085) differ from latest ones in https://svnweb.freebsd.org/base/release/9.2.0/sys/dev/usb/serial/ only with version string in comments.
The dongle was "modeswitched" to serial mode on Windows PC, and it works fine with it.
On FreeBSD "usbconfig dump_device_desc" reports:
ugen0.2: <HUAWEI HiLink HUAWEI> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (500mA)
  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0200
  bDeviceClass = 0x0000
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0000
  bMaxPacketSize0 = 0x0040
  idVendor = 0x12d1
  idProduct = 0x1c05
  bcdDevice = 0x0102
  iManufacturer = 0x0002  <HUAWEI>
  iProduct = 0x0001  <HUAWEI HiLink>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0001
These USB VID&PID are present in /usr/src/sys/dev/usb/usbdevs, but PID 0x1c05 belongs to HUAWEI E173.
Both ucom and u3g are compiled into kernel, "kldstat -v" shows "uhub/u3g" but ucom is not shown, attempt to "kldload ucom" results in "can't load ucom: File exists". In /dev are found:
cuau0
cuau0.init
cuau0.lock
cuau1
cuau1.init
cuau1.lock
ttyu0
ttyu0.init
ttyu0.lock
ttyu1
ttyu1.init
ttyu1.lock
Attempt to send "AT" with cu or tip gives no result, usbdump sees no data exchande at all.
I did usbdump when plugging the dongle in and when doing "usbconfig dump_device_desc":
usbdump -b e303_plug-in.bin -w e303_plug-in.raw -vvv >& e303_plug-in.txt
usbdump -b e303_dump_device_desc.bin -w e303_dump_device_desc.raw -vvv >& e303_dump_device_desc.txt
These files are available on https://cloud.mail.ru/public/b4843b2fb3ab/e303.zip
I will be glad to run any commands that might help solving this issue.
Best regards!
Comment 7 Alan 2014-10-23 21:55:44 UTC
I made a dump under Windows XP using SnoopyPro (http://sourceforge.net/projects/usbsnoop/).
The dump files with brief description of actions performed are available at https://cloud.mail.ru/public/ad591ee4b470/Huawei_E303_dump.zip
Hope this can help.
Comment 8 Mike Clarke 2015-03-23 14:11:11 UTC
I've just gone through the process of getting my E303 working with 10.1 on a Soekris net6501:

$ uname -a
FreeBSD  10.1-RELEASE FreeBSD 10.1-RELEASE #4: Mon Mar 23 11:12:41 GMT 2015     clarkema@loki:/usr/obj/nanobsd.sk6501/usr/src/sys/SK6501  amd64

I can confirm the E303 didn't work out of the box; it showed up as a SCSI CD drive.

Equally, the patch given in the original post didn't do the trick; it may be that I have a newer version of the E303 with different IDs.  Mine is an E303s-2.

I added the following lines to /sys/dev/usb/usbdevs:

product HUAWEI E303_INIT       0x1f01   3G modem initial
product HUAWEI E303            0x1001   3G modem

The patch to /sys/dev/usb/serial/u3g.c is as the original post.

I'm happy to help out with any further testing or diagnostics to help close this.