[OpenWrt-Devel] [PATCH 0/4] umbim support for MTK2 based modems like D-Link DWM-157

Bjørn Mork bjorn at mork.no
Wed May 11 07:24:00 EDT 2016


I was inspired by https://forum.openwrt.org/viewtopic.php?id=64680
to finally do something about this issue...

The primary show stopper is that the MTK2 MBIM firmware does not support
1024 bytes MBIM requests. The MBIM descriptor wMaxControlMessage is 512:

bjorn at nemi:~$ lsusb -vd 2001:7d01|sed -ne /MBIM/,+7p
      CDC MBIM:
        bcdMBIMVersion       1.00
        wMaxControlMessage   512
        bNumberFilters       16
        bMaxFilterSize       64
        wMaxSegmentSize      1500
        bmNetworkCapabilities 0x20
          8-byte ntb input size

This makes umbim OPEN fail because the modem refuse the default
hardcoded 1024 bytes buffer size:

bjorn at nemi:/usr/local/src/git/umbim$ ./umbim -d /dev/cdc-wdm2 -v -n caps
sending (16): 01 00 00 00 10 00 00 00 01 00 00 00 00 04 00 00 
  header_type: 0001
  header_length: 0010
  header_transaction: 0001
reading (16): 04 00 00 80 10 00 00 00 01 00 00 00 08 00 00 00 
  header_type: 80000004
  header_length: 0010
  header_transaction: 0001
sending (16): 02 00 00 00 10 00 00 00 02 00 00 00 08 00 00 00 
  header_type: 0002
  header_length: 0010
  header_transaction: 0002
reading (16): 02 00 00 80 10 00 00 00 02 00 00 00 02 00 00 00 
  header_type: 80000002
  header_length: 0010
  header_transaction: 0002


The same problem is likely to affect other MBIM firmwares.  I believe some
Ericsson modems also use 512 byte control messages.

Fix by dynamically allocating the message buffer, and getting the proper
size from the driver. We could parse the descriptor, but using the ioctl is
simpler and supported since Linux v3.10.

My DWM-156 A7 always starts up with the radio off. MBIM radio state support
is necessary to use the modem.

With these two changes , I can successfully establish a connection using the
D-Link DWM-156 A7:

bjorn at nemi:/usr/local/src/git/umbim$ ./umbim -n -d /dev/cdc-wdm2 unlock 1234
Pin Unlocked
bjorn at nemi:/usr/local/src/git/umbim$ ./umbim -n -t 2 -d /dev/cdc-wdm2 radio
  hwradiostate: on
  swradiostate: off
bjorn at nemi:/usr/local/src/git/umbim$ ./umbim -n -t 2 -d /dev/cdc-wdm2 radio on
  hwradiostate: on
  swradiostate: on
bjorn at nemi:/usr/local/src/git/umbim$ ./umbim -n -t 2 -d /dev/cdc-wdm2 connect telenor
  sessionid: 0
  activationstate: 0001 - activated
  voicecallstate: 0000 - none
  nwerror: 0000 - unknown
  iptype: 0001 - ipv4
bjorn at nemi:/usr/local/src/git/umbim$ ./umbim -n -t 2 -d /dev/cdc-wdm2 config
  ipv4address: 109.179.119.106/30
  ipv4gateway: 109.179.119.105
  ipv4mtu: 1500
  ipv4dnsserver: 193.213.112.4
bjorn at nemi:/usr/local/src/git/umbim$ ./umbim -n -t 2 -d /dev/cdc-wdm2 caps
  devicetype: 0002 - removable
  cellularclass: 0001
  voiceclass: 0003 - simultaneous-voice-data
  simclass: 0002
  dataclass: 001F
  smscaps: 0003
  controlcaps: 0001
  maxsessions: 0002
  deviceid: 355619050151297
  firmwareinfo: MOLY.WR8.W1231.DC.WG.MP.V3
  hardwareinfo: MTK2


Bjørn Mork (4):
  dynamically allocate buffer
  get buffer size from driver
  update usage()
  add radio_state set/query support

 cli.c      | 38 +++++++++++++++++++++++++++++++++++++-
 mbim-dev.c | 33 ++++++++++++++++++++++++++++-----
 mbim-dev.h |  4 +++-
 mbim-msg.c | 14 +++++++++-----
 mbim.h     |  2 --
 5 files changed, 77 insertions(+), 14 deletions(-)

-- 
2.1.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list