TP-Link has recently released the TL-WR902AC - a successor to the TL-MR3020 portable router (I am a big fan of the MR3020 which I use it as a private network and local VPN endpoint when I am travelling). I would love to see this new router supported by LEDE, if possible. Does anyone know if this is likely to gain support sometime soon and/or if there are any major issues blocking support?
The new device adds 802.11ac support with both 2.4G and 5G radios. According to WikiDevi, it uses a Qualcomm Atheros QCA9531 SoC and has 8MB flash + 64MB RAM, and has a default firmware OS that is Linux 2.6.31 based. Like the older model, it also has a USB A port for 3G/4G sticks or storage (or with OpenWRT/LEDE, pretty much any supported USB device). It retails for US$45.
However, I found that there is a catch: If you flash the device with the factory bin and then try to re-flash it via LUCI again with the factory image, it won't boot but instead go into a boot loop with this message:
is_auto_upload_firmware=0
Autobooting in 1 seconds
## Booting image at 9f020000 ...
Uncompressing Kernel Image ... Stream with EOS marker is not supportedLZMA ERROR 1 - must RESET board to recover
U-Boot 1.1.4 (Sep 5 2016 - 15:55:05)
ap143-2.0 - Honey Bee 2.0
When I modify the image, I found it is often better to flash the device with the factory image again instead of the sysupgrade image, in case the layout changes. With OpenWRT, this always worked.
Maybe that is a side-effect of the "metadata" image, such that factory can only be flashed by uBoot and sysupgrade by LEDE itself? Even if that was the case, LEDE should deny flashing the factory image again.
Factory image is dedicated only for flashing from vendor firmware!
And it's nothing new, it's always been like that.
No, this is definitely not right. Maybe it worked with other TP-Link devices (the older ones) which factory and sysupgrade images differ only in stripped (or not) padding. You should never use factory image to upgrade/re-flash LEDE/OpenWrt image, sysupgrade is for that, only.
No... and yes. When we finally switch (someday) to metadata-only sysupgrade images, you would need to use force mode to sysupgrade to image which doesn't contain metadata or device isn't included inside the metadata supported devices list. As we don't force metadata yet in ar71xx and for this board I didn't include any additional image check in platform_check_image(), you can actually upgrade to any image... maybe I will add at least header check so that people like you won't be able to (easy) break their devices.
Yep, the commit in your staging tree is a quick win for me and my customers - I have to switch to the TL-WR902AC because the TL-MR3020 is EOL. I saw the other commit for the additional LED, too.
... and suddenly, the stability of this device increases ten-fold over stock f/w! Massive thanks
One thing I've not manage to figure out ... any ideas how to access the status of the 3-posn switch? I can see there is some GPIO code for it in the commit, but being new to OpenWrt and Lede, don't know where to look for this (I found the LEDs and the WPS button - I assume I'm close?!)
Untested on the TL-WR902AC (I plan to get one of these soon, but haven't had time to do this yet)...
For boot-time detection of that switch, I am running a few scripts on my TL-MR3020 running LEDE 17.01.2 (I don't recall where I found the basis for this, but if you search for the MR3020 switch with OpenWRT, you may find similar things):
Don't forget to add execute permissions to the scripts.
/sbin/slidesw_check
#!/bin/sh
check_mode_sw() {
sw1='grep -qe sw1.*in.*hi /sys/kernel/debug/gpio'
sw2='grep -qe sw2.*in.*hi /sys/kernel/debug/gpio'
if $sw2 ; then
if $sw1 ; then
swmode="AP"
else
swmode="WISP"
fi
else
swmode="3G"
fi
echo $swmode
}
mode=$( check_mode_sw mode )
echo "$mode"
/sbin/boot_mode_script
#!/bin/sh
case $1 in
"AP")
# Do your AP-mode stuff here
;;
"WISP")
# Do your WISP-mode stuff here
;;
"3G")
# Do your 3G-mode stuff here
;;
esac
/etc/init.d/Boot_Mode
#!/bin/sh /etc/rc.common
START=11
start() {
mode=$( slidesw_check )
echo $mode > /boot_mode # write the status to /boot_mode for troubleshooting and/or use with other scripts
/sbin/boot_mode_script $mode
}
You may need to tweak these things for the WR902AC. And if you want to do real-time (post-boot) detection of this switch, it should be possible to do this in the hotplug section.
Please report back about any successes and/or issues.
I got hold of the factory bin from the device page and flashed that using
the TP-Link stock web page. Subsequent flashing will require the sysupdate
image.
I've had a little play and have something (a little inelegant) that can start at boot and will monitor the position of the switch in real time (well, every second!) Thought I'd share ....
#! /bin/sh
while true; do
val=$(grep 'sw[12]' /sys/kernel/debug/gpio | cut -c 59-61)
val=$(echo $val | sed 's/hi/1/g;s/lo/0/g;s/\s//g' | awk 'func b2d(i, t,a,c){a=1;for(c=length(i);c>0;c--){t+=substr(i,c,1)=="1"?a:0 ;a*=2}return t}{printf "%d\n",b2d($1)}')
case $val in
1)
# Do Share ETH stuff here
;;
2)
# Do Share Hotspot stuff here
;;
3)
# Do AP / Range Extender / Client stuff here
;;
default)
# Should never get here!
;;
esac
sleep 1
done