Author Message

<  Setup Discussion  ~  Huawei K5160

PostPosted: Mon Feb 15, 2016 11:45 pm Reply with quote
Posts: 13 Joined: Mon Feb 15, 2016 11:35 pm
Hi,

I am using Huawei K5160 (aka Vodafone K5160) modem.

I have usb_modeswitch installed, but when I have enabled autoswitching, it's not working and ID of modem in lsusb is still the same:

Code:
[root@arch ~]# lsusb
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0c45:64ce Microdia
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 010: ID 12d1:1f1e Huawei Technologies Co., Ltd.
Bus 003 Device 002: ID 0bda:0153 Realtek Semiconductor Corp. Mass Storage Device
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[root@arch ~]# usb_modeswitch -W -v 12d1 -p 1f1e -J
Take all parameters from the command line


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

 ! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor=  0x12d1
DefaultProduct= 0x1f1e
HuaweiNewMode=1

Look for default devices ...
  found USB ID 8087:0024
  found USB ID 1d6b:0002
  found USB ID 0c45:64ce
  found USB ID 8087:0024
  found USB ID 1d6b:0002
  found USB ID 1d6b:0003
  found USB ID 12d1:1f1e
   vendor ID matched
   product ID matched
  found USB ID 0bda:0153
  found USB ID 1d6b:0002
 Found devices in default mode (1)
Access device 010 on bus 003
Get the current device configuration ...
Current configuration number is 2
Use interface number 0
Error: message endpoint not given or found. Abort

[root@arch ~]# lsusb
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0c45:64ce Microdia
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 010: ID 12d1:1f1e Huawei Technologies Co., Ltd.
Bus 003 Device 002: ID 0bda:0153 Realtek Semiconductor Corp. Mass Storage Device
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub


But when I disable autoswitching, and plug modem, and run following command, it change ID as should:

Code:
[root@arch ~]# lsusb
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0c45:64ce Microdia
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 010: ID 12d1:1f1e Huawei Technologies Co., Ltd.
Bus 003 Device 002: ID 0bda:0153 Realtek Semiconductor Corp. Mass Storage Device
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[root@arch ~]# usb_modeswitch -W -v 12d1 -p 1f1e -J
Take all parameters from the command line


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

 ! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor=  0x12d1
DefaultProduct= 0x1f1e
HuaweiNewMode=1

Look for default devices ...
  found USB ID 8087:0024
  found USB ID 1d6b:0002
  found USB ID 0c45:64ce
  found USB ID 8087:0024
  found USB ID 1d6b:0002
  found USB ID 1d6b:0003
  found USB ID 12d1:1f1e
   vendor ID matched
   product ID matched
  found USB ID 0bda:0153
  found USB ID 1d6b:0002
 Found devices in default mode (1)
Access device 008 on bus 003
Get the current device configuration ...
Current configuration number is 1
Use interface number 0
Use endpoints 0x01 (out) and 0x81 (in)

USB description data (for identification)
-------------------------
Manufacturer: Vodafone (Huawei)
     Product: Vodafone (Huawei)
  Serial No.: 0123456789ABCDEF
-------------------------
Using standard Huawei switching message
Looking for active driver ...
 OK, driver detached
Set up interface 0
Use endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
 OK, message successfully sent
Read the response to message 1 (CSW) ...
 Response reading failed (error -1)
 Device is gone, skip any further commands
-> Run lsusb to note any changes. Bye!

[root@arch ~]# lsusb
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0c45:64ce Microdia
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 009: ID 12d1:157f Huawei Technologies Co., Ltd.
Bus 003 Device 002: ID 0bda:0153 Realtek Semiconductor Corp. Mass Storage Device
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub


Any ideas what can be wrong?

PS: there is file for this USB ID, but I am not sure why it doesnt apply..

Code:
[root@arch ~]# cat /usr/share/usb_modeswitch/12d1\:1f1e
# Vodafone / Huawei Kxxxx
TargetVendor=0x12d1
TargetProductList="157f,1592"
HuaweiNewMode=1


Offline
PostPosted: Tue Feb 16, 2016 1:36 am Reply with quote
Posts: 1175 Joined: Wed Jul 11, 2012 3:14 pm Location: Koh Samui, TH
hippo_arch wrote:

I have usb_modeswitch installed, but when I have enabled autoswitching, it's not working and ID of modem in lsusb is still the same:



12d1:1f1e can retain the same id after usb_modeswitch because it has dual configs and usb_modeswitch will select config #2 if your system has cdc_mbim drivers installed.
The device will only be switched to a new usb id when the system does not have cdc_mbim drivers.
See your dmesg for what happens!
A recent version of NetworkManager (+ ModemManager plugin) should handle the direct ethernet interface being created by cdc_mbim/cdc_ncm.

This is a new device so I would very much appreciate if you could paste the output from lsusb -v -d 12d1:1f1e and also from 12d1:157f after having manually switched the device.


Offline
PostPosted: Tue Feb 16, 2016 9:19 am Reply with quote
Posts: 13 Joined: Mon Feb 15, 2016 11:35 pm
LOM wrote:
12d1:1f1e can retain the same id after usb_modeswitch because it has dual configs and usb_modeswitch will select config #2 if your system has cdc_mbim drivers installed.
The device will only be switched to a new usb id when the system does not have cdc_mbim drivers.
See your dmesg for what happens!
A recent version of NetworkManager (+ ModemManager plugin) should handle the direct ethernet interface being created by cdc_mbim/cdc_ncm.


Yeah, if automatic switch happens, then network manager see it as real modem, but when I connect, I get IP and everything, but I am not able to ping internet (I found that lot of people has same problem on arch forums around different modemds), but I didnt find where can be a problem :/

If there is manual switch, modem shows as eth device and everything is working as should :)

LOM wrote:
This is a new device so I would very much appreciate if you could paste the output from lsusb -v -d 12d1:1f1e and also from 12d1:157f after having manually switched the device.


Of course! Here is an output, I am going to have device for 20 days or something like that, so let me know if you want something more :)

Code:
[root@arch ~]# lsusb -v -d 12d1:1f1e

Bus 003 Device 012: ID 12d1:1f1e Huawei Technologies Co., Ltd.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.10
  bDeviceClass            0
  bDeviceSubClass         0
  bDeviceProtocol       255
  bMaxPacketSize0        64
  idVendor           0x12d1 Huawei Technologies Co., Ltd.
  idProduct          0x1f1e
  bcdDevice            1.02
  iManufacturer           1 Vodafone (Huawei)
  iProduct                2 Vodafone (Huawei)
  iSerial                 3 0123456789ABCDEF
  bNumConfigurations      2
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    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
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          118
    bNumInterfaces          3
    bConfigurationValue     2
    iConfiguration          0
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower                2mA
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         0
      bInterfaceCount         2
      bFunctionClass          2 Communications
      bFunctionSubClass      14
      bFunctionProtocol       0
      iFunction               8 K5160
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass     14
      bInterfaceProtocol      0
      iInterface              5 NCM Network Control Model
      CDC Header:
        bcdCDC               1.10
      CDC MBIM:
        bcdMBIMVersion       1.00
        wMaxControlMessage   1024
        bNumberFilters       32
        bMaxFilterSize       128
        wMaxSegmentSize      1500
        bmNetworkCapabilities 0x20
          8-byte ntb input size
      CDC MBIM Extended:
        bcdMBIMExtendedVersion           1.00
        bMaxOutstandingCommandMessages     16
        wMTU                             1500
      CDC Union:
        bMasterInterface        0
        bSlaveInterface         1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 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
      bInterfaceProtocol      2
      iInterface              6 CDC Network Data
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           2
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0
      bInterfaceProtocol      2
      iInterface              6 CDC Network Data
      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               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      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     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     0x02  EP 2 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
      HIRD 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
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x0001
  Self Powered


And device after switch:

Code:
[root@arch ~]# lsusb -v -d 12d1:157f

Bus 003 Device 013: ID 12d1:157f Huawei Technologies Co., Ltd.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.10
  bDeviceClass            2 Communications
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x12d1 Huawei Technologies Co., Ltd.
  idProduct          0x157f
  bcdDevice            1.02
  iManufacturer           1 Vodafone (Huawei)
  iProduct                2 Vodafone (Huawei)
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           94
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass      6 Ethernet Networking
      bInterfaceProtocol      0
      iInterface              9 CDC Ethernet Control Model (ECM)
      CDC Header:
        bcdCDC               1.10
      CDC Union:
        bMasterInterface        0
        bSlaveInterface         1
      CDC Ethernet:
        iMacAddress                     11 0C5B8F279A64
        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           2
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      6
      bInterfaceProtocol      0
      iInterface             10 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
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      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     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               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
      HIRD 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
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x0001
  Self Powered


Offline
PostPosted: Tue Feb 16, 2016 10:35 am Reply with quote
Posts: 1175 Joined: Wed Jul 11, 2012 3:14 pm Location: Koh Samui, TH
Thanks for the lsusb listings, they are now in my collection.. :)

hippo_arch wrote:

Yeah, if automatic switch happens, then network manager see it as real modem, but when I connect, I get IP and everything, but I am not able to ping internet (I found that lot of people has same problem on arch forums around different modemds), but I didnt find where can be a problem :/

If there is manual switch, modem shows as eth device and everything is working as should :)



You need to run one of the very latest kernels, an important mbim patch got into linux around mid December last year. Your symptoms matches what happens without that patch.

If you want to disable usb_modeswitch automatic selection of how to switch then you can do that by changing the DisableMBIMGlobal setting in /etc/usb_modeswitch.conf


Offline
PostPosted: Tue Feb 16, 2016 10:59 am Reply with quote
Posts: 13 Joined: Mon Feb 15, 2016 11:35 pm
LOM wrote:
need to run one of the very latest kernels, an important mbim patch got into linux around mid December last year. Your symptoms matches what happens without that patch.

If you want to disable usb_modeswitch automatic selection of how to switch then you can do that by changing the DisableMBIMGlobal setting in /etc/usb_modeswitch.conf


Do you know version of kernel?
I am on Archlinux and that is using almost bleeding edge - now on Linux arch 4.4.1-2-ARCH #1 SMP PREEMPT Wed Feb 3 13:12:33 UTC 2016 x86_64 GNU/Linux

I will try DisableMBIMGlobal at evening / afternoon and test it :)


Offline
PostPosted: Tue Feb 16, 2016 12:33 pm Reply with quote
Posts: 1175 Joined: Wed Jul 11, 2012 3:14 pm Location: Koh Samui, TH
The latest mbim patch which is the one I thought of entered in 4.3.4 and therefore also in 4.4, but it may not be related to your problem..
cdc_mbim: "add "NDP to end" quirk for Huawei E3372" is the patch description.

Hold on, I'll see if we can get an mbim expert over here.


Offline
PostPosted: Tue Feb 16, 2016 12:45 pm Reply with quote
Posts: 13 Joined: Mon Feb 15, 2016 11:35 pm
When I did change in /etc/usb_modeswitch.conf to DisableMBIMGlobal=1 then it works (adapter is in system as ethernet)


Offline
PostPosted: Tue Feb 16, 2016 1:05 pm Reply with quote
Posts: 1175 Joined: Wed Jul 11, 2012 3:14 pm Location: Koh Samui, TH
hippo_arch wrote:
When I did change in /etc/usb_modeswitch.conf to DisableMBIMGlobal=1 then it works (adapter is in system as ethernet)


Yes it will have the same effect as your manual modeswitch cmd but you don't want it as cdc_ether with mfgr proprietary cmds (usually via a built in web server at the dongles ip address) you want cdc_mbim with a standardised command set.

cdc_ether mode is Windows7/XP fallback mode, cdc_mbim is Win8 and up, linux can both do modes.


Offline
PostPosted: Tue Feb 16, 2016 1:08 pm Reply with quote
Posts: 166 Joined: Thu Mar 15, 2012 10:47 pm Location: Oslo, Norway
hippo_arch wrote:
LOM wrote:
need to run one of the very latest kernels, an important mbim patch got into linux around mid December last year. Your symptoms matches what happens without that patch.

If you want to disable usb_modeswitch automatic selection of how to switch then you can do that by changing the DisableMBIMGlobal setting in /etc/usb_modeswitch.conf


Do you know version of kernel?
I am on Archlinux and that is using almost bleeding edge - now on Linux arch 4.4.1-2-ARCH #1 SMP PREEMPT Wed Feb 3 13:12:33 UTC 2016 x86_64 GNU/Linux

I will try DisableMBIMGlobal at evening / afternoon and test it :)


The fix in question is in 4.4, but it is specific to the 12d1:157d device ID (from an E3372) where we observed the problem. The workaround is not perfect, and we don't really know how it will affect multiplexed IP sessions (i.e. connecting to more than one APN at a time). So, since most Huawei devices have so far been known to work without it, I decided to apply it per device initially.

Your report might change that if it turns out that the same quirk is needed for yet another Huawei device ID.

But let's find out if the quirk helps first. Unfortunately that means either patching the driver, or running an even newer kernel. I added a knob to allow you to change the driver behaviour without patching, but it is not in v4.4. It will be in v4.5. So if you upgrade to a v4.5-rcX then you use the ndp_to_end sysfs attribute to enable the quirk temporarily for a quick test:

Code:
 nemi:/tmp# ls -l /sys/class/net/wwan2/cdc_ncm/ndp_to_end
-rw-r--r-- 1 root root 4096 Feb 16 12:01 /sys/class/net/wwan2/cdc_ncm/ndp_to_end
nemi:/tmp# grep . /sys/class/net/wwan2/cdc_ncm/ndp_to_end
N
nemi:/tmp# echo Y  >/sys/class/net/wwan2/cdc_ncm/ndp_to_end
nemi:/tmp# grep . /sys/class/net/wwan2/cdc_ncm/ndp_to_end
Y


If you want to build a new version of the driver instead, then you need to add something like this to the mbim_devs table:
Code:
       { USB_DEVICE_AND_INTERFACE_INFO(0x12d1, 0x1f1e, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),
         .driver_info = (unsigned long)&cdc_mbim_info_ndp_to_end,
       },


Please let us know if either of these methods work for you. I believe that will be reason enough to apply this quirk to all Huawei devices.


Offline
PostPosted: Wed Feb 17, 2016 12:01 am Reply with quote
Posts: 13 Joined: Mon Feb 15, 2016 11:35 pm
LOM wrote:
Yes it will have the same effect as your manual modeswitch cmd but you don't want it as cdc_ether with mfgr proprietary cmds (usually via a built in web server at the dongles ip address) you want cdc_mbim with a standardised command set.

cdc_ether mode is Windows7/XP fallback mode, cdc_mbim is Win8 and up, linux can both do modes.



Yea, but I get cdc_mbim if I have DisableSwitching=0 and DisableMBIMGlobal=0, and I am able to connect, but ping doesnt work to the internet, so I have no idea why.. and since ethernet is working... :)

Code:
Feb 16 22:57:00 arch kernel: usb 3-2: new high-speed USB device number 4 using xhci_hcd
Feb 16 22:57:00 arch kernel: usb-storage 3-2:1.0: USB Mass Storage device detected
Feb 16 22:57:00 arch kernel: scsi host8: usb-storage 3-2:1.0
Feb 16 22:57:01 arch usb_modeswitch[7314]: switch device 12d1:1f1e on 003/004
Feb 16 22:57:02 arch kernel: usb-storage 3-2:2.2: USB Mass Storage device detected
Feb 16 22:57:02 arch kernel: scsi host9: usb-storage 3-2:2.2
Feb 16 22:57:02 arch kernel: usbcore: registered new interface driver cdc_ncm
Feb 16 22:57:02 arch kernel: usbcore: registered new interface driver cdc_wdm
Feb 16 22:57:03 arch kernel: cdc_mbim 3-2:2.0: setting rx_max = 16384
Feb 16 22:57:03 arch kernel: cdc_mbim 3-2:2.0: cdc-wdm0: USB WDM device
Feb 16 22:57:03 arch kernel: cdc_mbim 3-2:2.0 wwan0: register 'cdc_mbim' at usb-0000:00:14.0-2, CDC MBIM, a6:04:ed:7c:56:f1
Feb 16 22:57:03 arch kernel: usbcore: registered new interface driver cdc_mbim
Feb 16 22:57:03 arch kernel: cdc_mbim 3-2:2.0 wwp0s20u2c2: renamed from wwan0
Feb 16 22:57:03 arch ModemManager[457]: opening device...
Feb 16 22:57:03 arch ModemManager[457]: cannot connect to proxy: Could not connect: Connection refused
Feb 16 22:57:03 arch ModemManager[457]: spawning new mbim-proxy (try 1)...
Feb 16 22:57:03 arch ModemManager[457]: [/dev/cdc-wdm0] Read max control message size from descriptors file: 1024
Feb 16 22:57:03 arch root[7357]: usb_modeswitch: switched to 12d1:1f1e on 003/004
Feb 16 22:57:05 arch ModemManager[457]: <info>  Creating modem with plugin 'Huawei' and '2' ports
Feb 16 22:57:05 arch ModemManager[457]: <info>  Modem for device at '/sys/devices/pci0000:00/0000:00:14.0/usb3/3-2' successfully created
Feb 16 22:57:05 arch ModemManager[457]: opening device...
Feb 16 22:57:05 arch ModemManager[457]: [/dev/cdc-wdm0] Read max control message size from descriptors file: 1024
Feb 16 22:57:06 arch kernel: scsi 9:0:0:0: Direct-Access     HUAWEI   TF CARD Storage  2.31 PQ: 0 ANSI: 2
Feb 16 22:57:06 arch kernel: sd 9:0:0:0: [sdc] Attached SCSI removable disk
Feb 16 22:57:07 arch ModemManager[457]: <info>  Modem: state changed (unknown -> disabled)
Feb 16 22:57:07 arch NetworkManager[453]: <info>  (cdc-wdm0): modem state changed, 'disabled' --> 'enabling' (reason: user preference)
Feb 16 22:57:07 arch NetworkManager[453]: <info>  (cdc-wdm0): new Broadband device (carrier: UNKNOWN, driver: 'cdc_mbim', ifindex: 0)
Feb 16 22:57:07 arch NetworkManager[453]: <info>  (cdc-wdm0): device state change: unmanaged -> unavailable (reason 'managed') [10 20 2]
Feb 16 22:57:07 arch NetworkManager[453]: <info>  (cdc-wdm0): modem state 'enabling'
Feb 16 22:57:07 arch NetworkManager[453]: <info>  (cdc-wdm0): device state change: unavailable -> disconnected (reason 'none') [20 30 0]
Feb 16 22:57:07 arch ModemManager[457]: <info>  Modem /org/freedesktop/ModemManager1/Modem/0: state changed (disabled -> enabling)
Feb 16 22:57:07 arch ModemManager[457]: <info>  Modem /org/freedesktop/ModemManager1/Modem/0: 3GPP Registration state changed (unknown -> registering)
Feb 16 22:57:07 arch ModemManager[457]: <info>  Modem /org/freedesktop/ModemManager1/Modem/0: 3GPP Registration state changed (registering -> home)
Feb 16 22:57:08 arch ModemManager[457]: <info>  Modem /org/freedesktop/ModemManager1/Modem/0: state changed (enabling -> registered)
Feb 16 22:57:08 arch NetworkManager[453]: <info>  (cdc-wdm0): modem state changed, 'enabling' --> 'registered' (reason: user-requested)



bmork wrote:
The fix in question is in 4.4, but it is specific to the 12d1:157d device ID (from an E3372) where we observed the problem. The workaround is not perfect, and we don't really know how it will affect multiplexed IP sessions (i.e. connecting to more than one APN at a time). So, since most Huawei devices have so far been known to work without it, I decided to apply it per device initially.

Your report might change that if it turns out that the same quirk is needed for yet another Huawei device ID.

But let's find out if the quirk helps first. Unfortunately that means either patching the driver, or running an even newer kernel. I added a knob to allow you to change the driver behaviour without patching, but it is not in v4.4. It will be in v4.5. So if you upgrade to a v4.5-rcX then you use the ndp_to_end sysfs attribute to enable the quirk temporarily for a quick test:

Code:
 nemi:/tmp# ls -l /sys/class/net/wwan2/cdc_ncm/ndp_to_end
-rw-r--r-- 1 root root 4096 Feb 16 12:01 /sys/class/net/wwan2/cdc_ncm/ndp_to_end
nemi:/tmp# grep . /sys/class/net/wwan2/cdc_ncm/ndp_to_end
N
nemi:/tmp# echo Y  >/sys/class/net/wwan2/cdc_ncm/ndp_to_end
nemi:/tmp# grep . /sys/class/net/wwan2/cdc_ncm/ndp_to_end
Y


If you want to build a new version of the driver instead, then you need to add something like this to the mbim_devs table:
Code:
       { USB_DEVICE_AND_INTERFACE_INFO(0x12d1, 0x1f1e, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE),
         .driver_info = (unsigned long)&cdc_mbim_info_ndp_to_end,
       },


Please let us know if either of these methods work for you. I believe that will be reason enough to apply this quirk to all Huawei devices.


Hm.. dont want to compile whole kernel, so I just need to download usb_modeswitch, edit mbim_devs and compile it? :)


Offline
PostPosted: Wed Feb 17, 2016 12:23 am Reply with quote
Posts: 166 Joined: Thu Mar 15, 2012 10:47 pm Location: Oslo, Norway
hippo_arch wrote:
Hm.. dont want to compile whole kernel, so I just need to download usb_modeswitch, edit mbim_devs and compile it? :)

No, you need to compile the cdc_mbim driver. Which doesn't necessarily mean the whole kernel, but it means that you need to be set up for building drivers. I don't know how arch does this, but I assume they provide something similar to Debian where you'll have a link to the kernel headers from "/lib/modules/`uname -r`/build" if the linux-headers package is installed:
Code:
bjorn@canardo:~$ ls -l /lib/modules/`uname -r`/build
lrwxrwxrwx 1 root root 37 Apr 13  2015 /lib/modules/3.16.0-4-amd64/build -> /usr/src/linux-headers-3.16.0-4-amd64


You can then rebuild single drivers by downloading the kernel source and building them like out-of-tree drivers:

Code:
bjorn@canardo:~$ make -C /lib/modules/`uname -r`/build SUBDIRS=/usr/local/src/git/linux/drivers/net/usb cdc_mbim.ko
make: Entering directory '/usr/src/linux-headers-3.16.0-4-amd64'
Makefile:10: *** mixed implicit and normal rules: deprecated syntax
make[1]: Entering directory `/usr/src/linux-headers-3.16.0-4-amd64'
  CC [M]  /usr/local/src/git/linux/drivers/net/usb/cdc_mbim.o
  MODPOST 1 modules
  CC      /usr/local/src/git/linux/drivers/net/usb/cdc_mbim.mod.o
  LD [M]  /usr/local/src/git/linux/drivers/net/usb/cdc_mbim.ko
make: Leaving directory '/usr/src/linux-headers-3.16.0-4-amd64'


And test the new driver with
Code:
rmmod cdc_mbim
insmod /usr/local/src/git/linux/drivers/net/usb/cdc_mbim.ko


You might want to test the above method before you edit the driver to verify that you got it right, and then repeat after adding the new device entry.

If you want to install your modified driver as a more permanent replacement along with a distro kernel, then you can use the "updates" dir for that:
Code:
mkdir /lib/modules/`uname -r`/updates
cp /usr/local/src/git/linux/drivers/net/usb/cdc_mbim.ko /lib/modules/`uname -r`/updates/
depmod -a
rmmod cdc_mbim
modprobe cdc_mbim



You'll of course need to adjust the paths above depending on where you keep you kernel source code.

(again: I'm used to work with Debian. Arch might do things differently. YMMV)


Offline
PostPosted: Wed Feb 17, 2016 9:40 am Reply with quote
Posts: 13 Joined: Mon Feb 15, 2016 11:35 pm
Great! Thanks for howto :) I will try to check that during today and bring some results :)


Offline
PostPosted: Thu Feb 25, 2016 4:43 pm Reply with quote
Posts: 13 Joined: Mon Feb 15, 2016 11:35 pm
Hi,

sorry for delay.. had some work to do, but i am back on track.

I tried to compile module from source:

Code:
[hippo@arch linux-4.5-rc5]$ make -C /lib/modules/`uname -r`/build/ SUBDIRS=/home/hippo/Downloads/linux-4.5-rc5/drivers/net/usb cdc_mbim.ko
make: Entering directory '/usr/lib/modules/4.4.1-2-ARCH/build'
  CC [M]  /home/hippo/Downloads/linux-4.5-rc5/drivers/net/usb/cdc_mbim.o
  MODPOST 1 modules
  CC      /home/hippo/Downloads/linux-4.5-rc5/drivers/net/usb/cdc_mbim.mod.o
  LD [M]  /home/hippo/Downloads/linux-4.5-rc5/drivers/net/usb/cdc_mbim.ko
make: Leaving directory '/usr/lib/modules/4.4.1-2-ARCH/build'

[root@arch ~]# rmmod cdc_mbim
rmmod: ERROR: Module cdc_mbim is not currently loaded
[root@arch ~]# insmod /home/hippo/Downloads/linux-4.5-rc5/drivers/net/usb/cdc_mbim.ko
insmod: ERROR: could not insert module /home/hippo/Downloads/linux-4.5-rc5/drivers/net/usb/cdc_mbim.ko: Unknown symbol in module


and in journalctl is this:

Code:
Feb 25 15:33:46 arch kernel: cdc_mbim: Unknown symbol cdc_ncm_bind_common (err 0)
Feb 25 15:33:46 arch kernel: cdc_mbim: Unknown symbol cdc_ncm_rx_verify_nth16 (err 0)
Feb 25 15:33:46 arch kernel: cdc_mbim: Unknown symbol usb_cdc_wdm_register (err 0)
Feb 25 15:33:46 arch kernel: cdc_mbim: Unknown symbol cdc_ncm_unbind (err 0)
Feb 25 15:33:46 arch kernel: cdc_mbim: Unknown symbol cdc_ncm_fill_tx_frame (err 0)
Feb 25 15:33:46 arch kernel: cdc_mbim: Unknown symbol cdc_ncm_select_altsetting (err 0)
Feb 25 15:33:46 arch kernel: cdc_mbim: Unknown symbol cdc_ncm_change_mtu (err 0)
Feb 25 15:33:46 arch kernel: cdc_mbim: Unknown symbol cdc_ncm_rx_verify_ndp16 (err 0)


Code of cdc_mbim.c with my edit (search for Huawei KKKKK):
http://pastebin.com/iCzdQYxh


Any ideas what to do? :)


Offline
PostPosted: Thu Feb 25, 2016 4:49 pm Reply with quote
Posts: 166 Joined: Thu Mar 15, 2012 10:47 pm Location: Oslo, Norway
hippo_arch wrote:
Any ideas what to do? :)

Yes. I assumed cdc_mbim was already autoloaded, and therefore also the modules it depends on.

Try
Code:
modprobe cdc-wdm
modprobe cdc_ncm
insmod /home/hippo/Downloads/linux-4.5-rc5/drivers/net/usb/cdc_mbim.ko


Offline
PostPosted: Thu Feb 25, 2016 9:18 pm Reply with quote
Posts: 13 Joined: Mon Feb 15, 2016 11:35 pm
Hi,

thanks!

Now adding module working as should :) but (actually, I already forget what should work now..), but when I put DisableSwitching back to 0, then modem is as normal broadband mobile modem in networkmanager, but when it connect, I still cannot ping internet.

Here is the log from journalctl:

Code:
Feb 25 20:04:16 arch kernel: usb 3-2: new high-speed USB device number 12 using xhci_hcd
Feb 25 20:04:16 arch kernel: usb-storage 3-2:1.0: USB Mass Storage device detected
Feb 25 20:04:16 arch kernel: scsi host17: usb-storage 3-2:1.0
Feb 25 20:04:17 arch usb_modeswitch[26430]: switch device 12d1:1f1e on 003/012
Feb 25 20:04:18 arch kernel: cdc_mbim 3-2:2.0: setting rx_max = 16384
Feb 25 20:04:18 arch kernel: cdc_mbim 3-2:2.0: NDP will be placed at end of frame for this device.
Feb 25 20:04:18 arch kernel: cdc_mbim 3-2:2.0: cdc-wdm0: USB WDM device
Feb 25 20:04:18 arch kernel: cdc_mbim 3-2:2.0 wwan0: register 'cdc_mbim' at usb-0000:00:14.0-2, CDC MBIM, e2:43:26:be:12:7c
Feb 25 20:04:18 arch kernel: usb-storage 3-2:2.2: USB Mass Storage device detected
Feb 25 20:04:18 arch kernel: scsi host18: usb-storage 3-2:2.2
Feb 25 20:04:18 arch ModemManager[416]: opening device...
Feb 25 20:04:18 arch ModemManager[416]: [/dev/cdc-wdm0] Read max control message size from descriptors file: 1024
Feb 25 20:04:18 arch kernel: cdc_mbim 3-2:2.0 wwp0s20u2c2: renamed from wwan0
Feb 25 20:04:19 arch kernel: scsi 18:0:0:0: Direct-Access     HUAWEI   TF CARD Storage  2.31 PQ: 0 ANSI: 2
Feb 25 20:04:19 arch root[26449]: usb_modeswitch: switched to 12d1:1f1e on 003/012
Feb 25 20:04:19 arch kernel: sd 18:0:0:0: [sdb] Attached SCSI removable disk
Feb 25 20:04:20 arch ModemManager[416]: <info>  Creating modem with plugin 'Huawei' and '2' ports
Feb 25 20:04:20 arch ModemManager[416]: <info>  Modem for device at '/sys/devices/pci0000:00/0000:00:14.0/usb3/3-2' successfully created
Feb 25 20:04:20 arch ModemManager[416]: opening device...
Feb 25 20:04:20 arch ModemManager[416]: [/dev/cdc-wdm0] Read max control message size from descriptors file: 1024
Feb 25 20:04:22 arch ModemManager[416]: <info>  Modem: state changed (unknown -> disabled)
Feb 25 20:04:22 arch NetworkManager[412]: <info>  (cdc-wdm0): modem state changed, 'disabled' --> 'enabling' (reason: user preference)
Feb 25 20:04:22 arch NetworkManager[412]: <info>  (cdc-wdm0): new Broadband device (carrier: UNKNOWN, driver: 'cdc_mbim', ifindex: 0)
Feb 25 20:04:22 arch NetworkManager[412]: <info>  (cdc-wdm0): device state change: unmanaged -> unavailable (reason 'managed') [10 20 2]
Feb 25 20:04:22 arch NetworkManager[412]: <info>  (cdc-wdm0): modem state 'enabling'
Feb 25 20:04:22 arch NetworkManager[412]: <info>  (cdc-wdm0): device state change: unavailable -> disconnected (reason 'none') [20 30 0]
Feb 25 20:04:22 arch ModemManager[416]: <info>  Modem /org/freedesktop/ModemManager1/Modem/1: state changed (disabled -> enabling)
Feb 25 20:04:23 arch ModemManager[416]: <info>  Modem /org/freedesktop/ModemManager1/Modem/1: 3GPP Registration state changed (unknown -> registering)
Feb 25 20:04:23 arch ModemManager[416]: <info>  Modem /org/freedesktop/ModemManager1/Modem/1: 3GPP Registration state changed (registering -> home)
Feb 25 20:04:23 arch ModemManager[416]: <info>  Modem /org/freedesktop/ModemManager1/Modem/1: state changed (enabling -> registered)
Feb 25 20:04:23 arch NetworkManager[412]: <info>  (cdc-wdm0): modem state changed, 'enabling' --> 'registered' (reason: user-requested)
Feb 25 20:04:33 arch NetworkManager[412]: <info>  (cdc-wdm0): Activation: starting connection 'Vodafone Default' (d36e0a6c-190f-4352-87b2-4e9240022564)
Feb 25 20:04:33 arch NetworkManager[412]: <info>  (cdc-wdm0): device state change: disconnected -> prepare (reason 'none') [30 40 0]
Feb 25 20:04:33 arch NetworkManager[412]: <info>  NetworkManager state is now CONNECTING
Feb 25 20:04:33 arch ModemManager[416]: <info>  Simple connect started...
Feb 25 20:04:33 arch ModemManager[416]: <info>  Simple connect state (4/8): Wait to get fully enabled
Feb 25 20:04:33 arch ModemManager[416]: <info>  Simple connect state (5/8): Register
Feb 25 20:04:33 arch ModemManager[416]: <info>  Simple connect state (6/8): Bearer
Feb 25 20:04:33 arch ModemManager[416]: <info>  Simple connect state (7/8): Connect
Feb 25 20:04:33 arch ModemManager[416]: <info>  Modem /org/freedesktop/ModemManager1/Modem/1: state changed (registered -> connecting)
Feb 25 20:04:33 arch NetworkManager[412]: <info>  (cdc-wdm0): modem state changed, 'registered' --> 'connecting' (reason: user-requested)
Feb 25 20:04:34 arch ModemManager[416]: <info>  Modem /org/freedesktop/ModemManager1/Modem/1: state changed (connecting -> connected)
Feb 25 20:04:34 arch ModemManager[416]: <info>  Simple connect state (8/8): All done
Feb 25 20:04:34 arch NetworkManager[412]: <info>  (cdc-wdm0): modem state changed, 'connecting' --> 'connected' (reason: user-requested)
Feb 25 20:04:34 arch NetworkManager[412]: <info>  (cdc-wdm0): device state change: prepare -> config (reason 'none') [40 50 0]
Feb 25 20:04:34 arch NetworkManager[412]: <info>  (cdc-wdm0): device state change: config -> ip-config (reason 'none') [50 70 0]
Feb 25 20:04:34 arch NetworkManager[412]: <info>  (cdc-wdm0): IPv6 configuration disabled
Feb 25 20:04:34 arch NetworkManager[412]: <info>  (cdc-wdm0): IPv4 static configuration:
Feb 25 20:04:34 arch NetworkManager[412]: <info>    address 10.167.148.109/30
Feb 25 20:04:34 arch NetworkManager[412]: <info>    gateway 10.167.148.110
Feb 25 20:04:34 arch NetworkManager[412]: <info>    DNS 217.77.165.81
Feb 25 20:04:34 arch NetworkManager[412]: <info>    DNS 217.77.165.211
Feb 25 20:04:34 arch avahi-daemon[414]: Joining mDNS multicast group on interface wwp0s20u2c2.IPv4 with address 10.167.148.109.
Feb 25 20:04:34 arch avahi-daemon[414]: New relevant interface wwp0s20u2c2.IPv4 for mDNS.
Feb 25 20:04:34 arch avahi-daemon[414]: Registering new address record for 10.167.148.109 on wwp0s20u2c2.IPv4.
Feb 25 20:04:34 arch NetworkManager[412]: <info>  (cdc-wdm0): device state change: ip-config -> ip-check (reason 'none') [70 80 0]
Feb 25 20:04:34 arch NetworkManager[412]: <info>  (cdc-wdm0): device state change: ip-check -> secondaries (reason 'none') [80 90 0]
Feb 25 20:04:34 arch NetworkManager[412]: <info>  (cdc-wdm0): device state change: secondaries -> activated (reason 'none') [90 100 0]
Feb 25 20:04:34 arch NetworkManager[412]: <info>  NetworkManager state is now CONNECTED_LOCAL
Feb 25 20:04:34 arch NetworkManager[412]: <info>  NetworkManager state is now CONNECTED_GLOBAL
Feb 25 20:04:34 arch NetworkManager[412]: <info>  Policy set 'Vodafone Default' (wwp0s20u2c2) as default for IPv4 routing and DNS.
Feb 25 20:04:34 arch NetworkManager[412]: <info>  Writing DNS information to /usr/bin/resolvconf
Feb 25 20:04:34 arch NetworkManager[412]: <info>  (cdc-wdm0): Activation: successful, device activated.
Feb 25 20:04:34 arch dbus[409]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service'
Feb 25 20:04:34 arch systemd[1]: Starting Network Manager Script Dispatcher Service...
Feb 25 20:04:34 arch dbus[409]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Feb 25 20:04:34 arch systemd[1]: Started Network Manager Script Dispatcher Service.


I got also all IP's and stuff (see attachement).

So no change (I had same situation at start).
Attachments:
2016-02-25-200332_1366x768_scrot.png
2016-02-25-200332_1366x768_scrot.png [ 19.6 KiB | Viewed 8512 times ]

Offline

Display posts from previous:  Sort by:

All times are UTC+02:00
Page 1 of 3
31 posts
Go to page 1 2 3 Next
Users browsing this forum: No registered users and 1 guest
Search for:
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
cron