Automatic Activation, Hotplug and UDEV, Configuration
Post Reply
Utha
Posts: 5
Joined: 05 Jul 2021, 02:07
Location: Sydney, AU

Huawei e8372h-320 switches to 0x14db and immediately switches back to 0x1f01 ???

Post by Utha » 05 Jul 2021, 07:53

For context: I've installed usb_modeswitch 2.6 on a NetGate SG-1100 firewall running the latest pfSense, 21.05.

I'm trying to get an e8372h-320 into mode 0x14db, but every time it immediately switches BACK to 0x1f01

Here are the changes I've made from default:

usb_modeswitch.conf

Code: Select all

[21.05-RELEASE][admin@xxxxx]/usr/local/etc: cat usb_modeswitch.conf
# Configuration for the usb_modeswitch package, a mode switching tool for
# USB devices providing multiple states or modes
#
# Evaluated by the wrapper script /usr/sbin/usb_modeswitch_dispatcher
#
# To enable an option, set it to "1", "yes" or "true" (case doesn't matter)
# Everything else counts as "disable"


# Disable automatic mode switching globally (e.g. to access the original
# install storage)

DisableSwitching=1

# Disable check for MBIM module presence and configuration globally (to aid
# special embedded environments). Available as per-device parameter
# 'NoMBIMCheck'

DisableMBIMGlobal=0

# Enable logging (results in a extensive report file in /var/log, named
# "usb_modeswitch_<interface-name>" and probably others

EnableLogging=1

# Optional increase of "delay_use" for the usb-storage driver; there are hints
# that a recent kernel default change to 1 sec. may lead to problems, particu-
# larly with USB 3.0 ports. Set this to at least 3 (seconds) in that case.
# Does nothing if the current system value is same or higher

#SetStorageDelay=4

# If the configuration for your Huawei modem uses the standard switching method,
# you can globally set an alternative method here which provides a different mode:
# either plain serial PPP (for older modems) or NCM which integrates nicely
# with recent Linux distributions, possibly avoiding configuration through a
# modem built-in web page. All other modems are not affected.
# Available as per-device parameter 'AltHuaweiMode'

HuaweiAltModeGlobal=0
12d1:1f01

Code: Select all

[21.05-RELEASE][admin@xxxxx]/usr/local/etc/usb_modeswitch.d: cat 12d1:1f01
# Huawei E353 (3.se) and others
DefaultVendor= 0x12d1
DefaultProduct= 0x1f01
TargetVendor=0x12d1
TargetProductList="14db,14dc"
HuaweiNewMode=1
Current USB device info (fresh reboot, device just inserted):

Code: Select all

[21.05-RELEASE][admin@xxxxx]/usr/local/sbin: ./lsusb -d 0x12d1:
Bus /dev/usb Device /dev/ugen0.2: ID 12d1:1f01 Huawei Technologies Co., Ltd. E353/E3131 (Mass storage mode)



Here's what happens when I attempt to switch modes:

command

Code: Select all

[21.05-RELEASE][admin@xxxxx]/usr/local/sbin: usb_modeswitch -W -D -c /usr/local/etc/usb_modeswitch.d/12d1:1f01

Read config file: /usr/local/etc/usb_modeswitch.d/12d1:1f01

 * usb_modeswitch: handle USB devices with multiple modes
 * Version 2.6.0 (C) Josua Dietze 2017
 * Based on libusb1/libusbx

 ! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor=  0x12d1
DefaultProduct= 0x1f01
TargetVendor=   0x12d1
TargetProductList="14db,14dc"
HuaweiNewMode=1
System integration mode enabled

Look for target devices ...
  found USB ID 0000:0000
  found USB ID 0000:0000
  found USB ID 12d1:1f01
   vendor ID matched
 No devices in target mode or class found
Look for default devices ...
  found USB ID 0000:0000
  found USB ID 0000:0000
  found USB ID 12d1:1f01
   vendor ID matched
   product ID matched
 Found devices in default mode (1)
Access device 002 on bus 000
Get the current device configuration ...
Current configuration number is 1
Use interface number 0
 with class 8
Use endpoints 0x01 (out) and 0x81 (in)

USB description data (for identification)
-------------------------
Manufacturer: HUAWEI_MOBILE
     Product: HUAWEI_MOBILE
  Serial No.: 0123456789ABCDEF
-------------------------
Using standard Huawei switching message
Looking for active drivers ...
 OK, driver detached
Set up interface 0
Use endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
LIBUSB_FUNCTION: libusb_bulk_transfer enter
LIBUSB_FUNCTION: libusb_submit_transfer enter
LIBUSB_FUNCTION: libusb_submit_transfer leave 0
LIBUSB_FUNCTION: libusb_handle_events_timeout_completed enter
LIBUSB_FUNCTION: libusb10_handle_events_sub enter
LIBUSB_TRANSFER: sync I/O done
LIBUSB_FUNCTION: libusb_handle_events_timeout_completed exit
LIBUSB_FUNCTION: libusb_bulk_transfer leave
 OK, message successfully sent
Read the response to message 1 (CSW) ...
LIBUSB_FUNCTION: libusb_bulk_transfer enter
LIBUSB_FUNCTION: libusb_submit_transfer enter
LIBUSB_FUNCTION: libusb_submit_transfer leave 0
LIBUSB_FUNCTION: libusb_handle_events_timeout_completed enter
LIBUSB_FUNCTION: libusb10_handle_events_sub enter
LIBUSB_TRANSFER: sync I/O done
LIBUSB_FUNCTION: libusb_handle_events_timeout_completed exit
LIBUSB_FUNCTION: libusb_bulk_transfer leave
 Response reading failed (error -99)
 Device is gone, skip any further commands
-> Run lsusb to note any changes. Bye!
lsusb

Code: Select all

[21.05-RELEASE][admin@xxxxx]/usr/local/sbin: ./lsusb -d 0x12d1:
Bus /dev/usb Device /dev/ugen0.2: ID 12d1:1f01 Huawei Technologies Co., Ltd. E353/E3131 (Mass storage mode)
dmesg (note the detection and immediate disconnection of cdce0)

Code: Select all

[21.05-RELEASE][admin@xxxxx]/usr/local/sbin: dmesg | tail -n 150


(blah blah blah, here's the important bit...)


umass0: at uhub0, port 2, addr 1 (disconnected)
cd0 at umass-sim0 bus 0 scbus1 target 0 lun 0
cd0: <HUAWEI Mass Storage 2.31>  s/n 0123456789ABCDEF detached
(cd0:umass-sim0:0:0:0): Periph destroyed
umass0: detached
ugen0.2: <HUAWEIMOBILE HUAWEIMOBILE> at usbus0 (disconnected)
ugen0.2: <HUAWEIMOBILE HUAWEIMOBILE> at usbus0
cdce0 on uhub0
cdce0: <CDC Ethernet Control Model (ECM)> on usbus0
ue0: <USB Ethernet> on cdce0
ue0: Ethernet address: 00:1e:10:1f:00:00
ugen0.2: <HUAWEIMOBILE HUAWEIMOBILE> at usbus0 (disconnected)
cdce0: at uhub0, port 2, addr 1 (disconnected)
cdce0: detached
ugen0.2: <HUAWEIMOBILE HUAWEIMOBILE> at usbus0
umass0 on uhub0
umass0: <Mass Storage> on usbus0
cd0 at umass-sim0 bus 0 scbus1 target 0 lun 0
cd0: <HUAWEI Mass Storage 2.31> Removable CD-ROM SCSI-2 device
cd0: Serial Number 0123456789ABCDEF
cd0: 40.000MB/s transfers
cd0: 7MB (3584 2048 byte sectors)
cd0: quirks=0x10<10_BYTE_ONLY>
(cd0:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 00 0d ff 00 00 01 00
(cd0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(cd0:umass-sim0:0:0:0): SCSI status: Check Condition
(cd0:umass-sim0:0:0:0): SCSI sense: MEDIUM ERROR asc:11,0 (Unrecovered read error)
(cd0:umass-sim0:0:0:0): Info: 0xdff
(cd0:umass-sim0:0:0:0): Error 5, Unretryable error
(cd0:umass-sim0:0:0:0): cddone: got error 0x5 back
(cd0:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 00 0d c1 00 00 04 00
(cd0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(cd0:umass-sim0:0:0:0): SCSI status: Check Condition
(cd0:umass-sim0:0:0:0): SCSI sense: MEDIUM ERROR asc:11,0 (Unrecovered read error)
(cd0:umass-sim0:0:0:0): Info: 0xdc1
(cd0:umass-sim0:0:0:0): Error 5, Unretryable error
(cd0:umass-sim0:0:0:0): cddone: got error 0x5 back
(cd0:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 00 0d fe 00 00 01 00
(cd0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(cd0:umass-sim0:0:0:0): SCSI status: Check Condition
(cd0:umass-sim0:0:0:0): SCSI sense: MEDIUM ERROR asc:11,0 (Unrecovered read error)
(cd0:umass-sim0:0:0:0): Info: 0xdfe
(cd0:umass-sim0:0:0:0): Error 5, Unretryable error
(cd0:umass-sim0:0:0:0): cddone: got error 0x5 back
(cd0:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 00 0d ff 00 00 01 00
(cd0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(cd0:umass-sim0:0:0:0): SCSI status: Check Condition
(cd0:umass-sim0:0:0:0): SCSI sense: MEDIUM ERROR asc:11,0 (Unrecovered read error)
(cd0:umass-sim0:0:0:0): Info: 0xdff
(cd0:umass-sim0:0:0:0): Error 5, Unretryable error
(cd0:umass-sim0:0:0:0): cddone: got error 0x5 back
(cd0:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 00 0d fe 00 00 01 00
(cd0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(cd0:umass-sim0:0:0:0): SCSI status: Check Condition
(cd0:umass-sim0:0:0:0): SCSI sense: MEDIUM ERROR asc:11,0 (Unrecovered read error)
(cd0:umass-sim0:0:0:0): Info: 0xdfe
(cd0:umass-sim0:0:0:0): Error 5, Unretryable error
(cd0:umass-sim0:0:0:0): cddone: got error 0x5 back
(cd0:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 00 0d ff 00 00 01 00
(cd0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(cd0:umass-sim0:0:0:0): SCSI status: Check Condition
(cd0:umass-sim0:0:0:0): SCSI sense: MEDIUM ERROR asc:11,0 (Unrecovered read error)
(cd0:umass-sim0:0:0:0): Info: 0xdff
(cd0:umass-sim0:0:0:0): Error 5, Unretryable error
(cd0:umass-sim0:0:0:0): cddone: got error 0x5 back
(cd0:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 00 0d ff 00 00 01 00
(cd0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(cd0:umass-sim0:0:0:0): SCSI status: Check Condition
(cd0:umass-sim0:0:0:0): SCSI sense: MEDIUM ERROR asc:11,0 (Unrecovered read error)
(cd0:umass-sim0:0:0:0): Info: 0xdff
(cd0:umass-sim0:0:0:0): Error 5, Unretryable error
(cd0:umass-sim0:0:0:0): cddone: got error 0x5 back
(cd0:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 00 0d ff 00 00 01 00
(cd0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(cd0:umass-sim0:0:0:0): SCSI status: Check Condition
(cd0:umass-sim0:0:0:0): SCSI sense: MEDIUM ERROR asc:11,0 (Unrecovered read error)
(cd0:umass-sim0:0:0:0): Info: 0xdff
(cd0:umass-sim0:0:0:0): Error 5, Unretryable error
(cd0:umass-sim0:0:0:0): cddone: got error 0x5 back
(cd0:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 00 0d ff 00 00 01 00
(cd0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(cd0:umass-sim0:0:0:0): SCSI status: Check Condition
(cd0:umass-sim0:0:0:0): SCSI sense: MEDIUM ERROR asc:11,0 (Unrecovered read error)
(cd0:umass-sim0:0:0:0): Info: 0xdff
(cd0:umass-sim0:0:0:0): Error 5, Unretryable error
(cd0:umass-sim0:0:0:0): cddone: got error 0x5 back
(cd0:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 00 0d ff 00 00 01 00
(cd0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(cd0:umass-sim0:0:0:0): SCSI status: Check Condition
(cd0:umass-sim0:0:0:0): SCSI sense: MEDIUM ERROR asc:11,0 (Unrecovered read error)
(cd0:umass-sim0:0:0:0): Info: 0xdff
(cd0:umass-sim0:0:0:0): Error 5, Unretryable error
(cd0:umass-sim0:0:0:0): cddone: got error 0x5 back
(cd0:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 00 0d c1 00 00 04 00
(cd0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(cd0:umass-sim0:0:0:0): SCSI status: Check Condition
(cd0:umass-sim0:0:0:0): SCSI sense: MEDIUM ERROR asc:11,0 (Unrecovered read error)
(cd0:umass-sim0:0:0:0): Info: 0xdc1
(cd0:umass-sim0:0:0:0): Error 5, Unretryable error
(cd0:umass-sim0:0:0:0): cddone: got error 0x5 back
(cd0:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 00 0d fe 00 00 01 00
(cd0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(cd0:umass-sim0:0:0:0): SCSI status: Check Condition
(cd0:umass-sim0:0:0:0): SCSI sense: MEDIUM ERROR asc:11,0 (Unrecovered read error)
(cd0:umass-sim0:0:0:0): Info: 0xdfe
(cd0:umass-sim0:0:0:0): Error 5, Unretryable error
(cd0:umass-sim0:0:0:0): cddone: got error 0x5 back
(cd0:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 00 0d ff 00 00 01 00
(cd0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(cd0:umass-sim0:0:0:0): SCSI status: Check Condition
(cd0:umass-sim0:0:0:0): SCSI sense: MEDIUM ERROR asc:11,0 (Unrecovered read error)
(cd0:umass-sim0:0:0:0): Info: 0xdff
(cd0:umass-sim0:0:0:0): Error 5, Unretryable error
(cd0:umass-sim0:0:0:0): cddone: got error 0x5 back
(cd0:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 00 0d fe 00 00 01 00
(cd0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(cd0:umass-sim0:0:0:0): SCSI status: Check Condition
(cd0:umass-sim0:0:0:0): SCSI sense: MEDIUM ERROR asc:11,0 (Unrecovered read error)
(cd0:umass-sim0:0:0:0): Info: 0xdfe
(cd0:umass-sim0:0:0:0): Error 5, Unretryable error
(cd0:umass-sim0:0:0:0): cddone: got error 0x5 back
(cd0:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 00 0d ff 00 00 01 00
(cd0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(cd0:umass-sim0:0:0:0): SCSI status: Check Condition
(cd0:umass-sim0:0:0:0): SCSI sense: MEDIUM ERROR asc:11,0 (Unrecovered read error)
(cd0:umass-sim0:0:0:0): Info: 0xdff
(cd0:umass-sim0:0:0:0): Error 5, Unretryable error
(cd0:umass-sim0:0:0:0): cddone: got error 0x5 back
(cd0:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 00 0d ff 00 00 01 00
(cd0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(cd0:umass-sim0:0:0:0): SCSI status: Check Condition
(cd0:umass-sim0:0:0:0): SCSI sense: MEDIUM ERROR asc:11,0 (Unrecovered read error)
(cd0:umass-sim0:0:0:0): Info: 0xdff
(cd0:umass-sim0:0:0:0): Error 5, Unretryable error
(cd0:umass-sim0:0:0:0): cddone: got error 0x5 back
(cd0:umass-sim0:0:0:0): READ(10). CDB: 28 00 00 00 0d ff 00 00 01 00
(cd0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(cd0:umass-sim0:0:0:0): SCSI status: Check Condition
(cd0:umass-sim0:0:0:0): SCSI sense: MEDIUM ERROR asc:11,0 (Unrecovered read error)
(cd0:umass-sim0:0:0:0): Info: 0xdff
(cd0:umass-sim0:0:0:0): Error 5, Unretryable error
(cd0:umass-sim0:0:0:0): cddone: got error 0x5 back
If I open a separate ssh session and time it just right, I can run lsusb -v during the modeswitch process and see the following:

Code: Select all

[21.05-RELEASE][admin@xxxxx]/usr/local/sbin: ./lsusb -v -d 0x12d1:

Bus /dev/usb Device /dev/ugen0.2: ID 12d1:14db Huawei Technologies Co., Ltd. E353/E3131
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            2 Communications
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x12d1 Huawei Technologies Co., Ltd.
  idProduct          0x14db E353/E3131
  bcdDevice            1.02
  iManufacturer           1 HUAWEI_MOBILE
  iProduct                2 HUAWEI_MOBILE
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           88
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower                2mA
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         0
      bInterfaceCount         2
      bFunctionClass          2 Communications
      bFunctionSubClass       6 Ethernet Networking
      bFunctionProtocol       0
      iFunction               8 CDC ECM
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass      6 Ethernet Networking
      bInterfaceProtocol      0
      iInterface              5 CDC Ethernet Control Model (ECM)
      CDC Header:
        bcdCDC               1.10
      CDC Union:
        bMasterInterface        0
        bSlaveInterface         1
      CDC Ethernet:
        iMacAddress                      7 001E101F0000
        bmEthernetStatistics    0x00000000
        wMaxSegmentSize               1514
        wNumberMCFilters            0x0000
        bNumberPowerFilters              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               5
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0
      iInterface              0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           2
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0
      iInterface              6 CDC Ethernet Data
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            2 Communications
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  bNumConfigurations      1
can't get debug descriptor: Input/output error
Device Status:     0x0001
  Self Powered
Binary Object Store Descriptor:
  bLength                 5
  bDescriptorType        15
  wTotalLength           22
  bNumDeviceCaps          2
  USB 2.0 Extension Device Capability:
    bLength                 7
    bDescriptorType        16
    bDevCapabilityType      2
    bmAttributes   0x00000002
      Link Power Management (LPM) Supported
  SuperSpeed USB Device Capability:
    bLength                10
    bDescriptorType        16
    bDevCapabilityType      3
    bmAttributes         0x00
      Latency Tolerance Messages (LTM) Supported
    wSpeedsSupported   0x000f
      Device can operate at Low Speed (1Mbps)
      Device can operate at Full Speed (12Mbps)
      Device can operate at High Speed (480Mbps)
      Device can operate at SuperSpeed (5Gbps)
    bFunctionalitySupport   0
      Lowest fully-functional device speed is Low Speed (1Mbps)
    bU1DevExitLat           1 micro seconds
    bU2DevExitLat         500 micro seconds
So, it does switch modes, then switches back. From everything I've read in these forums, that's not meant to be possible, right???

One thing I did see in another post was the following comment:
ValdikSS wrote: 12 Apr 2021, 23:05
Do you have a modem of a newer modification, like E8372h-320 or -820 with firmware 10.x.x.x?
E3372-320, E8372-320 and other newer modems with firmware version 10.x.x.x try to automatically detect PC operating system (Linux/macOS or Windows) and switch the mode accordingly. This is done by detecting USB Get Max LUN request from the operating system to device's CD-ROM.

Automatic switching creates race condition, complicating operating system-driven switching to other modes (NCM, for example).

To prevent this behaviour on Linux (for example, on the router running OpenWRT), one should set SINGLE_LUN quirk for usb-storage module.

Code: Select all

# cat /etc/modprobe.d/huawei-noprobe.conf

options usb-storage quirks=12d1:1f01:s
Someone please correct me if I'm wrong with this, but I believe the equivalent in FreeBSD is the following:

Code: Select all

[21.05-RELEASE][admin@xxxxx]/boot: cat loader.conf.local
hw.usb.quirk.0="0x12d1 0x1f01 0 0xffff UQ_MSC_NO_GETMAXLUN"
However, I've tested both with and without this boot option, and see exactly the same results.

I would like to post logs from usb_modeswitch itself, but for some reason it's not producing logfiles at all. As you can see from the config above, logging is enabled, but...

Code: Select all

[21.05-RELEASE][admin@xxxxx]/: find . | grep "usb_modeswitch_"
[21.05-RELEASE][admin@xxxxx]/:
The device is verified working on two Win10 PCs and a Mac. Also, I know 0x155e isn't a valid mode for this device (and I don't want PPP anyway), but for a test I modified the config file to HuaweiAltMode=1 and the device does successfully switch to 0x155e, and it stays that way, even after reboot, until it's unplugged.

So, that's all I got. Am I missing anything simple that I'll kick myself for, or is there any additional info I can provide that might help?

Any ideas or assistance would be hugely appreciated.

LOM
Posts: 1404
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Huawei e8372h-320 switches to 0x14db and immediately switches back to 0x1f01 ???

Post by LOM » 05 Jul 2021, 10:14

Utha wrote: 05 Jul 2021, 07:53
The device is verified working on two Win10 PCs and a Mac. Also, I know 0x155e isn't a valid mode for this device (and I don't want PPP anyway), but for a test I modified the config file to HuaweiAltMode=1 and the device does successfully switch to 0x155e, and it stays that way, even after reboot, until it's unplugged.
It stays there because it doesn't get connected. In ecm mode (12d1:14db) it will automatically negotiate a connect which will make it consume much more power than when it is idle.
Your NetGate SG-1100 can not provide enough current on its usb port to drive the 8372 which in itself is a complete router.
Try to put a separately powered usb hub between the NetGate and the dongle.

Utha
Posts: 5
Joined: 05 Jul 2021, 02:07
Location: Sydney, AU

Re: Huawei e8372h-320 switches to 0x14db and immediately switches back to 0x1f01 ???

Post by Utha » 05 Jul 2021, 11:12

LOM wrote: 05 Jul 2021, 10:14
It stays there because it doesn't get connected. In ecm mode (12d1:14db) it will automatically negotiate a connect which will make it consume much more power than when it is idle.
Your NetGate SG-1100 can not provide enough current on its usb port to drive the 8372 which in itself is a complete router.
Try to put a separately powered usb hub between the NetGate and the dongle.
Well, that will definitely be one I'm gonna kick myself over... :D

The only USB hub I have is an old Belkin with a 0.5A PSU, which obviously didn't work either, so I'll have to wait until morning to go buy a beefier hub.

If that doesn't work I have an Intel NUC receiving shelf treatment, I'll verify that the modem powers up on its USB ports, then install pfSense on that and try again. The WAN port would have to be a USB "gigabit" ethernet adapter (yuck) but at this stage I don't have any other viable solutions for cellular failover (the whole point of the exercise).

Either way I'll post back my experience for the benefit of anyone else silly enough to try the same thing I did...

Thanks LOM, appreciate the assist. When you've spent a day and a night buried in config files and google search results, it can be difficult to see the forest for the trees....

LOM
Posts: 1404
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Huawei e8372h-320 switches to 0x14db and immediately switches back to 0x1f01 ???

Post by LOM » 05 Jul 2021, 12:24

Not enough power on the usb port is the most common reason for why mobile broadband dongles fall off the usb bus when they draw more current than the port can deliver.The overcurrent makes the voltage drop so low that the dongle gets starved and resets itself.

Another thing to look for is the ip address you get from the 8372 dongle/router, it is a 192.168.x.y address since it comes from the LAN side of your dongle/router. Make sure it is not in the same subnet as the LAN of your NetGate SG-1100.
I've never seen a dongle fall off the usb bus because of ip address conflicts but I'm not familiar with pfSense so I don't know how it would react.

Utha
Posts: 5
Joined: 05 Jul 2021, 02:07
Location: Sydney, AU

Re: Huawei e8372h-320 switches to 0x14db and immediately switches back to 0x1f01 ???

Post by Utha » 05 Jul 2021, 15:05

LOM wrote: 05 Jul 2021, 12:24 Another thing to look for is the ip address you get from the 8372 dongle/router, it is a 192.168.x.y address since it comes from the LAN side of your dongle/router. Make sure it is not in the same subnet as the LAN of your NetGate SG-1100.
I've never seen a dongle fall off the usb bus because of ip address conflicts but I'm not familiar with pfSense so I don't know how it would react.
All good there, the first thing I did when I took the Huawei out of the box was disable wifi, turn off DHCP and set a static IP. This device does force you to use 192.168.1.x though, which is really annoying; when double-NAT is involved I prefer subnets on the hot side of the LAN firewall to be in the 10.0 range, much easier to keep things clear in your head when setting up things like port-forwarding, failover, load-balancing, VPN etc. but I can live with it.

I also re-tested the dongle on the Mac, because I remembered it displays available/requested current in the system information utility, and you're exactly right - it wants 2 amps but can only draw 500mA through a standard USB socket.

Update tomorrow when I get hold of a powered hub.

Utha
Posts: 5
Joined: 05 Jul 2021, 02:07
Location: Sydney, AU

Re: Huawei e8372h-320 switches to 0x14db and immediately switches back to 0x1f01 ???

Post by Utha » 06 Jul 2021, 05:24

LOM wrote: 05 Jul 2021, 12:24 Not enough power on the usb port is the most common reason for why mobile broadband dongles fall off the usb bus when they draw more current than the port can deliver.The overcurrent makes the voltage drop so low that the dongle gets starved and resets itself.
Well, unfortunately, it's not a power thing. Plugged in a nice 4A powered hub with USB 3.0 fast-charge ports, and same result.

Also, I should've thought of this as a test before, but I re-enabled the wifi and plugged it directly into the SG-1100.

I'm posting this on a laptop via the Huawei's wifi. It's connected to the 4G network and functioning perfectly (the bad reception is because for testing it's just sitting inside of a data rack, basically a faraday cage :D )

Download:
Image

Upload:
Image

EDIT: one final, hopefully conclusive, test - I fired up a continuous speed test app with simultaneous upload and download that saturated the 4G link for max power consumption, then using SSH on another PC, I ran usb_modeswitch on the SG-1100 half a dozen times and got the same result, immediate switch-back to 0x1f01 just like before, and the speed test showed no drop in link utilization the whole time.

So, if it's not a power issue... any other possibilities?

LOM
Posts: 1404
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Huawei e8372h-320 switches to 0x14db and immediately switches back to 0x1f01 ???

Post by LOM » 06 Jul 2021, 10:09

Seems to be a common occurrence, reported both for pfSense and plain BSD.

https://forum.netgate.com/topic/156221/ ... -usb-modem

google cdce0: detached and you will find lots of such reports but no solution. :x
It is reported mostly for Huawei E3372 (E8372 without wifi) but also for some ethernet based cable modems so it is likely related to the BSD ethernet driver.
I can't imagine that it is usb_modeswitch related.

Utha
Posts: 5
Joined: 05 Jul 2021, 02:07
Location: Sydney, AU

Re: Huawei e8372h-320 switches to 0x14db and immediately switches back to 0x1f01 ???

Post by Utha » 06 Jul 2021, 11:21

LOM wrote: 06 Jul 2021, 10:09 I can't imagine that it is usb_modeswitch related.
I tend to agree. I installed PFSense on another machine, got everything else up and running network-wise, then plugged in the 8372h and didn't have any luck there either. Slightly different behavior, but same outcome - couldn't get it to work.

Well this has been a waste of three days and $130... but hey, I have a shiny new powered USB hub :roll:

I got hold of an old Aircard 320U and that seems to be working. PPP doesn't perform as well, but right now it's more important for this network to just have some sort of cellular failover, as opposed to none.

Thanks again LOM, if I do ever figure this blasted thing out I'll be sure to come back and submit solution/config/whatever. There certainly seems to be others in the same boat!

Cheers!

mementomori@sbj.hu
Posts: 4
Joined: 03 Sep 2021, 14:56

Re: Huawei e8372h-320 switches to 0x14db and immediately switches back to 0x1f01 ???

Post by mementomori@sbj.hu » 04 Sep 2021, 09:26

I suffer from the same issue. Thank you for this thread.
I spent only €45 to this project. It is not completely wasted money but I am not happy that I cannot use it according to my plan.
I will check back if I find something. Thank you all.

jesse99
Posts: 2
Joined: 17 Oct 2023, 05:46

Re: Huawei e8372h-320 switches to 0x14db and immediately switches back to 0x1f01 ???

Post by jesse99 » 27 Feb 2024, 08:43

Have you considered trying different versions of usb_modeswitch or even experimenting with alternative Buckshot Roulette modeswitching tools to see if they yield different results?

maicleusa
Posts: 3
Joined: 25 Mar 2024, 03:32

Re: Huawei e8372h-320 switches to 0x14db and immediately switches back to 0x1f01 ???

Post by maicleusa » 25 Mar 2024, 03:36

This change helps the system operate slope more smoothly and no longer repeats as many errors as before.

Post Reply