Help with MC7455 in OpenWRT router

I just remembered something else I did that you might try. I took an old usb charger and cut the end off and then just used the red and black wires and soldered them to the + and - on the adapter boards usb. I plugged it in the 3.0 of the linksys for more amps. I plugged the main usb into the 2.0. Sometimes if signal is bad the tx and rx will draw lots of voltage and knock it off of usb. I don’t know if it truly is needed but it seemed to be the norm from the forum im in. You could also just use a powered hub or a y cable.

try this mbim.sh instead. just copy and paste over the old one.

#!/bin/sh

mask="0"

[ -n "$INCLUDE_ONLY" ] || {
    . /lib/functions.sh
    . ../netifd-proto.sh
    init_proto "$@"
}
#DBG=-v

proto_mbim_init_config() {
    available=1
    no_device=1
    proto_config_add_string "device:device"
    proto_config_add_string apn
    proto_config_add_string pincode
    proto_config_add_string delay
    proto_config_add_string auth
    proto_config_add_string username
    proto_config_add_string password
}

# https://stackoverflow.com/questions/20762575
cdr2mask ()
{
   # Number of args to shift, 255..255, first non-255 byte, zeroes
   set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0
   [ $1 -gt 1 ] && shift $1 || shift
   echo ${1-0}.${2-0}.${3-0}.${4-0}
   mask=${1-0}.${2-0}.${3-0}.${4-0}
}

_proto_mbim_setup() {
    local interface="$1"
    local tid=2
    local ret

    local device apn pincode delay
    json_get_vars device apn pincode delay auth username password

    [ -n "$ctl_device" ] && device=$ctl_device

    [ -n "$device" ] || {
        echo "mbim[$$]" "No control device specified"
        proto_notify_error "$interface" NO_DEVICE
        proto_set_available "$interface" 0
        return 1
    }
    [ -c "$device" ] || {
        echo "mbim[$$]" "The specified control device does not exist"
        proto_notify_error "$interface" NO_DEVICE
        proto_set_available "$interface" 0
        return 1
    }

    devname="$(basename "$device")"
    devpath="$(readlink -f /sys/class/usbmisc/$devname/device/)"
    ifname="$( ls "$devpath"/net )"

    [ -n "$ifname" ] || {
        echo "mbim[$$]" "Failed to find matching interface"
        proto_notify_error "$interface" NO_IFNAME
        proto_set_available "$interface" 0
        return 1
    }

    [ -n "$apn" ] || {
        echo "mbim[$$]" "No APN specified"
        proto_notify_error "$interface" NO_APN
        return 1
    }

    [ -n "$delay" ] && sleep "$delay"

    echo "mbim[$$]" "Reading capabilities"
    umbim $DBG -n -d $device caps || {
        echo "mbim[$$]" "Failed to read modem caps"
        proto_notify_error "$interface" PIN_FAILED
        return 1
    }
    tid=$((tid + 1))

    echo "mbim[$$]" "Checking subscriber"
    umbim $DBG -n -t $tid -d $device subscriber || {
        echo "mbim[$$]" "Subscriber init failed"
        proto_notify_error "$interface" NO_SUBSCRIBER
        return 1
    }
    tid=$((tid + 1))

    echo "mbim[$$]" "Register with network"
      umbim $DBG -n -t $tid -d $device registration || {
        echo "mbim[$$]" "Subscriber registration failed"
        proto_notify_error "$interface" NO_REGISTRATION
        return 1
    }
    tid=$((tid + 1))

    echo "mbim[$$]" "Attach to network"
      umbim $DBG -n -t $tid -d $device attach || {
        echo "mbim[$$]" "Failed to attach to network"
        proto_notify_error "$interface" ATTACH_FAILED
        return 1
    }
    tid=$((tid + 1))

    echo "mbim[$$]" "Connect to network"
    while ! umbim $DBG -n -t $tid -d $device connect "$apn" "$auth" "$username" "$password"; do
        tid=$((tid + 1))
        sleep 1;
    done
    tid=$((tid + 1))

    echo "mbim[$$]" "Get IP config"
    CONFIG=$(umbim $DBG -n -t $tid -d $device config) || {
        echo "mbim[$$]" "config failed"
        return 1
    }
    tid=$((tid + 1))

    echo "$CONFIG" > /tmp/ip
    IP=$(cat /tmp/ip |grep ipv4address |grep -E -o "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)")
    NM=$(cat /tmp/ip |grep ipv4address |grep -o '.\{2\}$')
    GW=$(cat /tmp/ip |grep ipv4gateway |grep -E -o "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)")
    DNS=$(cat /tmp/ip |grep ipv4dnsserver |grep -E -o "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" |head -1)

    cdr2mask $NM

    echo "IP: $IP $mask"
    echo "GW: $GW"
    echo "DNS: $DNS"

    uci_set_state network $interface tid "$tid"
    echo "mbim[$$]" "Connected, setting IP"
    proto_init_update "$ifname" 1
    proto_send_update "$interface"

    json_init
    json_add_string name "${interface}_4"
    json_add_string ifname "@$interface"
    json_add_string proto "static"

    ifconfig wwan0 $IP netmask $mask
    route add default gw $GW dev wwan0
    ifup wwan0

    echo "nameserver $DNS" >> /tmp/resolv.conf.auto
    echo "nameserver $DNS" >> /etc/resolv.conf

    echo "$mask"

    return 0
}

proto_mbim_setup() {
    local ret

    _proto_mbim_setup $@
    ret=$?

    [ "$ret" = 0 ] || {
        logger "mbim bringup failed, retry in 15s"
        sleep 15
    }

    return $rt
}

proto_mbim_teardown() {
    local interface="$1"

    local device
    json_get_vars device
    local tid=$(uci_get_state network $interface tid)

    [ -n "$ctl_device" ] && device=$ctl_device

    echo "mbim[$$]" "Stopping network"
    [ -n "$tid" ] && {
        umbim $DBG -t$tid -d "$device" disconnect
        uci_revert_state network $interface tid
    }

    proto_init_update "*" 0
    proto_send_update "$interface"
}

[ -n "$INCLUDE_ONLY" ] || add_protocol mbim

This seems strange, the time stuff shouldn’t have to do with the mbim.sh stuff.

New method for reconnection**
This works faster and wifi stays up all the time. No need for the local network stop.

Turn off watchcat if you have it running.

Download the files and in winscp put them in the proper folders. Make a “home” folder. Your going to swap your mbim.sh again also.

dropbox.com/s/ce1qm8ep2fssx … 9.zip?dl=0

/etc/init.d/sessionhold.sh
/home/reconn.sh
/home/loopback.sh
/lib/netifd/proto/mbim.sh
Right click and put x’s to make it executable 775 or 777

In the loopback file you can add a static ip for a server. Just change it to what you need it to be.

When your done, reboot

Just to be clear…this takes the place of watchcat? I do not need to have watchcat running anymore?

Also, not sure about the server part of the loopback file. I have a NAS file server on my network…but that’s not what you’re referring to? I’m just not sure what is happening in the loopback file with the static server IP address. Could you explain?

Should I still try and power the MC7455 with an external powered hub?

BTW, my internet connection dropped while sitting at my computer today so I captured the log.

Thu Dec 15 11:50:00 2016 cron.info crond[1329]: USER root pid 29314 cmd /sbin/fan_ctrl.sh
Thu Dec 15 11:51:07 2016 daemon.warn odhcpd[1284]: DHCPV6 SOLICIT IA_NA from 00030001605bb42f8035 on br-lan: ok fd1f:895c:3e89::c92/128 
Thu Dec 15 11:53:15 2016 daemon.warn odhcpd[1284]: DHCPV6 SOLICIT IA_NA from 00030001605bb42f8035 on br-lan: ok fd1f:895c:3e89::c92/128 
Thu Dec 15 11:54:10 2016 daemon.info hostapd: wlan1: STA 60:5b:b4:2f:80:35 WPA: group key handshake completed (RSN)
Thu Dec 15 11:54:10 2016 daemon.info hostapd: wlan1: STA bc:9f:ef:89:7a:83 WPA: group key handshake completed (RSN)
Thu Dec 15 11:54:15 2016 daemon.info hostapd: wlan0: STA 00:1f:5b:ca:5c:e1 WPA: group key handshake completed (RSN)
Thu Dec 15 11:55:00 2016 cron.info crond[1329]: USER root pid 29330 cmd /sbin/fan_ctrl.sh
Thu Dec 15 11:55:15 2016 daemon.warn odhcpd[1284]: DHCPV6 SOLICIT IA_NA from 00030001605bb42f8035 on br-lan: ok fd1f:895c:3e89::c92/128 
Thu Dec 15 11:57:25 2016 daemon.warn odhcpd[1284]: DHCPV6 SOLICIT IA_NA from 00030001605bb42f8035 on br-lan: ok fd1f:895c:3e89::c92/128 
Thu Dec 15 11:59:31 2016 daemon.warn odhcpd[1284]: DHCPV6 SOLICIT IA_NA from 00030001605bb42f8035 on br-lan: ok fd1f:895c:3e89::c92/128 
Thu Dec 15 11:59:54 2016 kern.info kernel: [167756.206993] usb 1-1: USB disconnect, device number 2
Thu Dec 15 11:59:54 2016 kern.info kernel: [167756.212218] qcserial ttyUSB0: Qualcomm USB modem converter now disconnected from ttyUSB0
Thu Dec 15 11:59:54 2016 kern.info kernel: [167756.220511] qcserial 1-1:1.0: device disconnected
Thu Dec 15 11:59:54 2016 kern.info kernel: [167756.225507] qcserial ttyUSB1: Qualcomm USB modem converter now disconnected from ttyUSB1
Thu Dec 15 11:59:54 2016 kern.info kernel: [167756.233819] qcserial 1-1:1.3: device disconnected
Thu Dec 15 11:59:54 2016 kern.info kernel: [167756.238743] cdc_mbim 1-1:1.12 wwan0: unregister 'cdc_mbim' usb-f1058000.usb-1, CDC MBIM
Thu Dec 15 11:59:54 2016 daemon.notice netifd: Network device 'wwan0' link is down
Thu Dec 15 11:59:54 2016 daemon.notice netifd: wan (29355): mbim[29355] Stopping network
Thu Dec 15 11:59:54 2016 daemon.notice netifd: wan (29355): open failed: : No such file or directory
Thu Dec 15 11:59:54 2016 daemon.notice netifd: wan (29355): Command failed: Permission denied
Thu Dec 15 11:59:54 2016 daemon.notice netifd: Interface 'wan' is now down
Thu Dec 15 11:59:54 2016 daemon.notice netifd: Interface 'wan' is setting up now
Thu Dec 15 11:59:54 2016 daemon.warn dnsmasq[2324]: no servers found in /tmp/resolv.conf.auto, will retry
Thu Dec 15 11:59:54 2016 daemon.notice netifd: wan (29390): mbim[29390] The specified control device does not exist
Thu Dec 15 11:59:54 2016 daemon.notice netifd: wan (29421): mbim[29421] Stopping network
Thu Dec 15 11:59:54 2016 daemon.notice netifd: wan (29421): Command failed: Permission denied
Thu Dec 15 11:59:54 2016 daemon.notice netifd: Interface 'wan' is now down
Thu Dec 15 12:00:00 2016 cron.info crond[1329]: USER root pid 29517 cmd /sbin/fan_ctrl.sh
Thu Dec 15 12:00:04 2016 kern.info kernel: [167766.826049] usb 1-1: new high-speed USB device number 3 using orion-ehci
Thu Dec 15 12:00:04 2016 kern.warn kernel: [167766.962829] usb 1-1: config 1 has an invalid interface number: 12 but max is 3
Thu Dec 15 12:00:04 2016 kern.warn kernel: [167766.970199] usb 1-1: config 1 has an invalid interface number: 13 but max is 3
Thu Dec 15 12:00:04 2016 kern.warn kernel: [167766.977559] usb 1-1: config 1 has an invalid interface number: 13 but max is 3
Thu Dec 15 12:00:04 2016 kern.warn kernel: [167766.984922] usb 1-1: config 1 has no interface number 1
Thu Dec 15 12:00:04 2016 kern.warn kernel: [167766.990272] usb 1-1: config 1 has no interface number 2
Thu Dec 15 12:00:04 2016 kern.info kernel: [167766.997265] qcserial 1-1:1.0: Qualcomm USB modem converter detected
Thu Dec 15 12:00:04 2016 kern.info kernel: [167767.003848] usb 1-1: Qualcomm USB modem converter now attached to ttyUSB0
Thu Dec 15 12:00:04 2016 kern.info kernel: [167767.011329] qcserial 1-1:1.3: Qualcomm USB modem converter detected
Thu Dec 15 12:00:04 2016 kern.info kernel: [167767.017886] usb 1-1: Qualcomm USB modem converter now attached to ttyUSB1
Thu Dec 15 12:00:04 2016 kern.info kernel: [167767.032944] cdc_mbim 1-1:1.12: cdc-wdm0: USB WDM device
Thu Dec 15 12:00:04 2016 kern.info kernel: [167767.038802] cdc_mbim 1-1:1.12 wwan0: register 'cdc_mbim' at usb-f1058000.usb-1, CDC MBIM, 6a:e7:ab:2f:30:34
Thu Dec 15 12:01:37 2016 daemon.warn odhcpd[1284]: DHCPV6 SOLICIT IA_NA from 00030001605bb42f8035 on br-lan: ok fd1f:895c:3e89::c92/128 
Thu Dec 15 12:03:31 2016 daemon.info dnsmasq-dhcp[2324]: DHCPREQUEST(br-lan) 192.168.0.228 44:65:0d:3e:b2:16 
Thu Dec 15 12:03:31 2016 daemon.info dnsmasq-dhcp[2324]: DHCPACK(br-lan) 192.168.0.228 44:65:0d:3e:b2:16 kindle-7e5be39e8
Thu Dec 15 12:03:33 2016 daemon.warn odhcpd[1284]: DHCPV6 SOLICIT IA_NA from 00030001605bb42f8035 on br-lan: ok fd1f:895c:3e89::c92/128 
Thu Dec 15 12:04:10 2016 daemon.info hostapd: wlan1: STA 60:5b:b4:2f:80:35 WPA: group key handshake completed (RSN)
Thu Dec 15 12:04:11 2016 daemon.info hostapd: wlan1: STA bc:9f:ef:89:7a:83 WPA: group key handshake completed (RSN)
Thu Dec 15 12:04:15 2016 daemon.info hostapd: wlan0: STA 00:1f:5b:ca:5c:e1 WPA: group key handshake completed (RSN)
Thu Dec 15 12:05:00 2016 cron.info crond[1329]: USER root pid 29639 cmd /sbin/fan_ctrl.sh
Thu Dec 15 12:05:19 2016 daemon.info dnsmasq-dhcp[2324]: DHCPDISCOVER(br-lan) 65.97.249.222 64:52:99:09:9a:28 
Thu Dec 15 12:05:19 2016 daemon.info dnsmasq-dhcp[2324]: DHCPOFFER(br-lan) 192.168.0.108 64:52:99:09:9a:28 
Thu Dec 15 12:05:19 2016 daemon.info dnsmasq-dhcp[2324]: DHCPREQUEST(br-lan) 192.168.0.108 64:52:99:09:9a:28 
Thu Dec 15 12:05:19 2016 daemon.info dnsmasq-dhcp[2324]: DHCPACK(br-lan) 192.168.0.108 64:52:99:09:9a:28 
Thu Dec 15 12:05:25 2016 daemon.warn odhcpd[1284]: DHCPV6 SOLICIT IA_NA from 00030001605bb42f8035 on br-lan: ok fd1f:895c:3e89::c92/128 
Thu Dec 15 12:07:31 2016 daemon.warn odhcpd[1284]: DHCPV6 SOLICIT IA_NA from 00030001605bb42f8035 on br-lan: ok fd1f:895c:3e89::c92/128

Sounds like a good idea based on the log line below

This is an electrical disconnect from the port. It’s not a network or software issue. If you didn’t actually disconnect the modem, then the only possible explanation is that the modem reset its USB controller for some reason. This can happen if the modem firmware crashes. But the MC7455 firmware is extremely stable, so that is an unlikely cause IMHO. A much more likely cause is a brown-out due to limited current supply from the USB port.

So do try a powered HUB if you are having this problem often. Or if you use a USB cable to connect the modem, then the easiest test would be replacing the cable.

Yup what he said ^.

I soldered another usb cable to my mini pci-e adapter board (just the black and red) and plugged it into the 3.0 port for more power.

The new reconnect method replaces the watchcat method. Stop the watchcat and do the other method. The loopback is for an xbox or a server or anything. I changed my loopback file to192.168.1.150 and 192.168.1.0 (my router ip is 192.168.1.1) I aim my xbox to this address and port forward for open nats.

I agree it’s not the mbim itself. On the last reconnect method I mentioned the mbim is modified to start and stop watchdog and to restart the reconnect scripts so you don’t have multiple things going on.

The final mbim runs all the reconnect stuff.

Hi,

I test MC7455 with OpenWrt firmware on our embedded device.
I encounter connection block issue when plug MC7455 into USB3.0 port and start to browse Youtube or send/receive some stream.
And MC7455 still connected on BS when the connection blocking.
The issue is gone once I change to plug MC7455 into USB2.0 port.

I see westrem’s instruction specify that plug MC7455 into USB2.0 as below.
plug the modem into the 2.0 usb port. Not the 3.0 port.

Could anyone tell me why can not plug MC7455 into USB2.0?
Is there any known issue for MC7455 to support USB3.0 although Product Technical Specification specify MC7455 support USB2.0 and USB3.0?
If I must to plug MC7455 into USB3.0, any thing I can do to address this issue?

Thanks.

Ricky

I’m also wondering if there are problems using USB2.0 versus USB3.0 interfaces?

From what I have heard it’s a power issue on the 3.0 port or an issue of power being toggled on the 3.0 port with the mc7455 on it. That’s all I have heard and know.

When using ModemManager in OpenWRT, you don’t even need to switch the device to MBIM mode (although you can do it if you want to). The same settings would work for the MC7455 in MBIM mode or in QMI mode. Actually, the same exact settings would also work for other devices as well, see: https://sigquit.wordpress.com/2017/01/07/modemmanager-in-openwrt-take-2/

Note, though, that if using the MC7455 you will want to have at least kernel 4.5, which is when the raw-ip support in the qmi_wwan driver was included.

This is true. But neither openwrt nor LEDE are using a 4.5 or higher kernel yet so MBIM is the only way to go for now. Unless you build something yourself that is.

ROOter is close to having their openwrt firmware working with the mc7455 chip. Dairyman the creator of modemmanager also makes ROOter.

For now the only way without a lot of rebuilding is using the newest LEDE firmware and mbim mode.

Dairyman didn’t create ModemManager…

Oh I stand corrected then. Sorry I thought he did. I must have misread that somewhere.

I see where I made that mistake. Dairyman created a modem conection manager not modemmanager. Sorry for the misinformation.

Just fyi: aleksander0m makes modemmanager :slight_smile:

(along with a few others of course, but aleksander is the primary developer nowadays)

Yup I realize now. Foot in mouth.

What’s the problem with that way?

No problems at all.

:smiley: No worries