MT7697 Built In WiFi Problem

Hi, I am working with the WP77XX with Firmware release 11, Legato FW 18.09, and I am getting error when I try ifup wlan1

root@swi-mdm9x28:~# ifup wlan1
Setup MT7697 UART
Device: WP77
Enable power control
Initialized Linux WiFi modules
insmod: can’t insert ‘/legato/systems/current/modules/mt7697wifi_core.ko’: No such file or directory

I have followed the wiki (https://github.com/mangOH/mangOH/wiki/mangOH-Red-mt7697-WiFi) working in the VM. I also followed another thread (https://forum.mangoh.io/t/using-wifi-on-mangoh-red-wp76xx-running-legato-19-02-af/2766/3?u=jbroderick) assuming that building the WiFi module would add the required kernel modules. When trying to build mksys -t wp77xx wifi.sdef. I get the following error:

WARNING: "mt7697q_read" [/home/mangoh/legato_framework/WiFi/_build_wifi/wp77xx/modules/mt7697wifi_core/mt7697wifi_core.ko] undefined!
WARNING: "mt7697_uart_read" [/home/mangoh/legato_framework/WiFi/_build_wifi/wp77xx/modules/mt7697wifi_core/mt7697wifi_core.ko] undefined!
WARNING: "mt7697q_shutdown" [/home/mangoh/legato_framework/WiFi/_build_wifi/wp77xx/modules/mt7697wifi_core/mt7697wifi_core.ko] undefined!
WARNING: "mt7697_uart_close" [/home/mangoh/legato_framework/WiFi/_build_wifi/wp77xx/modules/mt7697wifi_core/mt7697wifi_core.ko] undefined!
WARNING: "mt7697_uart_write" [/home/mangoh/legato_framework/WiFi/_build_wifi/wp77xx/modules/mt7697wifi_core/mt7697wifi_core.ko] undefined!
WARNING: "mt7697q_unblock_writer" [/home/mangoh/legato_framework/WiFi/_build_wifi/wp77xx/modules/mt7697wifi_core/mt7697wifi_core.ko] undefined!
WARNING: "mt7697_uart_open" [/home/mangoh/legato_framework/WiFi/_build_wifi/wp77xx/modules/mt7697wifi_core/mt7697wifi_core.ko] undefined!
WARNING: "mt7697q_write" [/home/mangoh/legato_framework/WiFi/_build_wifi/wp77xx/modules/mt7697wifi_core/mt7697wifi_core.ko] undefined!
WARNING: "mt7697q_init" [/home/mangoh/legato_framework/WiFi/_build_wifi/wp77xx/modules/mt7697wifi_core/mt7697wifi_core.ko] undefined!

Thanks!

Hi @BroderickJack

Try with Legato 19.01. It worked for me. Note that I built a Legato system with just the kernel modules, patches and scripts from mangOH. I’ve attached my sdef fore reference. red_MT_wifi.sdef (2.6 KB) . You can softlink this to default.sdef

a:leaf_workspace$ leaf setup WP77_R11 -p swi-wp77_2.0.0
a:leaf_workspace$ leaf shell
(lsh:WP77_R11) a:leaf_workspace$ cd Legato_19.01/
(lsh:WP77_R11) a:legato-19.01.0$ export MANGOH_ROOT=(pwd) (lsh:WP77_R11) a:legato-19.01.0 export LEGATO_ROOT=(pwd) (lsh:WP77_R11) a:legato-19.01.0 patch -p1 < 0001-Add-mangOH-Red-mt7697-wifi-support.patch
(lsh:WP77_R11) a:legato-19.01.0$ cd modules/WiFi/
(lsh:WP77_R11) a:legato-19.01.0$ patch -p1 < 0001-Add-support-for-multiple-wlan-interfaces.patch
(lsh:WP77_R11) a:legato-19.01.0$ cd …/…
(lsh:WP77_R11) a:legato-19.01.0$ make wp77xx​
(lsh:WP77_R11) a:legato-19.01.0$ instsys build/wp77xx/system.wp77xx.update 192.168.2.2

Then I updated /etc/network/interfaces and added /etc/init.d/mtwifi,

root@swi-mdm9x28-wp:~# ifup wlan1
Setup MT7697 UART
[ 64.567047] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:1 cur:0 tx) bc(rx:0 tx:2) mode:FIFO slv_addr:0x3a MSTR_STS:0x0c1300c8 OPER:0x00000090
Device: WP77
Enable power control
Initialized Linux WiFi modules
[ 67.011548] mt7697serial mt7697serial: mt7697_uart_open(): open serial device ‘/dev/ttyHS0’
Initialized MT7697 WiFi core
[ 67.098377] mt7697core mt7697core: mt7697_interface_add(): added(‘wlan1’) type(2)
Started MT7697 WiFi uart core wlan1
root@swi-mdm9x28-wp:~#

My Wifi AP script mangOH-red-MT-wifi-AP.sh (7.4 KB) . You can change the APN and try it out.

Please update on how it goes for you.

Hi @Alegato thanks for getting back to me!

I followed your steps but when I get to make wp77xx I get a bunch of format-truncations errors:

usr/bin/gcc -Wall -Werror -o /home/jbroderick/Documents/CouncilRock/RS100/legato_workspace/legato-19.01.0/bin/mkPatch
mkPatch.c /home/jbroderick/Documents/CouncilRock/RS100/legato_workspace/legato-19.01.0/framework/liblegato/crc.c
-I/home/jbroderick/Documents/CouncilRock/RS100/legato_workspace/legato-19.01.0/framework/include
-I/home/jbroderick/Documents/CouncilRock/RS100/legato_workspace/legato-19.01.0/3rdParty/include
mkPatch.c: In function ‘main’:
mkPatch.c:1419:55: error: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size between 4045 and 4063 [-Werror=format-truncation=]
“cat patch.%u.cwe.hdr patch.%u.cwe >%s/patch-%s.cwe”,
^~
pid, pid, CurrentWorkDir, targetPtr );
~~~~~~~~~~~~~~
mkPatch.c:1418:9: note: ‘snprintf’ output 45 or more bytes (assuming 4140) into a destination of size 4096
snprintf( CmdBuf, sizeof(CmdBuf),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
“cat patch.%u.cwe.hdr patch.%u.cwe >%s/patch-%s.cwe”,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pid, pid, CurrentWorkDir, targetPtr );
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mkPatch.c:1154:60: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
snprintf(OrigName, sizeof(OrigName), “%s/%s”, CurrentWorkDir, OrigPtr);
^
mkPatch.c:1154:17: note: ‘snprintf’ output 2 or more bytes (assuming 4097) into a destination of size 4096
snprintf(OrigName, sizeof(OrigName), “%s/%s”, CurrentWorkDir, OrigPtr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mkPatch.c:1177:60: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
snprintf(DestName, sizeof(DestName), “%s/%s”, CurrentWorkDir, DestPtr);
^
mkPatch.c:1177:17: note: ‘snprintf’ output 2 or more bytes (assuming 4097) into a destination of size 4096
snprintf(DestName, sizeof(DestName), “%s/%s”, CurrentWorkDir, DestPtr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mkPatch.c:1230:60: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
snprintf(OrigName, sizeof(OrigName), “%s/%s”, CurrentWorkDir, OrigPtr);
^
mkPatch.c:1230:17: note: ‘snprintf’ output 2 or more bytes (assuming 4097) into a destination of size 4096
snprintf(OrigName, sizeof(OrigName), “%s/%s”, CurrentWorkDir, OrigPtr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mkPatch.c:1260:60: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
snprintf(DestName, sizeof(DestName), “%s/%s”, CurrentWorkDir, DestPtr);
^
mkPatch.c:1260:17: note: ‘snprintf’ output 2 or more bytes (assuming 4097) into a destination of size 4096
snprintf(DestName, sizeof(DestName), “%s/%s”, CurrentWorkDir, DestPtr);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mkPatch.c:1396:60: error: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size between 4048 and 4066 [-Werror=format-truncation=]
“cat patch.%u.hdr patch.%u.bin >>%s/patch-%s.cwe”,
^~
pid, pid, CurrentWorkDir, productPtr );
~~~~~~~~~~~~~~
mkPatch.c:1395:17: note: ‘snprintf’ output 42 or more bytes (assuming 4137) into a destination of size 4096
snprintf( CmdBuf, sizeof(CmdBuf),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
“cat patch.%u.hdr patch.%u.bin >>%s/patch-%s.cwe”,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pid, pid, CurrentWorkDir, productPtr );
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mkPatch.c:20:16: error: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size 4089 [-Werror=format-truncation=]
#define BSDIFF “bsdiff”
^~~~~~~~
mkPatch.c:1305:27: note: in expansion of macro ‘BSDIFF’
BSDIFF " %s %s patched.%u.bin.%d",
^~~~~~
mkPatch.c:1305:36: note: format string is defined here
BSDIFF " %s %s patched.%u.bin.%d",
^~
mkPatch.c:20:16: note: using the range [0, 4294967295] for directive argument
#define BSDIFF “bsdiff”
^~~~~~~~
mkPatch.c:1305:27: note: in expansion of macro ‘BSDIFF’
BSDIFF " %s %s patched.%u.bin.%d",
^~~~~~
mkPatch.c:1304:17: note: ‘snprintf’ output between 25 and 8234 bytes into a destination of size 4096
snprintf( CmdBuf, sizeof(CmdBuf),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BSDIFF " %s %s patched.%u.bin.%d",
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OrigName, tmpName, pid, patchNum );

Thanks!
Jack

HI @BroderickJack, I used a Ubuntu 16.04 64 bit with all latest updates. Also, please ensure that the cross compiler is setup correctly (leaf shell and then env to check the environment variables). My build machine details are below:

a:leaf_workspace$ leaf status
lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x Workspace: /home/a/leaf_workspace x
tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu
x Profile: WP77_R11 [current] (sync) x
tqqqqqqqqqqwqqqqqqqqqqqqqqqqwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu
x Packages x Identifier x Description x
tqqqqqqqqqqnqqqqqqqqqqqqqqqqnqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu
x Included x swi-wp77_2.0.0 x SDK for WP77 (Release 11 + Legato 18.09.2) x
mqqqqqqqqqqvqqqqqqqqqqqqqqqqvqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
Other profiles: WP76_R13, WP76_R13.1
a:leaf_workspace$ leaf shell
Leaf Shell /bin/bash started in Leaf environment.
(lsh:WP77_R11) a:leaf_workspace$ env
LEAF_SHELL_ORIGINAL_PROMPT=[\e]0;\u@\h: \w\a]${debian_chroot:+(debian_chroot)}\u:\W\$ LEAF_TIMEOUT=20 WP77XX_LEGATO_IMAGES=/home/a/leaf_workspace/leaf-data/WP77_R11/wp77-legato-image LEAF_PROFILE=WP77_R11 XDG_SESSION_ID=553 LEAF_SHELL=/bin/bash LEAF_SHELL_EXEC_COMMAND= LEAF_PLATFORM_MACHINE=x86_64 WP77XX_LINUX_IMAGES=/home/a/leaf_workspace/leaf-data/WP77_R11/wp77-linux-image SWI_LINUX_CLONE=/home/a/leaf_workspace/swi-linux-src TERM=xterm SHELL=/bin/bash SSH_CLIENT=10.4.94.167 50647 22 LEGATO_TOOLCHAIN_FULL_PREFIX=/home/a/leaf_workspace/leaf-data/WP77_R11/wp77-toolchain/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi- LEAF_SHELL_OLDPWD=/home/a/leaf_workspace LEAF_PLATFORM_SYSTEM=Linux LEGATO_SYSROOT=/home/a/leaf_workspace/leaf-data/WP77_R11/wp77-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi SSH_TTY=/dev/pts/19 LEAF_CACHE=~/.cache/leaf USER=a LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36: LEAF_CONFIG=~/.config/leaf LEGATO_UPDATE_FILE= LEAF_SHARED_DIR=/usr/share/leaf/packages/leaf-plugins_1.0/shell WP77XX_TOOLCHAIN_PREFIX=arm-poky-linux-gnueabi- LEAF_PLATFORM_RELEASE=4.15.0-54-generic MAIL=/var/mail/a PATH=/home/a/leaf_workspace/leaf-data/WP77_R11/wp77-legato/bin:/home/a/bin:/home/a/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin LEGATO_CONFIG_SCRIPT= QT_QPA_PLATFORMTHEME=appmenu-qt5 LEGATO_OBJECT_DIR= PWD=/home/a/leaf_workspace LEAF_USER_ROOT=~/.leaf LANG=en_US.UTF-8 LEAF_GPG_KEYSERVER=subset.pool.sks-keyservers.net LEAF_SHELL_DEFAULT=bash LEGATO_OUTPUT_DIR= LEAF_WORKSPACE=/home/a/leaf_workspace LEAF_SYSTEM_ROOTS=/usr/share/leaf/packages:~/.local/share/leaf/packages WP77XX_TOOLCHAIN_DIR=/home/a/leaf_workspace/leaf-data/WP77_R11/wp77-toolchain/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi LEAF_RETRY=5 LEAF_REMOTE_SMARTREFRESH=1 SHLVL=2 HOME=/home/a WP77XX_DEVICE_IMAGES=/home/a/leaf_workspace/leaf-data/WP77_R11/wp77-image LOGNAME=a LEAF_ORIGINAL_PROMPT_COMMAND= LEAF_VERSION=2.0.1 XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop SSH_CONNECTION=10.4.94.167 50647 10.3.58.8 22 LESSOPEN=| /usr/bin/lesspipe %s DEST_IP=192.168.2.2 WP77XX_MODEM_IMAGES=/home/a/leaf_workspace/leaf-data/WP77_R11/wp77-modem-image LEGATO_ROOT=/home/a/leaf_workspace/leaf-data/WP77_R11/wp77-legato XDG_RUNTIME_DIR=/run/user/1000 WP77XX_SYSROOT=/home/a/leaf_workspace/leaf-data/WP77_R11/wp77-toolchain/sysroots/armv7a-neon-poky-linux-gnueabi LESSCLOSE=/usr/bin/lesspipe %s %s LEGATO_TARGET=wp77xx GERRIT_USER=user@gmail.com _=/usr/bin/env (lsh:WP77_R11) a:leaf_workspace uname -a
Linux a-ThinkPad-X240 4.15.0-54-generic #58~16.04.1-Ubuntu SMP Mon Jun 24 13:21:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
(lsh:WP77_R11) a:leaf_workspace$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.6 LTS
Release: 16.04
Codename: xenial
(lsh:WP77_R11) a:leaf_workspace$