I just compiled 5.15-main branch on my computer and tried it on my R2. It appears to work, as I can get a DHCP address from my primary router. I can aslo ping my primary router, as well. However, pinging my computer that I’m SSH’ing from doesn’t work, nor does any internet site… (Sigh…)
I need to do more investigation to see what the problem with my configuration is… I’ll update once I figure out how to fix the problem…
Okay, I figured out what was going on. I forgot I needed a firewall rule to masquerade to the wifi internet connection… Had one for the WAN port, not the wireless interface… Also had to rewrite some of my firewall script in order to deal with lack of pings and masquerading interfaces, so this is a plus…
I also figured out how to bring the mt6625_0 and ap0 interfaces up before the networking services starts. In this way, those interfaces can be correctly configured by the networking services.
My /sbin/networking-helper.sh script:
#!/bin/bash
#############################################################################
# Bring the "eth0" interface up if not already up:
#############################################################################
ifconfig eth0 2> /dev/null | grep "UP," &> /dev/null || /sbin/ifup eth0 >& /dev/null
ifconfig eth1 2> /dev/null | grep "UP," &> /dev/null || /sbin/ifup eth1 >& /dev/null
#############################################################################
# Enable DBDC on any MT76xx wifi card that supports it:
#############################################################################
for file in /sys/kernel/debug/ieee80211/*; do
test -e $file/mt76/dbdc && echo 1 > $file/mt76/dbdc
done
#############################################################################
# Load support files for R2's onboard Wifi/BT hardware and set WiFi mode:
#############################################################################
if [[ ! -e /dev/wmtWifi ]]; then
/usr/bin/wmt_loader &> /var/log/wmtloader.log
sleep 3
fi
if [[ -c /dev/stpwmt ]]; then
if ! ps aux | grep stp_uart_launcher | grep -v grep >& /dev/null; then
/usr/bin/stp_uart_launcher -p /etc/firmware &> /var/log/stp_launcher.log &
sleep 5
fi
fi
modprobe wlan_gen2
[[ -f /var/run/wmtWifi ]] && echo 0 > /dev/wmtWifi && sleep 3
echo $([[ "${ONBOARD_WIFI:-"A"}" == "A" ]] && echo A || echo 1) | tee /var/run/wmtWifi > /dev/wmtWifi
#############################################################################
# Rename the WiFi interfaces on the MT76xx wifi card:
#############################################################################
cd /sys/class/net
LIST=($(ls -l | grep pcie | awk '{print $9}'))
if [[ ! -z "${LIST[@]}" ]]; then
for IFACE in ${LIST[@]}; do
DEV="$(lspci -s $(basename $(ls -l ${IFACE}/device | awk '{print $NF}')) | grep MEDIATEK | awk '{print $NF}')"
if [[ ! -z "${DEV}" ]]; then
[[ -f /sys/kernel/debug/ieee80211/$(basename $(ls -l ${IFACE}/phy80211 | awk '{print $NF}'))/mt76/dbdc ]] && POST=24g || POST=5g
NEW=mt${DEV}_${POST}
ip link set ${IFACE} name ${NEW}
iw dev ${NEW} interface add ${NEW}_0 type managed
REN=$(dmesg | grep ${NEW}_0 | head -1 | awk '{print $5}' | sed 's|:||g')
[[ "$REN" != "${NEW}_0" ]] && ip link set ${REN} name ${NEW}_0
fi
done
fi
#############################################################################
# Return error code 0 to the caller:
#############################################################################
exit 0
My /lib/systemd/system/networking.service.d/changes.conf:
[Service]
ExecStartPre=/sbin/networking-helper.sh
ExecStart=
ExecStart=/sbin/ifup -a --read-environment --exclude=eth0
Hopefully this will help someone…
These changes will allow the networking service to be restarted without the errors concerning the eth0 and/or eth1 interfaces… Speaking of which, eth1 and aux showed up while running kernel 5.15.11, while it didn’t on 5.10.76… Any insights to this?
Yes with masquerading you hide your wifi subnet…wifi clients reach your mainrouter with the subnet it knows.
It should be eth0 and aux and eth0/1 on older kernels (eth1 may be missing). Eth1/aux is same port but it needs some work to can use it. You can make a vlan-aware bridge to map wan-port to it an use both gmacs. This is becauae dsa core (which does the wan/lanX) only support 1 upstream/cpu port and the other cannot be used that easy
On r2 too? I thought this was only r64. But imho bootswitch makes only sense in 1 position (try sdcard first than emmc). But cannot try it on r2 as my version (1.1) has no bootswitch (non working bat connector)
I tried this tip on my copy of Debian 10 running kernel 5.15.11 and I saw a definite improvement. Also, if anybody is interested, I want to note that while the onboard wifi is in AP mode, you CAN create a client connection, but not both AP and client at the same time. Must be one or the other…
EDIT: I can create a DHCP client connection only on the mt6625_0 interface. Apparently, I cannot do so on the ap0 interface, even though iw list says that I should be able to (it supports managed mode).
2nd EDIT: Cannot get bluetooth up and running… Maybe you can do client and AP, haven’t tested the combination…
Right ap0 only supports accesspoint mode. Thanks for testing client mode. And yes only one connection is possible (ap or client).
For bluetooth: it is important that bluetooth module is loaded after wmt/stp tools are finished. See my wifi.sh. and it does not support btle (bt4.0+) only legacy bt
I’m guessing that I don’t have the necessary bluetooth module loaded at all.
EDIT: Found it! Running command modprobe stp_chrdev_bt allows me to see the bluetooth stuff. Thanks!
2nd Edit: Okay, following the advice of the wiki, I can get up to “hciconfig hci0 up” without issue. But when I try that command, I get this: Can’t init device hci0: Input/output error (5), Any thoughts?
3rd Edit: After starting the the wifi programs, then loadng modules, then the bluetooth service, I launched bluetoothctl. When I type in devices, it says No default controller available… Hmmmmm…
You should only try after clean bootup,not loading/unloading modules.and try my wifi.sh to bring all up…it loads bluetooth module too. If you need client-mode instead of ap you can exit script there.
did not see where driver should create this…seems to be done only in core
./net/bluetooth/hci_core.c in hci_debugfs_create_basic, seems not breaking anything
I see this in my kernel logs as well. I’ll compile 5.4 and 4.19 to see if they work… Probably will get back to this thread tomorrow, as it is almost my bedtime…
Well, neither brand wants to compile for me. Need to repull the repo (again) and try compiling again… My vacation starts tomorrow after I finish with work, so I’ll be able to devote some more time (unlike today)…