Raspberry Pi B and LTE USB modem

Good day!

A Raspberry Pi B running FreeBSD 10.3 PRERELEASE as of 27 January 2016.
All this added LTE usb modem Huawei E3372h (829F).
The system does not see it as a modem, and sees in first time as:

Code:
ugen0.4: <MOBILE> at usbus0
umass0: <Mass Storage> on usbus0
umass0: SCSI over Bulk-Only; quirks = 0x0000
umass0:0:0:-1: Attached to scbus0
da0 at umass-sim0 bus 0 scbus0 target 0 lun 1
da0: <ffff TF CARD storage> Removable Direct Access SCSI-2 device
da0: Serial Number are 0123456789abcdef
da0: 40.000 MB/s transfers
da0: Attempt to query device size failed: NOT READY, Medium not present
da0: quirks=0x2<NO_6_BYTE>

Switching to modem mode is solved using sysutils/usb_modeswitch and it's already decided.

The issue occurs when usb modem is connected and the operating system goes to reboot...

usbconfig before rebooting:
Code:
ugen0.1: <OTG Root HUB DWCOTG> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.2: <product 0x9512 vendor 0x0424> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (2mA)
ugen0.3: <product 0xec00 vendor 0x0424> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (2mA)
ugen0.4: <MOBILE MOBILE> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (2mA)

usbconfig after boot:
Code:
ugen0.1: <OTG Root HUB DWCOTG> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.2: <product 0x9512 vendor 0x0424> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (2mA)
ugen0.3: <product 0xec00 vendor 0x0424> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (2mA)

Where ugen0.4? How work?


After some thought and reading the documentation i am set values in /boot/loader.conf:
Code:
#
u3g_load="YES"
#
kern.shutdown.poweroff_delay=3000
kern.cam.scsi_delay=2000
#
hw.usb.no_boot_wait=1
but in /var/run/dmesg.boot see next:
Code:
...
mmcsd0: 8GB <SDHC 00000 1.0 SN 263FC1FB MFG 06/2012 by 27 SM> at mmc0 41.6MHz/4bit/65535-block
...
Trying to mount root from ufs:/dev/ufs/rootfs [rw]...
warning: no time-of-day clock registered, system time will not be set accurately
uhub0: 1 port with 1 removable, self powered
ugen0.2: <vendor 0x0424> at usbus0
uhub1: <vendor 0x0424 product 0x9512, class 9/0, rev 2.00/2.00, addr 2> on usbus0
uhub1: MTT enabled
uhub1: 3 ports with 2 removable, self powered
ugen0.3: <vendor 0x0424> at usbus0
smsc0: <vendor 0x0424 product 0xec00, rev 2.00/2.00, addr 3> on usbus0
smsc0: chip 0xec00, rev. 0002
miibus0: <MII bus> on smsc0
ukphy0: <Generic IEEE 802.3u media interface> PHY 1 on miibus0
ukphy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
ue0: <USB Ethernet> on smsc0
ue0: Ethernet address: b8:27:eb:2b:a2:52
usb_alloc_device: set address 4 failed (USB_ERR_IOERROR, ignored)
usbd_setup_device_desc: getting device descriptor at addr 4 failed, USB_ERR_IOERROR
usbd_req_re_enumerate: addr=4, set address failed! (USB_ERR_IOERROR, ignored)
usbd_setup_device_desc: getting device descriptor at addr 4 failed, USB_ERR_IOERROR
usbd_req_re_enumerate: addr=4, set address failed! (USB_ERR_IOERROR, ignored)
smsc0: chip 0xec00, rev. 0002
ue0: link state changed to DOWN
usbd_setup_device_desc: getting device descriptor at addr 4 failed, USB_ERR_IOERROR
usbd_req_re_enumerate: addr=4, set address failed! (USB_ERR_IOERROR, ignored)
ue0: link state changed to UP
usbd_setup_device_desc: getting device descriptor at addr 4 failed, USB_ERR_IOERROR
usbd_req_re_enumerate: addr=4, set address failed! (USB_ERR_IOERROR, ignored)
usbd_setup_device_desc: getting device descriptor at addr 4 failed, USB_ERR_IOERROR
ugen0.4: <Unknown> at usbus0 (disconnected)
uhub_reattach_port: could not allocate new device

Now the questions:
1. Why ugen0.4 disabled? How skip this stage of detect usb?
If usb modem add after loading everything is fine.

2. How to force the loader to use only mmcsd0, where FreeBSD located?
 
Good day to all!
It self asked, it self answered.
Of course I had to experiment a lot.

Everything was very trivial.

When the Raspberry Pi B (RPI-B) is sent to restart by command reboot, then USB modem disappears and the logs we see message: .
Code:
usb_alloc_device: set address 4 failed (USB_ERR_TIMEOUT, ignored)
usbd_setup_device_desc: getting device descriptor at addr 4 failed, USB_ERR_IOERROR
usbd_req_re_enumerate: addr=4, set address failed! (USB_ERR_TIMEOUT, ignored)
usbd_setup_device_desc: getting device descriptor at addr 4 failed, USB_ERR_IOERROR
usbd_req_re_enumerate: addr=4, set address failed! (USB_ERR_TIMEOUT, ignored)
usbd_setup_device_desc: getting device descriptor at addr 4 failed, USB_ERR_IOERROR
usbd_req_re_enumerate: addr=4, set address failed! (USB_ERR_IOERROR, ignored)
usbd_setup_device_desc: getting device descriptor at addr 4 failed, USB_ERR_IOERROR
usbd_req_re_enumerate: addr=4, set address failed! (USB_ERR_IOERROR, ignored)
usbd_setup_device_desc: getting device descriptor at addr 4 failed, USB_ERR_IOERROR
ugen0.4: <Unknown> at usbus0 (disconnected)
uhub_reattach_port: could not allocate new device

If the RPI-B to reboot via power off, then nothing is lost and all devices in its place.
As a result, there is a problem in software reset and most likely it is a problem of RPI-B.

But the situation changes dramatically, if the USB modem is always available in the connector and switched to modem mode with the command:
usb_modeswitch -W -I -v 12d1 -p 15e7 -M 55534243123456780000000000000011062000000101000100000000000000
and the module /boot/kernel/u3g.ko is loaded!

In such an implementation, the USB modem never goes away.
Let me remind you, we are talking about the modem Huawei E3372h (829F).
 
Hi,

Maybe we can power off the USB port in the DWC OTG driver before rebooting. Might also be that a self-powered external USB HUB will solve the problem.

--HPS
 
I also have addition to the stated theme.
There is another way to translate the specified device is in modem mode is the AT-commands.
Only there's a catch - if you can't switch back to the SD-card. Though not necessary :)
After usb_modeswitch need connect as:
cu -l /dev/cuaU0.0 -s 115200

> AT
> OK

> AT^CARDLOCK?
> ^CARDLOCK: 2,10,0
if <2> - then modem not locked

> AT^SETPORT?
> ^SETPORT:A1,A2;A1,A2
this is mode of CD ans SD

> AT^SETPORT="FF;10,12,16"
> OK
switch to modem mode.

> AT^GETPORTMODE
> ^GETPORTMODE: TYPE: WCDMA: ,,modem:0,pcui:1,ncm:2
new mode report

> AT^RESET
> OK
and mode rebooted ..

The in dmesg see:
ugen0.4: <MOBILE> at usbus0
u3g0: <MOBILE MOBILE, class 0/0, rev 2.10/1.02, addr 4> on usbus0
u3g0: Found 2 ports.

usbconfig -u 0 -a 4 dump_device_desc
ugen0.4: <MOBILE MOBILE> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (2mA)

If need return first mode:
> AT^SETPORT="A1,A2;A1,A2"
but my modem refuses to change the mode.

In principle, the subject can be considered closed.
 
Back
Top