# Eth0 disconnects when ecm0 does

**URL:** <https://mangoh.discourse.group/t/eth0-disconnects-when-ecm0-does/9748>\
**Category:** Uncategorized\
**Created:** [November 6, 2021, 8:09pm UTC](https://mangoh.discourse.group/t/eth0-disconnects-when-ecm0-does/9748 "2021-11-06T20:09:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidkeenleyside](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@davidkeenleyside](https://mangoh.discourse.group/u/davidkeenleyside)\
**Post date:** [November 6, 2021, 8:09pm UTC](https://mangoh.discourse.group/t/eth0-disconnects-when-ecm0-does/9748/1 "2021-11-06T20:09:22Z")

</div>

We have a custom board that uses the WP7603 that has an Ethernet port implemented using the Mangoh Green design, and find whenever ecm0 is disconnected eth0 connectivity is lost also. HSIC is enabled (we can see that using AT!CUSTOM) so that’s not the issue.

Viewing kernel messages via dmesg it seems to be a power issue, with USB going into low power mode and eth0 being lost as a result (or side effect). Kernel messages are below. Note the messages marked as logged while USB is unplugged occur continuously in a message loop that repeats every several seconds. The Ethernet controller’s reset pin is toggled each time it does.

I don’t see anything in the documentation that explains how we can correct this. There’s nothing in the target tools for USB power management and I don’t see any kernel configuration for it. How do we stop this behaviour? Ethernet is an essential feature for us.

**Kernel messages output on unplugging USB:**

[604.283163] msm\_otg 78d9000.usb: Avail curr from USB = 2  
[604.283205] msm\_hsusb msm\_hsusb: CI13XXX\_CONTROLLER\_SUSPEND\_EVENT received  
[604.283271] android\_work: android\_work: sent uevent USB\_STATE=SUSPENDED  
[605.851363] diag: USB channel diag disconnected  
[605.853933] ch\_notify on a closed smd\_pkt\_dev id:2  
[605.859225] android\_work: android\_work: sent uevent USB\_STATE=DISCONNECTED  
[605.874101] msm\_hsusb msm\_hsusb: CI13XXX\_CONTROLLER\_DISCONNECT\_EVENT received  
[605.882218] msm\_otg 78d9000.usb: Avail curr from USB = 0  
[605.984447] QTI:LINK\_DOWN Processed  
[605.999870] QTI:LINK\_DOWN message posted  
[606.962275] msm\_otg 78d9000.usb: USB in low power mode

**Message loop while USB disconnected:** (not certain this is synched correctly to the first message of the series as it’s a continuous stream)

[609.109736] PM: suspend entry 2021-11-06 19:07:58.171225251 UTC  
[609.109769] PM: Syncing filesystems … done.  
[609.123830] PM: Preparing system for mem sleep  
[609.128637] Freezing user space processes … (elapsed 0.008 seconds) done.  
[609.136830] Freezing remaining freezable tasks … (elapsed 0.002 seconds) done.  
[609.139776] PM: Entering mem sleep  
[609.139804] Suspending console(s) (use no\_console\_suspend to debug)  
[609.168213] smsc95xx 1-1.1:1.0 eth0: disabling pattern match wakeup  
[609.168233] smsc95xx 1-1.1:1.0 eth0: enabling magic packet wakeup  
[609.169560] smsc95xx 1-1.1:1.0 eth0: entering SUSPEND0 mode  
[609.176059] msm\_hsic\_host 7c00000.hsic\_host: HSIC-USB in low power mode  
[609.178259] PM: suspend of devices complete after 37.060 msecs  
[609.182488] PM: late suspend of devices complete after 4.184 msecs  
[609.185439] PM: noirq suspend of devices complete after 2.911 msecs  
[609.185539] suspend ns: 609185520521 suspend cycles: 49893343923  
[609.185520] CPU0:msm\_cpu\_pm\_enter\_sleep mode:3 during suspend  
[609.185520] resume cycles: 50054084305  
[609.187832] PM: noirq resume of devices complete after 1.656 msecs  
[609.190017] PM: early resume of devices complete after 1.766 msecs  
[609.193926] msm\_hsic\_host 7c00000.hsic\_host: HSIC-USB exited from low power mode  
[609.370588] usb 1-1: reset high-speed USB device number 2 using msm\_hsic\_host  
[609.820463] usb 1-1.1: reset high-speed USB device number 3 using msm\_hsic\_host  
[610.028138] PM: resume of devices complete after 838.070 msecs  
[610.030447] PM: Finishing wakeup.  
[610.030468] Restarting tasks … done.  
[610.052499] sierra\_pm\_resume  
[610.053953] PM: suspend exit 2021-11-06 19:08:07.487110404 UTC

**Reconnection messages:**

[1949.162272] msm\_otg 78d9000.usb: phy\_reset: success  
[1949.264386] msm\_otg 78d9000.usb: USB exited from low power mode  
[1949.267256] msm\_hsusb msm\_hsusb: CI13XXX\_CONTROLLER\_RESET\_EVENT received  
[1949.267285] msm\_hsusb msm\_hsusb: CI13XXX\_CONTROLLER\_CONNECT\_EVENT received  
[1949.271023] msm\_otg 78d9000.usb: Avail curr from USB = 2  
[1949.271084] msm\_hsusb msm\_hsusb: CI13XXX\_CONTROLLER\_SUSPEND\_EVENT received  
[1949.412196] msm\_hsusb msm\_hsusb: CI13XXX\_CONTROLLER\_RESUME\_EVENT received  
[1949.412340] msm\_otg 78d9000.usb: Avail curr from USB = 100  
[1949.412569] android\_work: android\_work: did not send uevent (0 0 00000000)  
[1949.539127] android\_work: android\_work: sent uevent USB\_STATE=CONNECTED  
[1949.543816] android\_work: android\_work: sent uevent USB\_STATE=DISCONNECTED  
[1949.687066] android\_work: android\_work: sent uevent USB\_STATE=CONNECTED  
[1949.703885] android\_usb gadget: high-speed config #1: 86000c8.android\_usb  
[1949.703960] diag: USB channel diag connected  
[1949.704135] msm\_otg 78d9000.usb: Avail curr from USB = 500  
[1949.763453] android\_work: android\_work: sent uevent USB\_STATE=CONFIGURED  
[1950.581172] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0x45E1  
[1950.720399] QTI:USB tethered modem SMD port opened  
[1951.040437] QTI:LINK\_UP Processed  
[1951.051915] QTI:ECM mode  
[1951.066238] QTI:LINK\_UP message posted

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/jyijyi/32/997_2.png) [@jyijyi](https://mangoh.discourse.group/u/jyijyi)\
**Post date:** [November 7, 2021, 7:31am UTC](https://mangoh.discourse.group/t/eth0-disconnects-when-ecm0-does/9748/2 "2021-11-07T07:31:08Z")

</div>

How about using the following command to make module stay awake when usb disconnect?

echo NO\_SLEEP \> /sys/power/wake\_lock

---

<div class="post-metadata">

**Author:** ![davidkeenleyside](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@davidkeenleyside](https://mangoh.discourse.group/u/davidkeenleyside)\
**Post date:** [November 10, 2021, 8:50pm UTC](https://mangoh.discourse.group/t/eth0-disconnects-when-ecm0-does/9748/3 "2021-11-10T20:50:52Z")

</div>

That worked, thanks. Having got that working now there’s still a couple of things that aren’t:

- There’s no external internet connectivity over eth0. We can ping it and ssh to it, but nothing outbound works. We checked and the Ethernet LAN’s DNS servers are listed in /etc/resolv.conf. Don’t know what else to look for or try.

- The setNet tool option to create a fixed MAC address doesn’t seem to be reliable. It creates entries in /etc/network/interfaces (see below) but they seem to be ignored by Linux or Legato (whichever one it is that actually assigns the address). Neither option below works, the address changes anyway.

auto eth0  
iface eth0 inet dhcp  
hwaddress ether B6:EB:A5:03:DD:3D

auto eth0  
iface eth0 inet static  
hwaddress ether 72:07:6A:FF:43:24  
address 10.0.0.237  
netmask 255.255.255.0  
gateway 10.0.0.1  
nameserver 64.71.255.204,64.71.255.198

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/jyijyi/32/997_2.png) [@jyijyi](https://mangoh.discourse.group/u/jyijyi)\
**Post date:** [November 10, 2021, 11:47pm UTC](https://mangoh.discourse.group/t/eth0-disconnects-when-ecm0-does/9748/4 "2021-11-10T23:47:41Z")

</div>

You can try

udhcpc -i eth0

---

<div class="post-metadata">

**Author:** ![davidkeenleyside](https://avatars.discourse-cdn.com/v4/letter/d/51bf81/32.png) [@davidkeenleyside](https://mangoh.discourse.group/u/davidkeenleyside)\
**Post date:** [November 11, 2021, 9:31pm UTC](https://mangoh.discourse.group/t/eth0-disconnects-when-ecm0-does/9748/5 "2021-11-11T21:31:11Z")

</div>

That worked, thanks once again. And the issue we were having with the setNet tool went away after we reinstalled Legato. The only thing we’re seeing now is Ethernet is inactive after a soft reboot, it requires a full power cycle to get it working again. Is there a configuration change we can make that would change that, maybe something we can add to a startup file?

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea2.discourse-cdn.com/flex016/user_avatar/mangoh.discourse.group/jyijyi/32/997_2.png) [@jyijyi](https://mangoh.discourse.group/u/jyijyi)\
**Post date:** [November 12, 2021, 1:17am UTC](https://mangoh.discourse.group/t/eth0-disconnects-when-ecm0-does/9748/6 "2021-11-12T01:17:22Z")

</div>

you can run an unsandboxed legato application to send linux command:

> **[Invoking shell scripts from Legato app](https://forum.legato.io/t/invoking-shell-scripts-from-legato-app/5575/4)**
>
> I don’t see problem on WP76 FW R13. You can use my hello6.tar.gz. hello6.tar.gz (314.7 KB) root@swi-mdm9x28-wp:~# chmod 777 /tmp/test.sh root@swi-mdm9x28-wp:~# /tmp/test.sh root@swi-mdm9x28-wp:~# ls /tmp/123.txt /tmp/123.txt ...

you can also modify init script /etc/init.d/startlegato.sh:

> **[Adding scripts to run at startup](https://forum.legato.io/t/adding-scripts-to-run-at-startup/2412/6)**
>
> Hi JyiJyi, I appreciate your previous reply to my post, but I attempted to make the changes that you recommended and am still unable to launch the script on boot. I have included a screenshot of several simple shell commands that I entered into...
