Support for WAVE 300 Wi-Fi chip

Almost dead

Hello @garlet

Here is the latest acheiving from my side.

I was able to compile this source driver for openwrt v18.06.6 (in openwrt v19 it failed) following these instructions from @suleiman.

To launch the driver you need the firmware files https://ufile.io/f/4bbft but not all of them, it depends on the hardware you are working what I did was to launch the driver at first with nothing and then check the logs everytime it crashes it asks for a specific one so I kept adding them till the driver launched correctly.

About hostapd, I managed to compile the one provided by @vittorio88 in the begining of the thread and launch it manually but I believe the one that comes with openwrt could be used if patched but as I have no idea about coding I didn't do it.

About the firmware files, the ones that worked are from version 3.4.2 and they worked fine but unfortunately the don't have the file sta_upper_wave300.bin which gives the option to have sta mode, @suleiman has done something here to make it work.

I hope this helps.
Cheers

1 Like

Thanks, do you have the 39_RevA files?
ProgModel_BG_nCB_39_RevA_wave300.bin and ProgModel_BG_nCB_wave300.bin

I found some more firmware files that contain this one and more

1 Like

(this is the updated post)
Hi, after reading this topic, and before start working on the code, I will recap what happened, so I can be in the correct path and new people can understand what is going on.

First @ vittorio88, @pc2005, @ Mandrake-Lee and @ ahmar16 made the driver connect but without encryption. For this it is required:

  • Kernel 4.9 (OpenWrt 18.06.x) compiled with debug options (or it crashes the router after: insmod mtlkroot.ko cdebug=3; insmod mtlk.ko ap=1);
  • Build the driver and copy the firmware files to /lib/firmware.

Then @pc2005 posted a new source that @Smim0 was able to build and connect with encryption enabled. For this it is required:

  • Kernel compiled with PCIE-MSI and some patches applied;
  • Additional firmware files ProgModel_BG_nCB_39_RevA_wave300.bin and ProgModel_BG_nCB_wave300.bin;
  • Compile hostapd source and wpa_supplicant with: changing CONFIG_TLS to internal, disabling all CONFIG_EAP* in hostapd/.config, removing all flags of -ltommat, and hostapd config file should have the line driver=mtlk;

Meanwhile @suleiman made the driver work with a back-port of rflib, pci express interrupt polling and hostapd_08x patches, on a standard OpenWrt image, but did not posted the patches yet.

Then I forked ahmar20 and made scripts that compiles openWrt v19.07.6 and wave300 with @suleiman instructions, being able to get a DHCP IP, but did not manage to access the internet and set encryption.

Thank you all for this hard work done.

Hi,

Successfully build OpenWrt 19.07.7, wave300 and hostapd+wpa_supplicant(new script).
I included some kernel modules (kmod-cfg80211 kmod-lib80211 kmod-mac80211 kmod-mac80211-hwsim [script is not doing this] ) on the image, because opkg complains about kernel version, even after setting the repository to my local nginx folder.

I can connect to the router, enter password and receive DHCP IP, but still not have access to internet or LAN. I am using the following commands:

insmod mtlkroot.ko cdebug=3
insmod mtlk.ko ap=1  
iwpriv wlan0 sCountry ____
iwpriv wlan0 sMAC ____
iwpriv wlan0 sBridgeMode 1 # ?
iwpriv wlan0 gBridgeMode 1 # ?
iwconfig wlan0 essid ____
iwconfig wlan0 key _____
./mtlk-ap config.conf

Does anyone had those issues? ( connectivity and opkg kernel version )

Thx

are you able to reach other devices in lan?

may I try your build @garlet?

Hi,

@targa, you can build it with: scripts remember to include kernel modules (kmod-cfg80211 kmod-lib80211 kmod-mac80211 kmod-mac80211-hwsim [script is not doing this] ), do you like me to upload the binaries?

@Smim0, with and without encryption, It does not access: internet, lan or the router.

Now LuCI is showing wireless tabs, but the configs seems to do nothing.

I didn't found anything strange on the following output and files:

root@OpenWrt:/lib/modules# ./mtlk-ap config.conf
Configuration file: config.conf
wlan2: interface state UNINITIALIZED->COUNTRY_UPDATE
Using interface wlan2 with hwaddr 12:34:56:78:90:ab and ssid "htest"
wlan2: interface state COUNTRY_UPDATE->ENABLED
wlan2: AP-ENABLED 
wlan2: STA 36:94:90:51:69:2a IEEE 802.11: associated
wlan2: AP-STA-CONNECTED 36:94:90:51:69:2a
wlan2: STA 36:94:90:51:69:2a RADIUS: starting accounting session BBCDBB3EB3057760
wlan2: STA 36:94:90:51:69:2a WPA: pairwise key handshake completed (WPA)
wlan2: STA 36:94:90:51:69:2a WPA: group key handshake completed (WPA)
root@OpenWrt:/lib/modules# rm /etc/config/wireless && wifi config && cat /etc/config/wireless

config wifi-device 'radio0'
        option type 'mac80211'
        option channel '36'
        option hwmode '11a'
        option path 'virtual/mac80211_hwsim/hwsim0'
        option htmode 'VHT80'
        option disabled '1'

config wifi-iface 'default_radio0'
        option device 'radio0'
        option network 'lan'
        option mode 'ap'
        option ssid 'OpenWrt'
        option encryption 'none'

config wifi-device 'radio1'
        option type 'mac80211'
        option channel '36'
        option hwmode '11a'
        option path 'virtual/mac80211_hwsim/hwsim1'
        option htmode 'VHT80'
        option disabled '1'

config wifi-iface 'default_radio1'
        option device 'radio1'
        option network 'lan'
        option mode 'ap'
        option ssid 'OpenWrt'
        option encryption 'none'
root@OpenWrt:/lib/modules# cat /etc/config/firewall
config defaults
        option syn_flood        1
        option input            ACCEPT
        option output           ACCEPT
        option forward          REJECT
# Uncomment this line to disable ipv6 rules
#       option disable_ipv6     1

config zone
        option name             lan
        list   network          'lan'
        option input            ACCEPT
        option output           ACCEPT
        option forward          ACCEPT

config zone
        option name             wan
        list   network          'wan'
        list   network          'wan6'
        option input            REJECT
        option output           ACCEPT
        option forward          REJECT
        option masq             1
        option mtu_fix          1

config forwarding
        option src              lan
        option dest             wan

# We need to accept udp packets on port 68,
# see https://dev.openwrt.org/ticket/4108
config rule
        option name             Allow-DHCP-Renew
        option src              wan
        option proto            udp
        option dest_port        68
        option target           ACCEPT
        option family           ipv4

# Allow IPv4 ping
config rule
        option name             Allow-Ping
        option src              wan
        option proto            icmp
        option icmp_type        echo-request
        option family           ipv4
        option target           ACCEPT

config rule
        option name             Allow-IGMP
        option src              wan
        option proto            igmp
        option family           ipv4
        option target           ACCEPT

# Allow DHCPv6 replies
# see https://dev.openwrt.org/ticket/10381
config rule
        option name             Allow-DHCPv6
        option src              wan
        option proto            udp
        option src_ip           fc00::/6
        option dest_ip          fc00::/6
        option dest_port        546
        option family           ipv6
        option target           ACCEPT

config rule
        option name             Allow-MLD
        option src              wan
        option proto            icmp
        option src_ip           fe80::/10
        list icmp_type          '130/0'
        list icmp_type          '131/0'
        list icmp_type          '132/0'
        list icmp_type          '143/0'
        option family           ipv6
        option target           ACCEPT

# Allow essential incoming IPv6 ICMP traffic
config rule
        option name             Allow-ICMPv6-Input
        option src              wan
        option proto    icmp
        list icmp_type          echo-request
        list icmp_type          echo-reply
        list icmp_type          destination-unreachable
        list icmp_type          packet-too-big
        list icmp_type          time-exceeded
        list icmp_type          bad-header
        list icmp_type          unknown-header-type
        list icmp_type          router-solicitation
        list icmp_type          neighbour-solicitation
        list icmp_type          router-advertisement
        list icmp_type          neighbour-advertisement
        option limit            1000/sec
        option family           ipv6
        option target           ACCEPT

# Allow essential forwarded IPv6 ICMP traffic
config rule
        option name             Allow-ICMPv6-Forward
        option src              wan
        option dest             *
        option proto            icmp
        list icmp_type          echo-request
        list icmp_type          echo-reply
        list icmp_type          destination-unreachable
        list icmp_type          packet-too-big
        list icmp_type          time-exceeded
        list icmp_type          bad-header
        list icmp_type          unknown-header-type
        option limit            1000/sec
        option family           ipv6
        option target           ACCEPT

config rule
        option name             Allow-IPSec-ESP
        option src              wan
        option dest             lan
        option proto            esp
        option target           ACCEPT

config rule
        option name             Allow-ISAKMP
        option src              wan
        option dest             lan
        option dest_port        500
        option proto            udp
        option target           ACCEPT

# include a file with users custom iptables rules
config include
        option path /etc/firewall.user


### EXAMPLE CONFIG SECTIONS
# do not allow a specific ip to access wan
#config rule
#       option src              lan
#       option src_ip   192.168.45.2
#       option dest             wan
#       option proto    tcp
#       option target   REJECT

# block a specific mac on wan
#config rule
#       option dest             wan
#       option src_mac  00:11:22:33:44:66
#       option target   REJECT

# block incoming ICMP traffic on a zone
#config rule
#       option src              lan
#       option proto    ICMP
#       option target   DROP

# port redirect port coming in on wan to lan
#config redirect
#       option src                      wan
#       option src_dport        80
#       option dest                     lan
#       option dest_ip          192.168.16.235
#       option dest_port        80
#       option proto            tcp

# port redirect of remapped ssh port (22001) on wan
#config redirect
#       option src              wan
#       option src_dport        22001
#       option dest             lan
#       option dest_port        22
#       option proto            tcp

### FULL CONFIG SECTIONS
#config rule
#       option src              lan
#       option src_ip   192.168.45.2
#       option src_mac  00:11:22:33:44:55
#       option src_port 80
#       option dest             wan
#       option dest_ip  194.25.2.129
#       option dest_port        120
#       option proto    tcp
#       option target   REJECT

#config redirect
#       option src              lan
#       option src_ip   192.168.45.2
#       option src_mac  00:11:22:33:44:55
#       option src_port         1024
#       option src_dport        80
#       option dest_ip  194.25.2.129
#       option dest_port        120
#       option proto    tcp

thx

for me it sounds like it is not bridged,
can you try manually

 iwpriv wlan0 sBridgeMode=1

or

 iwpriv wlan0 gBridgeMode=1

Hi, still but no connectivity yet, tried:

  • iwpriv wlan0 sBridgeMode=1; iwpriv wlan0 gBridgeMode=1

Made another script for loading and coping drivers and firmware.
I uploaded the firm-wares that I have, but I lost "ap_upper_wave300" from your set( smim0 folder).
I believe that compiling without selecting the modem, keeps opkg magic number compatible,
because it installed local packages.
The module kmod-mac80211-hwsim is a simulator, that was giving some fake functionality.
Now "wifi config" don't work, probably because "iw list" returns: nl80211 not found.

Thx

Hi,

Got connection to lan/internet without encryption with the command:

brctl addif "br-lan" "wlan0"
ifconfig wlan0 up

When I try to establish encryption with hostapd and the wlan0 added to the bridge, it reject the connection with wrong password.

The hostapd(mtlk-ap) at the benjamin repo, is a modified version of hostapd 2.7, that can accept the wave300 driver. Probably this patch may be applied to the current 2.9 version.

The command "wifi config" will not work because the driver does not provide the newer mac80211 API, it uses the WEXT API (old and only receiving bug updates).
This also means that LuCI will not interact with it, but I believe that the script mltk.sh could do that, hostapd, bridge and /etc/config/wireless.

Sorry @garlet , I missed your answer, will try.

EDIT: Maybe you can upload the binaries, please. I have no current development system ready, and haven't done a build for quite a while. Thanks a lot.

Hi, good news!!

Connection with WPA2. Speed with google test is ~ 5.5 Mbps. Did not test iperf3 yet.

Before succeed, there was a client disconnection error that vanished. hostapd error head file.
I believe I was missing a reboot, brctl command and bridge=br-lan hostapd config.

@vittorio88, @Mandrake-Lee do you remember at what point the new cfg80211 API implementation was? and do you know if the following is correct:

The hostapd(mtlk-ap) at the benjamin repo, is a modified version of hostapd 2.7, that can accept the wave300 driver. Probably this patch may be applied to the current 2.9 version.

@targa can you first test my compile script? (its built to do everything automatic)

THX

Sorry, I have too many projects running at the same time.

@garlet: I running Ubuntu 18.04 and needed to prepare some things:

  • place a softlink from libncurses.so to libncursesw.so
  • softlink from openwrt git folder to /home/cross/openwrt5
  • install a couple of libs

but apparently some of the required libs my system has installed already, but they're not recognized, seems I need some more preparations.

Check the build_openwrt.sh script, run and it will do everything, unless some bug appears. After that, build_wave300, then build_hostapd. I got the same OS.

Yeah, you're right, something went wrong, I started over (actually on another Bionic machine for no specific reason) and I come into ncurses menues without any "disturbance" now.
But now I see that ATH79 is configured as target architecture, I would have expected this to be Lantiq ?

Still getting the lib dep warnings (see below):

/Tomas

WARNING: Makefile 'package/utils/busybox/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/busybox/Makefile' has a build dependency on 'libpam', which does not exist
WARNING: Makefile 'package/boot/kexec-tools/Makefile' has a dependency on 'liblzma', which does not exist
WARNING: Makefile 'package/network/services/lldpd/Makefile' has a dependency on 'libnetsnmp', which does not exist
WARNING: Makefile 'package/utils/policycoreutils/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/policycoreutils/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/policycoreutils/Makefile' has a build dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/busybox/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/busybox/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/busybox/Makefile' has a build dependency on 'libpam', which does not exist
WARNING: Makefile 'package/boot/kexec-tools/Makefile' has a dependency on 'liblzma', which does not exist
WARNING: Makefile 'package/network/services/lldpd/Makefile' has a dependency on 'libnetsnmp', which does not exist
WARNING: Makefile 'package/utils/policycoreutils/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/policycoreutils/Makefile' has a dependency on 'libpam', which does not exist
WARNING: Makefile 'package/utils/policycoreutils/Makefile' has a build dependency on 'libpam', which does not exist

build_openwrt went through (with above warnings), but build_wave300 not.

checking for target kernel package... /home/eddtomu/openwrt/build_dir/target-mips_24kc_musl/linux-lantiq_xrx200/linux-4.14.221
checking for target kernel compiler... configure: error: Target kernel compiler not found
Makefile:102: recipe for target '.config.h' failed
make: *** [.config.h] Error 1
ERROR: no .config file found!
Run make xconfig or make menuconfig first to generate .config file!

speaker-test 1.1.3

Playback device is default
Stream parameters are 48000Hz, S16_LE, 1 channels
Sine wave rate is 250,0000Hz
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 192 to 2097152
Period size range from 64 to 699051
Using max buffer size 2097152
Periods = 4
was set period_size = 524288
was set buffer_size = 2097152
 0 - Front Left
Time per period = 10,939857
 ***** after placing firmware files at /lib/firmware
 ***** copy and insmod in your router the following files:
ls: cannot access '/home/eddtomu/wave300/builds/ugw5.4-vrx288/binaries/wls/driver/*.ko': No such file or directory

i got rid of the missing .config by calling the script from wave300 directory, but the other error hints me, I'm lacking the crosscompiler, right ?

Yes, it's not ATH, the code: (build_openwrt)

if [[ $branch > "v19.07.0" ]] || [[ $branch == "v19.07.0" ]]
    then
        wget https://downloads.openwrt.org/releases/${branch:1}/targets/lantiq/xrx200/config.buildinfo -O .config
    else
        if [[ $branch < "v18.06.4" ]] || [[ $branch == "v18.06.4" ]] 
        then
            wget https://downloads.openwrt.org/releases/${branch:1}/targets/lantiq/xrx200/config.seed -O .config
        else
            wget https://downloads.openwrt.org/releases/18.06.4/targets/lantiq/xrx200/config.seed -O .config
        fi
    fi

Should download the official configuration for the wave300 routers, it compiles all of them. You can set for only your router, but I believe that doing it, changes the opkg magic check.
If the official config are set, the openwrt make menuconfig, will display the lantiq architecture.
I got some warning too, I think they are the same.
Good luck