Hello,

OpenBSD 6.0 amd64

Device detected as umass (before "mode switch"), umsm and ugen (after).

After some manipulations with vendors/interfaces/protocols (on OpenBSD), device is detected as cdce0, but dhclient is failed.

Serial ports (AT command ports) are detected and works fine.
AT^NDISDUP=1,1,"internet" is OK.


Manipulations:

--- /sys/dev/usb/usbdevs.orig   Tue Oct  4 23:08:41 2016
+++ /sys/dev/usb/usbdevs        Tue Oct  4 23:09:16 2016
@@ -2212,6 +2212,7 @@
 product HUAWEI E173S           0x1c05  HUAWEI Mobile E173s
 product HUAWEI E173S_INIT      0x1c0b  HUAWEI Mobile E173s Initial
 product HUAWEI E303            0x1f01  HUAWEI Mobile E303
+product HUAWEI HWM             0x1506  HUAWEI Mobile Modems

 /* HUMAX products */
 product HUMAX PVRSMART         0x138c  PVR-SMART
--- /sys/dev/usb/umsm.c.orig    Tue Oct  4 23:10:47 2016
+++ /sys/dev/usb/umsm.c Tue Oct  4 23:54:20 2016
@@ -266,6 +266,8 @@
        {{ USB_VENDOR_CMOTECH, USB_PRODUCT_CMOTECH_CGU628 }, DEV_UMASS1},
        {{ USB_VENDOR_CMOTECH, USB_PRODUCT_CMOTECH_CGU628_DISK }, 0},
        {{ USB_VENDOR_CMOTECH, USB_PRODUCT_CMOTECH_CNU680 }, DEV_UMASS1},
+
+       {{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_HWM }, 0},
 };

#define umsm_lookup(v, p) ((const struct umsm_type *)usb_lookup(umsm_devs, v, p))
@@ -323,6 +325,17 @@
                              id->bInterfaceProtocol == 0x01) ||
                             (id->bInterfaceSubClass == 0x00 &&
                              id->bInterfaceProtocol == 0x00)))) {
+                       return UMATCH_NONE;
+               } else if ((uaa->vendor == USB_VENDOR_HUAWEI &&
+                           uaa->product == USB_PRODUCT_HUAWEI_HWM) &&
+                          !(id->bInterfaceClass == UICLASS_VENDOR &&
+                           (id->bInterfaceSubClass == 0x02 ||
+                            id->bInterfaceSubClass == 0x03) &&
+                           (id->bInterfaceProtocol == 0x01 ||
+                            id->bInterfaceProtocol == 0x05 ||
+                            id->bInterfaceProtocol == 0x0a ||
+                            id->bInterfaceProtocol == 0x10 ||
+                            id->bInterfaceProtocol == 0x12))) {
                        return UMATCH_NONE;
                } else
                        return UMATCH_VENDOR_IFACESUBCLASS;
--- /sys/dev/usb/if_cdce.c.orig Tue Oct  4 23:47:27 2016
+++ /sys/dev/usb/if_cdce.c      Wed Oct  5 00:53:44 2016
@@ -141,6 +141,16 @@
            UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL ||
            id->bInterfaceSubClass == UISUBCLASS_MOBILE_DIRECT_LINE_MODEL))
                return (UMATCH_IFACECLASS_GENERIC);
+
+       if (uaa->vendor == USB_VENDOR_HUAWEI &&
+           uaa->product == USB_PRODUCT_HUAWEI_HWM &&
+           id->bInterfaceClass == UICLASS_VENDOR &&
+          (id->bInterfaceSubClass == 0x02 ||
+           id->bInterfaceSubClass == 0x03) &&
+          (id->bInterfaceProtocol == 0x16 ||
+           id->bInterfaceProtocol == 0x46 ||
+           id->bInterfaceProtocol == 0x76))
+               return (UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO);

        return (UMATCH_NONE);
 }



On FreeBSD, after manipulations like this, the device is detected as cdce0 & ue0: <USB Ethernet> on cdce0
dhclient ue0 works fine.

My research in the source code has revealed some differences in if_cdce.c file

https://github.com/freebsd/freebsd/blob/master/sys/dev/usb/net/if_cdce.c
FreeBSD version has many lines of code grouped by CDCE_HAVE_NCM option:

#if CDCE_HAVE_NCM
static usb_callback_t cdce_ncm_bulk_write_callback;
static usb_callback_t cdce_ncm_bulk_read_callback;
#endif
and many more like this

If I got it right, in Linux the same function is performed this way:
cdc_ncm
http://lxr.free-electrons.com/source/drivers/net/usb/cdc_ncm.c?v=3.13
or this way:
huawei_cdc_ncm
http://lxr.free-electrons.com/source/drivers/net/usb/huawei_cdc_ncm.c?v=3.13

I read http://openbsd-archive.7691.n7.nabble.com/Driver-Request-Huawei-MU609-Cellular-Modem-td269924.html
It’s seems to be the same problem here.

I know about "ppp" mode (AT+CGDCONT=1,....),
device works properly by this way, but the speed (in comparison to FreeBSD/Ubuntu AT^NDISDUP mode) decreased by ~30% and latency decreased by ~20%.

It would be great if a nice developer could add support for this kind of devices.

Probably, E3272, E3276 and many other Huawei devices are the same...

Regards,

Youri


dmesg before modifications:

umsm0 at uhub0 port 2 configuration 1 interface 0 "HUAWEI_MOBILE HUAWEI_MOBILE" rev 2.10/1.02 addr 2
umsm0 detached
umass0 at uhub0 port 2 configuration 1 interface 3 "HUAWEI_MOBILE HUAWEI_MOBILE" rev 2.10/1.02 addr 2
umass0: using SCSI over Bulk-Only
scsibus2 at umass0: 2 targets, initiator 0
cd0 at scsibus2 targ 1 lun 0: <HUAWEI, Mass Storage, 2.31> SCSI2 5/cdrom removable umass1 at uhub0 port 2 configuration 1 interface 4 "HUAWEI_MOBILE HUAWEI_MOBILE" rev 2.10/1.02 addr 2
umass1: using SCSI over Bulk-Only
scsibus3 at umass1: 2 targets, initiator 0
sd2 at scsibus3 targ 1 lun 0: <HUAWEI, TF CARD Storage, 2.31> SCSI2 0/direct removable ugen0 at uhub0 port 2 configuration 1 "HUAWEI_MOBILE HUAWEI_MOBILE" rev 2.10/1.02 addr 2



dmesg after modifications:

umsm0 at uhub0 port 2 configuration 1 interface 0 "HUAWEI_MOBILE HUAWEI_MOBILE" rev 2.10/1.02 addr 2
umsm0 detached
umsm0 at uhub0 port 2 configuration 1 interface 0 "HUAWEI_MOBILE HUAWEI_MOBILE" rev 2.10/1.02 addr 2
ucom0 at umsm0
umsm1 at uhub0 port 2 configuration 1 interface 1 "HUAWEI_MOBILE HUAWEI_MOBILE" rev 2.10/1.02 addr 2
ucom1 at umsm1
cdce0 at uhub0 port 2 configuration 1 interface 2 "HUAWEI_MOBILE HUAWEI_MOBILE" rev 2.10/1.02 addr 2
cdce0: address 00:1e:10:1f:00:00
umass0 at uhub0 port 2 configuration 1 interface 3 "HUAWEI_MOBILE HUAWEI_MOBILE" rev 2.10/1.02 addr 2
umass0: using SCSI over Bulk-Only
scsibus2 at umass0: 2 targets, initiator 0
cd0 at scsibus2 targ 1 lun 0: <HUAWEI, Mass Storage, 2.31> SCSI2 5/cdrom removable umass1 at uhub0 port 2 configuration 1 interface 4 "HUAWEI_MOBILE HUAWEI_MOBILE" rev 2.10/1.02 addr 2
umass1: using SCSI over Bulk-Only
scsibus3 at umass1: 2 targets, initiator 0
sd2 at scsibus3 targ 1 lun 0: <HUAWEI, TF CARD Storage, 2.31> SCSI2 0/direct removable




at first access to /dev/cuaU1 this king of messages appear in dmesg, but /dev/cuaU1 works fine:

umsm1: this device is not using CDC notify message in intr pipe.
Please send your dmesg to <b...@openbsd.org>, thanks.
umsm1: intr buffer 0xc1 0x1 0x3 0x0 0x1 0x0 0x0



lsusb:

Bus 000 Device 002: ID 12d1:1506 Huawei Technologies Co., Ltd. E398 LTE/UMTS/GSM Modem/Networkcard
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x12d1 Huawei Technologies Co., Ltd.
  idProduct          0x1506 E398 LTE/UMTS/GSM Modem/Networkcard
  bcdDevice            1.02
  iManufacturer           1 HUAWEI_MOBILE
  iProduct                2 HUAWEI_MOBILE
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          221
    bNumInterfaces          5
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      3
      bInterfaceProtocol     18
      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     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           3
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      3
      bInterfaceProtocol      1
      iInterface              0
      ** UNRECOGNIZED:  05 24 00 10 01
      ** UNRECOGNIZED:  04 24 02 02
      ** UNRECOGNIZED:  05 24 01 00 01
      ** UNRECOGNIZED:  05 24 06 00 00
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 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     0x83  EP 3 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           1
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      3
      bInterfaceProtocol     22
      iInterface              8 NCM Network Control Model
      ** UNRECOGNIZED:  05 24 00 10 01
      ** UNRECOGNIZED:  06 24 1a 00 01 1f
      ** UNRECOGNIZED:  0d 24 0f 0a 0f 00 00 00 ea 05 03 00 01
      ** UNRECOGNIZED:  05 24 06 02 02
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x86  EP 6 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        2
      bAlternateSetting       1
      bNumEndpoints           3
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass      3
      bInterfaceProtocol     22
      iInterface              9 CDC Network Data
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x86  EP 6 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               5
      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 Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      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     0x87  EP 7 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               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        4
      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     0x88  EP 8 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     0x06  EP 6 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               1
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
    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   1
      Lowest fully-functional device speed is Full Speed (12Mbps)
    bU1DevExitLat           1 micro seconds
    bU2DevExitLat         500 micro seconds
Device Status:     0x0001
  Self Powered

Reply via email to