MangOH Yellow - WiFi on Startup

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?

Hi Nick,
Please look at the script:

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:

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
To use DCS to auto-start things, please remove the “{ start: manual }” from:

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

Zahid

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

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?

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/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