Activation Codes and Methods, Hardware Details, Sniffing
davidshepherd7
Posts: 3
Joined: 22 Sep 2020, 16:25

E3372h-320 (update 2020 version of E3372) automatically switches itself into ethernet mode

Post by davidshepherd7 » 23 Sep 2020, 13:02

Hi,

I had some problems with getting an E3372h-320 into serial (or "option") mode and wanted to share my findings.

We have a setup which switches our E3372 modems into serial mode. This has been working perfectly well with older modems for around 6 months now, but recently we got a new batch of modems which mysteriously switched into ethernet mode instead. Here's what happens:

* The new modems initially appear with the same vendor and product id as the old ones: 12d1:1f01 (as seen in journalctl).
* Our setup correctly identifies our custom rule to switch them into serial mode (product 155e) and runs usb_modeswitch with the appropriate arguments.
* But usb_modeswitch always crashes with the error "Error opening the device. Abort" just after it finds the device (I set EnableLogging=1 to see this, full logs below).
* Then the modem disappears, and reappears in ethernet mode (product 14db)!

The exact same thing happens even if I set `DisableSwitching=1` (and the logs confirm that usb modeswitch didn't attempt to do any switching)!

Eventually I tried disabling the USB storage kernel module (by putting "install usb-storage /bin/true" into a file in /etc/modprobe.d/, just blacklisting the module didn't work) and after a reboot the modem switched properly.

I guess what is happening is the modem is somehow detecting that it is being mounted as usb storage on a Linux system, and switches itself into ethernet mode.

Anyway, all of this turned out to be a waste of time because the E3372h-320 barely supports any AT commands (only the version information ones as far as I can tell) so it's completely useless as a serial modem. If anyone knows how to get it to support AT commands I'd love to know.

I hope this helps to save other people from going through the same painful debugging experience as me.




Here is the full usb modeswitch log:

Code: Select all

USB_ModeSwitch log from Wed Sep 23 10:51:28 2020

Use global config file: /etc/usb_modeswitch.conf

Raw args from udev: 1-1.4.4.2:1.0

Bus ID for device not given by udev.
 Trying to determine it from kernel name (1-1.4.4.2:1.0) ...
Use top device dir /sys/bus/usb/devices/1-1.4.4.2

USB dir exists: /sys/bus/usb/devices/1-1.4.4.2

SCSI dir exists: /sys/bus/usb/devices/1-1.4.4.2
Warning: SCSI attribute "vendor" not readable.
Warning: SCSI attribute "model" not readable.
Warning: SCSI attribute "rev" not readable.
Use interface /sys/bus/usb/devices/1-1.4.4.2/1-1.4.4.2:1.0
----------------
USB values from sysfs:
  idVendor	12d1
  idProduct	1f01
  manufacturer	HUAWEI_MOBILE
  product	HUAWEI_MOBILE
  serial	0123456789ABCDEF
  bNumConfigurations	1
  bConfigurationValue	1
  devnum	6
  busnum	1
----------------
bNumConfigurations is 1 - don't check for active configuration
Found packed config collection /usr/share/usb_modeswitch/configPack.tar.gz
Searching entries named: /usr/share/usb_modeswitch/12d1:1f01*
Searching overriding entries named: /etc/usb_modeswitch.d/12d1:1f01*
SCSI attributes not needed, move on.

Use overriden config 12d1:1f01 from collection /etc/usb_modeswitch.d
config: TargetVendor set to 12d1
config: TargetProduct set to 155f
Driver module is "option", ID path is /sys/bus/usb-serial/drivers/option1
! matched, now switching
Unbinding driver
Command to be run:
/usr/sbin/usb_modeswitch -W -D -s 20 -c /etc/usb_modeswitch.d/12d1:1f01 -u -1 -b 1 -g 6 -v 12d1 -p 1f01 2>&1

Verbose debug output of usb_modeswitch and libusb follows
(Note that some USB errors are expected in the process)
--------------------------------

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

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

 ! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor=  0x12d1
DefaultProduct= 0x1f01
TargetVendor=   0x12d1
TargetProduct=  0x155f
MessageContent="55534243123456780000000000000011063000000100010000000000000000"
Success check enabled, max. wait time 20 seconds
System integration mode enabled

Use given bus/device number: 001/006 ...
Look for default devices ...
 bus/device number matched
  found USB ID 12d1:1f01
   vendor ID matched
   product ID matched
 Found devices in default mode (1)
Error opening the device. Abort

--------------------------------
(end of usb_modeswitch output)

USB dir exists: /sys/bus/usb/devices/1-1.4.4.2
Warning: USB attribute "product" not readable.
Warning: USB attribute "serial" not readable.
Warning: USB attribute "bNumConfigurations" not readable.
Warning: USB attribute "bConfigurationValue" not readable.
Warning: USB attribute "devnum" not readable.
Warning: USB attribute "busnum" not readable.

All done, exit
and the output of journalctl -b 0 | grep usb

Code: Select all

Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usbcore: registered new interface driver usbfs
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usbcore: registered new interface driver hub
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usbcore: registered new device driver usb
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usbcore: registered new interface driver lan78xx
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usbcore: registered new interface driver smsc95xx
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.04
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb usb1: Product: xHCI Host Controller
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb usb1: Manufacturer: Linux 5.4.0-1018-raspi xhci-hcd
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb usb1: SerialNumber: 0000:01:00.0
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb usb2: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.04
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb usb2: Product: xHCI Host Controller
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb usb2: Manufacturer: Linux 5.4.0-1018-raspi xhci-hcd
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb usb2: SerialNumber: 0000:01:00.0
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb 1-1: new high-speed USB device number 2 using xhci_hcd
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb 1-1: New USB device found, idVendor=2109, idProduct=3431, bcdDevice= 4.20
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb 1-1: Product: USB2.0 Hub
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb 1-1.4: new high-speed USB device number 3 using xhci_hcd
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb 1-1.4: New USB device found, idVendor=2109, idProduct=2817, bcdDevice= 3.64
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb 1-1.4: Product: USB2.0 Hub
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb 1-1.4: Manufacturer: VIA Labs, Inc.
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb 1-1.4.4: new high-speed USB device number 4 using xhci_hcd
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb 1-1.4.4: New USB device found, idVendor=2109, idProduct=2817, bcdDevice=90.23
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb 1-1.4.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb 1-1.4.4: Product: USB2.0 Hub             
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb 1-1.4.4: Manufacturer: VIA Labs, Inc.         
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb_phy_generic phy: phy supply vcc not found, using dummy regulator
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb 1-1.4.4.4: new high-speed USB device number 5 using xhci_hcd
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb 1-1.4.4.4: New USB device found, idVendor=2109, idProduct=2817, bcdDevice=90.23
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb 1-1.4.4.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb 1-1.4.4.4: Product: USB2.0 Hub             
Aug 06 23:14:47 sim-robot-office-pi-1 kernel: usb 1-1.4.4.4: Manufacturer: VIA Labs, Inc.         
Aug 06 23:14:49 sim-robot-office-pi-1 kernel: usbcore: registered new interface driver brcmfmac
Sep 23 10:51:28 sim-robot-office-pi-1 kernel: usb 1-1.4.4.2: new high-speed USB device number 6 using xhci_hcd
Sep 23 10:51:28 sim-robot-office-pi-1 kernel: usb 1-1.4.4.2: New USB device found, idVendor=12d1, idProduct=1f01, bcdDevice= 1.02
Sep 23 10:51:28 sim-robot-office-pi-1 kernel: usb 1-1.4.4.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Sep 23 10:51:28 sim-robot-office-pi-1 kernel: usb 1-1.4.4.2: Product: HUAWEI_MOBILE
Sep 23 10:51:28 sim-robot-office-pi-1 kernel: usb 1-1.4.4.2: Manufacturer: HUAWEI_MOBILE
Sep 23 10:51:28 sim-robot-office-pi-1 kernel: usb 1-1.4.4.2: SerialNumber: 0123456789ABCDEF
Sep 23 10:51:28 sim-robot-office-pi-1 systemd[1]: Created slice system-usb_modeswitch.slice.
Sep 23 10:51:28 sim-robot-office-pi-1 kernel: usb-storage 1-1.4.4.2:1.0: USB Mass Storage device detected
Sep 23 10:51:28 sim-robot-office-pi-1 kernel: scsi host0: usb-storage 1-1.4.4.2:1.0
Sep 23 10:51:28 sim-robot-office-pi-1 kernel: usbcore: registered new interface driver usb-storage
Sep 23 10:51:28 sim-robot-office-pi-1 kernel: usbcore: registered new interface driver uas
Sep 23 10:51:28 sim-robot-office-pi-1 usb_modeswitch_dispatcher[1440]: Could not read attribute: No such file or directory
Sep 23 10:51:28 sim-robot-office-pi-1 usb_modeswitch_dispatcher[1440]: Could not read attribute: No such file or directory
Sep 23 10:51:29 sim-robot-office-pi-1 usb_modeswitch[1440]: usb_modeswitch: use overriden config 12d1:1f01 from collection /etc/usb_modeswitch.d; make sure this is intended
Sep 23 10:51:29 sim-robot-office-pi-1 usb_modeswitch[1440]: usb_modeswitch: please report any new or corrected settings; otherwise, check for outdated files
Sep 23 10:51:30 sim-robot-office-pi-1 kernel: usb 1-1.4.4.2: reset high-speed USB device number 6 using xhci_hcd
Sep 23 10:51:30 sim-robot-office-pi-1 usb_modeswitch_dispatcher[1440]: libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/001/006: No such device
Sep 23 10:51:30 sim-robot-office-pi-1 kernel: usb 1-1.4.4.2: device firmware changed
Sep 23 10:51:30 sim-robot-office-pi-1 kernel: usb 1-1.4.4.2: USB disconnect, device number 6
Sep 23 10:51:30 sim-robot-office-pi-1 usb_modeswitch_dispatcher[1440]: Could not read attribute: No such file or directory
Sep 23 10:51:30 sim-robot-office-pi-1 kernel: usb 1-1.4.4.2: new high-speed USB device number 7 using xhci_hcd
Sep 23 10:51:30 sim-robot-office-pi-1 kernel: usb 1-1.4.4.2: New USB device found, idVendor=12d1, idProduct=14db, bcdDevice= 1.02
Sep 23 10:51:30 sim-robot-office-pi-1 kernel: usb 1-1.4.4.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Sep 23 10:51:30 sim-robot-office-pi-1 kernel: usb 1-1.4.4.2: Product: HUAWEI_MOBILE
Sep 23 10:51:30 sim-robot-office-pi-1 kernel: usb 1-1.4.4.2: Manufacturer: HUAWEI_MOBILE
Sep 23 10:51:31 sim-robot-office-pi-1 kernel: cdc_ether 1-1.4.4.2:1.0 eth1: register 'cdc_ether' at usb-0000:01:00.0-1.4.4.2, CDC Ethernet Device, 00:1e:10:1f:00:00
Sep 23 10:51:31 sim-robot-office-pi-1 kernel: usbcore: registered new interface driver cdc_ether

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

Re: E3372h-320 (update 2020 version of E3372) automatically switches itself into ethernet mode

Post by LOM » 23 Sep 2020, 15:32

An auto-switching Huawei modem like ZTE does for some of their modems, it would be the first for Huawei but it is not impossible.
Ethernet mode is not for MS Windows which only speaks NDIS or MBIM, and it is not for linux which has better protocols like NCM, MBIM, and QMI.
It is for Apple Mac which only speaks ethernet and nothing else.

I assume that the initial mode 12d1:1f01 has got a second configuration containing an MBIM config which can be manually selected but when the dongle is inserted in an MS Windows computer then it will be selected automatically, otherwise this would be a modem only intended for Apple Mac.
A verbose lsusb listing of 12d1:1f01 will show if there is a second configuration.

davidshepherd7
Posts: 3
Joined: 22 Sep 2020, 16:25

Re: E3372h-320 (update 2020 version of E3372) automatically switches itself into ethernet mode

Post by davidshepherd7 » 23 Sep 2020, 16:16

Oh, I'm probably wrong then. I saw some devices with "ethernet networking" as their subclass and assumed that it was actually using ethernet.


Here's lsusb for 1f01:

Code: Select all

Bus 001 Device 006: ID 12d1:1f01 Huawei Technologies Co., Ltd. E353/E3131 (Mass storage mode)
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x12d1 Huawei Technologies Co., Ltd.
  idProduct          0x1f01 E353/E3131 (Mass storage mode)
  bcdDevice            1.02
  iManufacturer           1 HUAWEI_MOBILE
  iProduct                2 HUAWEI_MOBILE
  iSerial                 3 0123456789ABCDEF
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              4 Mass Storage
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 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     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               1
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0001
  Self Powered


And for completeness here's lsusb for 14db (the mode that it switches into automatically)

Code: Select all

Bus 001 Device 007: ID 12d1:14db Huawei Technologies Co., Ltd. E353/E3131
Couldn't open device, some information will be missing
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 
  iProduct                2 
  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 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass      6 Ethernet Networking
      bInterfaceProtocol      0 
      iInterface              5 
      CDC Header:
        bcdCDC               1.10
      CDC Union:
        bMasterInterface        0
        bSlaveInterface         1 
      CDC Ethernet:
        iMacAddress                      7 (??)
        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 
      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
and for 155e (the one that can be reached by sending it "55534243123456780000000000000011063000000100010000000000000000" when it's in 1f01:

Code: Select all

Bus 001 Device 007: ID 12d1:155e Huawei Technologies Co., Ltd. 
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          0x155e 
  bcdDevice            1.02
  iManufacturer           1 HUAWEI_MOBILE
  iProduct                2 HUAWEI_MOBILE
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          189
    bNumInterfaces          5
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      2 
      bInterfaceProtocol      1 
      iInterface              0 
      ** UNRECOGNIZED:  05 24 00 10 01
      ** UNRECOGNIZED:  04 24 02 02
      ** UNRECOGNIZED:  05 24 01 00 00
      ** UNRECOGNIZED:  05 24 06 00 00
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x000a  1x 10 bytes
        bInterval               9
      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
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      2 
      bInterfaceProtocol      3 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 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     0x03  EP 3 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      2 
      bInterfaceProtocol      2 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x85  EP 5 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     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         3
      bInterfaceCount         2
      bFunctionClass          2 Communications
      bFunctionSubClass      13 
      bFunctionProtocol       0 
      iFunction              11 CDC NCM
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass     13 
      bInterfaceProtocol      0 
      iInterface              8 NCM Network Control Model
      CDC Header:
        bcdCDC               1.10
      CDC Union:
        bMasterInterface        3
        bSlaveInterface         4 
      CDC Ethernet:
        iMacAddress                     10 001e101f0000
        bmEthernetStatistics    0x00000000
        wMaxSegmentSize               1514
        wNumberMCFilters            0x0000
        bNumberPowerFilters              0
      CDC NCM:
        bcdNcmVersion        1.00
        bmNetworkCapabilities 0x1f
          crc mode
          max datagram size
          encapsulated commands
          net address
          packet filter
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x87  EP 7 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        4
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      1 
      iInterface              9 CDC Network Data
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        4
      bAlternateSetting       1
      bNumEndpoints           2
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      1 
      iInterface              9 CDC Network Data
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x86  EP 6 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     0x05  EP 5 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
Device Status:     0x0001
  Self Powered
Am I right in my assumption that only 155e has a serial interface accepting AT commands?

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

Re: E3372h-320 (update 2020 version of E3372) automatically switches itself into ethernet mode

Post by LOM » 24 Sep 2020, 17:36

davidshepherd7 wrote: 23 Sep 2020, 16:16 Oh, I'm probably wrong then. I saw some devices with "ethernet networking" as their subclass and assumed that it was actually using ethernet.
Yes they are using the ethernet protocol which doesn't have a cmd language so it is not a good protocol for modems.
davidshepherd7 wrote: 23 Sep 2020, 16:16 Am I right in my assumption that only 155e has a serial interface accepting AT commands?
The 3 first interfaces are serial ones, first one is modem and second one is for AT-cmds.

There is something in your log that shouldn't be there:

Code: Select all

Sep 23 10:51:30 sim-robot-office-pi-1 kernel: usb 1-1.4.4.2: reset high-speed USB device number 6 using xhci_hcd
and that is likely caused by usb storage transaction errors.

Does the modem behave in same way in a desktop linux system?

davidshepherd7
Posts: 3
Joined: 22 Sep 2020, 16:25

Re: E3372h-320 (update 2020 version of E3372) automatically switches itself into ethernet mode

Post by davidshepherd7 » 24 Sep 2020, 17:47

Does the modem behave in same way in a desktop linux system?
Unfortunately I only have remote access to these modems so I can't check. All of my experiments were on Ubuntu 18.04 server, I've tried with both a raspberry pi and a normal tower server.

ValdikSS
Posts: 4
Joined: 12 Apr 2021, 22:53

Re: E3372h-320 (update 2020 version of E3372) automatically switches itself into ethernet mode

Post by ValdikSS » 12 Apr 2021, 23:08

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

softice
Posts: 6
Joined: 15 Dec 2018, 19:37

Re: E3372h-320 (update 2020 version of E3372) automatically switches itself into ethernet mode

Post by softice » 13 Apr 2021, 17:05

ValdikSS wrote: 12 Apr 2021, 23:08

Code: Select all

options usb-storage quirks=12d1:1f01:s
Hi ValdikSS,
I have the module baked into the kernel on an embedded device, I tried to achieve the same with

Code: Select all

echo "12d1:1f01:s" > /sys/module/usb_storage/parameters/quirks
which works in principal:

Code: Select all

usb 2-1: new high-speed USB device number 4 using ci_hdrc
usb-storage 2-1:1.0: Quirks match for vid 12d1 pid 1f01: 1
scsi1 : usb-storage 2-1:1.0
However, the CDC Ethernet device only gets detected for a second when running usb_modeswitch with huawei-new-mode: it does detect "eth1", but then gets unregistered immediately and switches back to CD-ROM mode (usb-storage), which I don't want:

Code: Select all

usb 2-1: USB disconnect, device number 8
usb 2-1: new high-speed USB device number 9 using ci_hdrc
cdc_ether 2-1:1.0: eth1: register 'cdc_ether' at usb-ci_hdrc.0-1, CDC Ethernet Device, 00:1e:10:1f:00:00
usb 2-1: USB disconnect, device number 9
cdc_ether 2-1:1.0: eth1: unregister 'cdc_ether' usb-ci_hdrc.0-1, CDC Ethernet Device
usb 2-1: new high-speed USB device number 10 using ci_hdrc
usb-storage 2-1:1.0: Quirks match for vid 12d1 pid 1f01: 1
scsi5 : usb-storage 2-1:1.0
Any idea how I can force it to stay in CDC Ethernet mode?

Thanks,
softice

ValdikSS
Posts: 4
Joined: 12 Apr 2021, 22:53

Re: E3372h-320 (update 2020 version of E3372) automatically switches itself into ethernet mode

Post by ValdikSS » 14 Apr 2021, 08:37

softice wrote: 13 Apr 2021, 17:05However, the CDC Ethernet device only gets detected for a second when running usb_modeswitch with huawei-new-mode: it does detect "eth1", but then gets unregistered immediately and switches back to CD-ROM mode (usb-storage), which I don't want
What happens if you don't do anything (don't add quirks and don't use usb_modeswitch)? On newer E3372-320, you'll get CDC Ethernet as you want.

softice
Posts: 6
Joined: 15 Dec 2018, 19:37

Re: E3372h-320 (update 2020 version of E3372) automatically switches itself into ethernet mode

Post by softice » 14 Apr 2021, 14:39

no, it will switch endlessly between CDC Ethernet and storage:

Code: Select all

[  101.968299] scsi2 : usb-storage 2-1:1.0
[  102.963321] usb 2-1: USB disconnect, device number 6
[  103.552279] usb 2-1: new high-speed USB device number 7 using ci_hdrc
[  103.788812] cdc_ether 2-1:1.0: eth1: register 'cdc_ether' at usb-ci_hdrc.0-1, CDC Ethernet Device, 00:1e:10:1f:00:00
[  105.969972] usb 2-1: USB disconnect, device number 7
[  105.970229] cdc_ether 2-1:1.0: eth1: unregister 'cdc_ether' usb-ci_hdrc.0-1, CDC Ethernet Device
[  106.562241] usb 2-1: new high-speed USB device number 8 using ci_hdrc
[  106.715249] scsi3 : usb-storage 2-1:1.0
[  107.712902] usb 2-1: USB disconnect, device number 8
[  108.362238] usb 2-1: new high-speed USB device number 9 using ci_hdrc
[  108.598722] cdc_ether 2-1:1.0: eth1: register 'cdc_ether' at usb-ci_hdrc.0-1, CDC Ethernet Device, 00:1e:10:1f:00:00
[  110.717748] usb 2-1: USB disconnect, device number 9
[  110.718776] cdc_ether 2-1:1.0: eth1: unregister 'cdc_ether' usb-ci_hdrc.0-1, CDC Ethernet Device
[  111.132189] usb 2-1: new high-speed USB device number 10 using ci_hdrc
[  111.304533] scsi4 : usb-storage 2-1:1.0
[  112.303473] usb 2-1: USB disconnect, device number 10
[  112.782212] usb 2-1: new high-speed USB device number 11 using ci_hdrc
[  113.020128] cdc_ether 2-1:1.0: eth1: register 'cdc_ether' at usb-ci_hdrc.0-1, CDC Ethernet Device, 00:1e:10:1f:00:00
[  115.307654] usb 2-1: USB disconnect, device number 11
etc.

I believe this is related to the very old kernel of the embedded device (3.4.11) as I found similar posts (e.g. here: https://forum.mikrotik.com/viewtopic.php?t=162232) where a kernel update fixed it. Or disabling module usb-storage.
Both unfortunately is not an option for me.

Thanks :)

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

Re: E3372h-320 (update 2020 version of E3372) automatically switches itself into ethernet mode

Post by Josh » 17 Apr 2021, 14:16

This problem may also be power-supply-related.

If the USB power is not reliable, a modem may reset itself just when it draws more power while starting transmission (connecting to the cell network).
It is known to have happened on older Raspberry Pis and on mobile devices (e.g. Android phones via the OTG port).

You can test if this is the case by using a powered hub between modem and host.

softice
Posts: 6
Joined: 15 Dec 2018, 19:37

Re: E3372h-320 (update 2020 version of E3372) automatically switches itself into ethernet mode

Post by softice » 22 Apr 2021, 05:01

Thanks for the hint Josh. Unfortunately no, I just tried with an externally powered USB hub, same behaviour as above... :(

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

Re: E3372h-320 (update 2020 version of E3372) automatically switches itself into ethernet mode

Post by LOM » 22 Apr 2021, 07:29

Then try it on a desktop computer running Windows or linux, this will tell if the dongle is faulty.

I guess as you have done that it is related to the very old and obsolete kernel you are running, the quality of the chipidea host controller driver was poor at that time.
It may help if you can force the controller into host mode only, it looks to me that it is in dual role mode (the 0-1 in usb-ci_hdrc.0-1) so the drop you see may
be the controller erroneously switching between being host and being device.

ykl
Posts: 2
Joined: 25 May 2021, 12:14

Re: E3372h-320 (update 2020 version of E3372) automatically switches itself into ethernet mode

Post by ykl » 25 May 2021, 12:20

Hi softice,
have the same issue of endless switching between CDC Ether and usb storage on my embedded kernel 2.6.21 for the E3372h-320, while E3372h-153 worked fine.
Did you manage to find something to prevent it yet ?

Cheers.

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

Re: E3372h-320 (update 2020 version of E3372) automatically switches itself into ethernet mode

Post by Josh » 30 May 2021, 11:35

ValdikSS wrote: 12 Apr 2021, 23:08 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.
I have purchased an E3372h-320 and an E8372. Both are showing the same behaviour on my system, regardless which Linux distro is used:
- Mageia, kernel 5.10.37
- Ubuntu, kernel 5.8.0
- Fedora, kernel 5.11.17

I don't see any auto-switching. All I get is "medium errors" from the storage device, regardless of the quirk being active or not.
I tried both USB 2.0 and 3.0 ports.

With usb_modeswitch active and doing its job, I don't see any errors. It works as intended.

ykl
Posts: 2
Joined: 25 May 2021, 12:14

Re: E3372h-320 (update 2020 version of E3372) automatically switches itself into ethernet mode

Post by ykl » 30 May 2021, 19:20

Josh wrote: 30 May 2021, 11:35
ValdikSS wrote: 12 Apr 2021, 23:08 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.
I have purchased an E3372h-320 and an E8372. Both are showing the same behaviour on my system, regardless which Linux distro is used:
- Mageia, kernel 5.10.37
- Ubuntu, kernel 5.8.0
- Fedora, kernel 5.11.17

I don't see any auto-switching. All I get is "medium errors" from the storage device, regardless of the quirk being active or not.
I tried both USB 2.0 and 3.0 ports.

With usb_modeswitch active and doing its job, I don't see any errors. It works as intended.
Hey Josh,
I can confirm same E3372h-320 on Ubuntu 16.04 kernel 4.15.0-142, stays stable at cdc-ether (0x12d1/0x14db) after switching from storage (0x12d1/0x1f01) however I have eliminated usb_modeswitch action, and verified it stays down, and I see switching happens automatically. This is oppose to the E3372h-153 which stays stable on storage (0x12d1/0x1f01) if usb_modeswitch doesn't take place. It has to do then with a new behavior this firmware introduces and the endless loops - to my old 2.6 embedded kernel which doesn't know how to handle it correctly.

Post Reply