Where should I copy the WMT_SOC.cfg file to? There is no folder named “system” on my SD card (it is Your ubuntu-18.04-bpi-r2-preview.img … thank You for that too).
The file bpi-r2_4.18.0-rc1_rc.tar.gz does not yet contain the last commit from main-branch?
create a /etc/hostapd/hostapd_ap0.conf and run wifi.sh
for automatic creation this is simply done:
wmt_loader.c:18++
#define WCN_COMBO_LOADER_DEV "/dev/wmtdetect"
gLoaderFd = open(WCN_COMBO_LOADER_DEV, O_RDWR | O_NOCTTY);
// Get Device ID
chipId = ioctl(gLoaderFd, COMBO_IOCTL_GET_SOC_CHIP_ID, NULL);
// Set Device ID
iRet = ioctl(gLoaderFd, COMBO_IOCTL_SET_CHIP_ID, chipId);
// do module init
iRet = ioctl(gLoaderFd, COMBO_IOCTL_DO_MODULE_INIT, chipId);
these values are handled here:
drivers/misc/mediatek/connectivity/common/common_detect/wmt_detect.c:83 static long wmt_detect_unlocked_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
so we need to place the wmtloader-code in wmt_detect.c instead of waiting for a file-operation
I’m trying to get things working on OpenWrt with 3.14 kernel and those drivers on top and having some problems with that. Either a device cannot connect claiming WPA handshake failed or, sometimes, it can connect but then works only for a couple of minutes, gets disassociated and continues to fail WPA handshakes then. I have custom patches that rename interfaces (to get OpenWrt play better with them) but apart from that it’s effectively @frank-w 's drivers port[1]. Any idea what is going wrong? Errors on hostapd side are pretty vague:
root@abbradarrouter:~# hostapd hostapd-mtkp2p0.conf
Configuration file: hostapd-mtkp2p0.conf
mtkap0: interface state UNINITIALIZED->COUNTRY_UPDATE
mtkap0: interface state COUNTRY_UPDATE->HT_SCAN
Using interface mtkap0 with hwaddr 02:08:22:00:0b:c6 and ssid "foo"
mtkap0: interface state HT_SCAN->ENABLED
mtkap0: AP-ENABLED
mtkap0: STA c4:0b:cb:85:b9:3b IEEE 802.11: associated
mtkap0: AP-STA-CONNECTED c4:0b:cb:85:b9:3b
mtkap0: STA c4:0b:cb:85:b9:3b WPA: pairwise key handshake completed (RSN)
mtkap0: STA c4:0b:cb:85:b9:3b IEEE 802.11: disassociated
mtkap0: AP-STA-DISCONNECTED c4:0b:cb:85:b9:3b
mtkap0: STA c4:0b:cb:85:b9:3b IEEE 802.11: associated
mtkap0: STA c4:0b:cb:85:b9:3b IEEE 802.11: disassociated
mtkap0: STA c4:0b:cb:85:b9:3b IEEE 802.11: associated
mtkap0: STA c4:0b:cb:85:b9:3b IEEE 802.11: disassociated
mtkap0: STA c4:0b:cb:85:b9:3b IEEE 802.11: associated
mtkap0: STA c4:0b:cb:85:b9:3b IEEE 802.11: disassociated
My hostapd configuration is pretty much barebones:
I’ve built a full-featured hostapd which has a debug log[1]. It’s as if at some point the chip stops sending and receiving messages. Notice that the first (successful) connection when during key exchange there are EAPOL_RX events and the next ones when there are no such events at all and key exchange timeouts.
I’ve tried installing haveged and also looked at diff between my and yours dts-es – there were some changes which I ported but it made no difference. If you have the radio working, can you show me your dmesg from the moment when you run wmt_loader till you have connection for some time?
Nah, that’s not going to help after all – I thought the problem is in Cannot find pinctrl defaulterror but I managed to solve it and nothing has changed.
Does anyone have a stable connection (by that I mean that fast.com running some time doesn’t kill the AP)? If so, on what kernel and did you make any tweaks to hostapd.conf or something else? I’m trying to get results with the official LEDE image now to see what’s different.
I’ve tested more and it turns out it works normally on official LEDE image. It’s also broken without my custom changes to connectivity driver meaning that possible reasons are:
I’ve forgot to take some change from @frank-w’s tree;
It doesn’t work on 4.14 at all.
Unfortunately I can’t just test @frank-w’s kernel because it’s not trivial to make OpenWrt run on it.
@frank-w@garywang how is combo chip connected to the CPU? I think which .dts changes may be relevant; I didn’t yet port fixes for SDIO for example. Could that be relevant?
In my mutiple tries to port (4.14, 4.16, 4.17, 4.18) i got no ap0 device if i forgot anything in dts(i).
Wifi-chip (mt6626l) is connected via btif (similar to uart). If this node is wrong (different compatible or clock) kernel crashes. If main-node is disabled you get timeout on echo A.
the problem looks more like wpasupplicant or similar is running (or just installed). Try to remove that if you found it
@abbradar how do you solve “Cannot find pinctrl default”-Error? I looked in hostapd-log on my router and found no eapol timeouts
From my very limited understanding on newer kernels when there’s only one pinctrl state entry it’s placed under PINCTRL STATE DEFAULT. Anyway this doesn’t change anything, and I’m not even sure that’s needed – I think it’s done automatically by the kernel when there’s only one entry. Notice that this is all half-assumptions! Just to be sure earlier I listed all state entries in that place – only default is there.
and the interesting (with modified mac-adresses) hostapd_ap0.log:
hostapd_ap0.tar.xz (21,8 KB)
the logfiles (hostapd.log) is from the last 11 days, so it shows many entries…i have not figured out yet, how to add timestamp while redirecting, so it’s the plain output of “hostapd -dd”
After some more experiments: it turns out even an image built from official Banana Pi repository[1] has this bug. @frank-w can you confirm that downloading a file at ~15-20mbps for several minutes works for you? Do you use any kind of rate limiting as suggested by official Getting Started guide (quote below)? If you don’t have this problem, can you share your hostapd.conf?
If your Ap is not stable, please limit the speed, here I limit download speed as 8Mbit/s, upload as 4Mbit/s
tc qdisc add dev ap0 root handle 1: htb default 11
tc class add dev ap0 parent 1:1 classid 1:2 htb rate 8Mbit ceil 4Mbit prio 2
More experiments: I’ve enabled debug mode in wifi drivers. Problems start when those lines appear in dmesg:
I have only dsl with 12mbit down…but i have downloaded larger files which take more than 30 minutes or downloaded files with near 1gb from pi directly without disconnects
My hostapd.conf (changed wpa-pass):
#ctrl_interface=/var/run/hostapd
#ctrl_interface_group=0 # These 2 are just parameters so that the hostap daemon runs.
#interface=wlan1
interface=ap0
driver=nl80211
ssid=r2_AP0
hw_mode=g
channel=1
#macaddr_acl=0
auth_algs=1
#ignore_broadcast_ssid=0
wpa=2
wmm_enabled=1
wpa_passphrase=12345678
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
[07:31] frank@bpi-r2-e:~$
Interesting… maybe I have a hardware problem then. I’ve tested my new setup for some time and it seems to work without any problems. If you are interested I have several patches atop Mediatek drivers which fix building them as a module, redo phy creation so that it happens only along with dev and rename interfaces and phys so that they don’t conflict with other devices. Patches are in my openwrt tree + https://github.com/abbradar/mt6625l-wlan-gen2
I’ve also updated my openwrt pull request - wifi should be working out of the box now there.
Have you added my changes to make it compatible for 4.14 and 4.16/4.18?
Have you removed bluetooth/gps/fm?
Have driver autoload (without wmt-tools) and how to switch between client/ap-mode?
it seems that you have changed folder structure…i have 2 folders on top
Have you depencies (watchdog,genl,…) and dts(i) changes also in your repo?
How to integrate to kernel-tree (only add entry in makefile/kconfig)? Then i can try your modified driver on my r2
Btw. Have you tried with my 4.14 version?
and what does “PINCTRL STATE DEFAULT” mean in above patch? i can’t believe this compiles…or are there underscores instead of spaces (PINCTRL_STATE_DEFAULT exists)?
You mean changes for the connectivity driver? I did some for new cfg80211 but nothing more, possibly more changes are required for 4.16+.
Nope, I left them as is. The reason why I split the wifi module into a separate repository is because OpenWrt has its own out-of-tree mac80211 module with updates from later kernels and all wireless drivers are supposed to be compiled as an out-of-tree packages against it. It’s the reason why I fixed its compilation as a module too. I imagine Bluetooth can be compiled in as usual.
I didn’t implement client mode switch yet, that will need more work. I didn’t avoid wmt-tools, instead I implemented an OpenWrt service which does all the initialization. You can see what it does here.
Same reasons as in (2)-- I changed it a bit so that it can be compiled out-of-tree.
What’s genI? I did port watchdog changes as an OpenWrt kernel patch – basically it’s a commit from your tree.
OpenWrt compiles it by itself as a module. I’d suggest you extract my patches from this repo and apply them to drivers/misc/mediatek/connectivity/wlan/gen2 subdirectory.
Nope, my goal was to upstream this support to OpenWrt and this required making patches to the current OpenWrt mediatek kernel, honoring their out-of-tree mac80211 module etc.
Ah, yes, sorry! The truth is that I already lost the patch when you asked it so I quickly redid it from memory and made an error. You are right, it should have been PINCTRL_STATE_DEFAULT instead.
changes in include/uapi/linux/genetlink.h / include/net/genetlink.h …ok, there are part from the full patch (0232-merge-mt6625l-wifi-driver.patch) but i havn’t seen them in you separated driver
what about the dts(i)-changes?
can i easily include you code into my tree for testing? which patch should i include? i only one big patch for the full driver…maybe i can use your separated driver…
i see you use the wmt-tools too…i hoped you kick them
The reason I split changes between the kernel and the driver is because of how OpenWrt does things. I can get them all together in one kernel tree later, so that it becomes easier to work. If you are interested I can take a look at Monday.