# MangOH Yellow - WiFi on Startup

**URL:** <https://mangoh.discourse.group/t/mangoh-yellow-wifi-on-startup/3198>\
**Category:** mangOH Yellow\
**Created:** [December 16, 2019, 3:15pm UTC](https://mangoh.discourse.group/t/mangoh-yellow-wifi-on-startup/3198 "2019-12-16T15:15:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nrcrast](https://avatars.discourse-cdn.com/v4/letter/n/ea666f/32.png) [@nrcrast](https://mangoh.discourse.group/u/nrcrast)\
**Post date:** [December 16, 2019, 3:15pm UTC](https://mangoh.discourse.group/t/mangoh-yellow-wifi-on-startup/3198/1 "2019-12-16T15:15:40Z")

</div>

Hi guys,

I’m having some issues getting MangOH yellow to start/connect to WiFi on startup. I essentially have this script I run to start WiFi:

```
/legato/systems/current/modules/files/brcmutil/etc/init.d/cywifi.sh init
/legato/systems/current/modules/files/brcmutil/etc/init.d/cywifi.sh start
wpa_supplicant -B -Dnl80211 -iwlan0 -c /etc/wpa_supplicant.conf
/sbin/udhcpc -R -b -i wlan0

```

This works great after I log in. I have my network info in wpa\_supplicant.conf.

If I put those same commands in /etc/init.d/startlegato.sh between these two lines:

```
mount -o bind $LEGATO_MNT /legato
test -x $LEGATO_START && $LEGATO_START

```

The WiFi doesn’t seem to work, and I get these log statements:

```
Linux swi-mdm9x28-wp 3.18.140 #1 PREEMPT Tue Oct 8 00:58:07 UTC 2019 armv7l GNU/Linux
Cypress chip MMC recognition may have been overwritten
wlan0 interface was not created by Cypress drivers
Successfully initialized wpa_supplicant
Could not read interface wlan0 flags: No such device
nl80211: Driver does not support authentication/association or connect commands
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
Could not read interface wlan0 flags: No such device
wlan0: Failed to initialize driver interface

```

Any ideas what could be going wrong?

---

<div class="post-metadata">

**Author:** ![Zahid](https://avatars.discourse-cdn.com/v4/letter/z/e79b87/32.png) [@Zahid](https://mangoh.discourse.group/u/Zahid)\
**Post date:** [December 18, 2019, 7:33pm UTC](https://mangoh.discourse.group/t/mangoh-yellow-wifi-on-startup/3198/2 "2019-12-18T19:33:59Z")

</div>

Hi Nick,  
Please look at the script:

> <https://github.com/mangOH/mangOH/blob/master/linux_kernel_modules/cypwifi/scripts/cywifi.sh>

as if you are on a DV4 board as I am you should fail in trying to set wl\_reg\_on to the Cypress wifi  
chip as the sysfs entries are created by the expander driver in the mangOH modules:

> <https://github.com/mangOH/mangOH/blob/master/linux_kernel_modules/expander/expander.c>

which has definitely not been insmod/modprob’ed by Legato as you are trying to load the  
Cypress modules even before Legato has started fully (it is startlegato.sh that you are modifying).

I guess you could create a S99/S98 initscript that could make sure that the expander driver has created the proper gpio entry and then start the wifi as you want outside of Legato.

I am curious what you are trying to do and why you decided to not let Legato start wifi.  
We currently have the wifiService in a stop state by default, you could change the config settings to set it to start by default and it will probably be  
start by default as the data channel service (DCS) will start it automatically:  
[https://docs.legato.io/latest/legatoServicesDCS.html](https://docs.legato.io/latest/legatoServicesDCS.html)  
To use DCS to auto-start things, please remove the “{ start: manual }” from:

> <https://github.com/mangOH/mangOH/blob/master/wifi.sdef>

Let me know if you have any further questions/problems.

Zahid

---

<div class="post-metadata">

**Author:** ![nrcrast](https://avatars.discourse-cdn.com/v4/letter/n/ea666f/32.png) [@nrcrast](https://mangoh.discourse.group/u/nrcrast)\
**Post date:** [December 18, 2019, 8:07pm UTC](https://mangoh.discourse.group/t/mangoh-yellow-wifi-on-startup/3198/3 "2019-12-18T20:07:33Z")

</div>

Zahid,

All I’m really trying to do is get the MangOH Yellow to connect to my WiFi network on startup. I have been following this page: [https://github.com/mangOH/mangOH/tree/master/linux\_kernel\_modules/cypwifi](https://github.com/mangOH/mangOH/tree/master/linux_kernel_modules/cypwifi)

It is unclear to me what the best way to accomplish this is. I how does the legato wifi service know the SSID and password to use?

---

<div class="post-metadata">

**Author:** ![Zahid](https://avatars.discourse-cdn.com/v4/letter/z/e79b87/32.png) [@Zahid](https://mangoh.discourse.group/u/Zahid)\
**Post date:** [December 18, 2019, 9:50pm UTC](https://mangoh.discourse.group/t/mangoh-yellow-wifi-on-startup/3198/4 "2019-12-18T21:50:33Z")

</div>

Nick,  
Actually, the cypwifi README.md actually needs updating as it was based on Legato versions earlier  
than 19.04 which had the Tiwifi IoT card as the default way to start wifi on wlan0 and thus Cypress  
had to use wlan1. Since, 19.04 Legato allows other Wifi chips besides TI Wifi (Note, they all must be  
based on wlan0 - you cannot have multiple wifi interfaces - you would need to apply the Legato  
patches if you wanted that). Cypwifi is changing soon as the Linux kernel backports for cypwifi  
will be integrated with Bluez 5.52 backport kernel changes, so I think we will wait for that  
complete before updating the README.

I regards. to configuring wifi please see the following pages (first is the command-line tool and  
the second is the coding interface):  
[https://docs.legato.io/19\_01/wifi\_toolsTarget\_wifi.html#toolsTarget\_wifi\_clientExample](https://docs.legato.io/19_01/wifi_toolsTarget_wifi.html#toolsTarget_wifi_clientExample)  
[https://docs.legato.io/latest/c\_le\_wifi\_client.html](https://docs.legato.io/latest/c_le_wifi_client.html)

The wifi passphrases/creds are stored in secure storage in Legato releases after Legato 19.04.  
Thus, if you set the SSID/protocol/passphrase… on your target it should persist.

Zahid
