Plans for OpenWrt to support TP-Link TL-WR902AC?

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.

TL-WR902AC
Wikidevi info on the TL-WR902AC

Thanks.

Is there any news on supporting/ porting for this device?

As long as nobody provides any useful data to add support, there will be no activities in this regard.

How to gather useful data: https://lede-project.org/docs/guide-developer/adding_new_device#tips_and_tricks

Support for TL-WR902AC v1 is ready in my stagging tree:
https://git.lede-project.org/?p=lede/pepe2k/staging.git;a=summary

@pepe2k - That's great news! Thanks! Will this eventually be merged into the main branch and integrated in a future major update (i.e. 17.01.3)?

In master, yes, but I won't backport it to 17.01 branch.

Snapshot support added today, firmware images are available at https://downloads.lede-project.org/snapshots/targets/ar71xx/generic/

Nice work, indeed!

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.

Thanks, works great.
Set the router up as WPA2-supplicant media bridge with relayd, works like a charm.

Thanks for feedback!

I just found out that this device has another one LED... tiny one, inside RJ45 socket :smiley:

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.

Again: Great work!

Hi - is the 5ghz radio supported?

Yes it is.

... and suddenly, the stability of this device increases ten-fold over stock f/w! Massive thanks :slight_smile:

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?!)

@g0wfv

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.

1 Like

Thanks.

Can confirm the switch works in the same way on the WR902AC ...

Share ETH:

root@lede:~# grep 'sw[12]' /sys/kernel/debug/gpio 
 gpio-14  (                    |sw2                 ) in  lo    
 gpio-17  (                    |sw1                 ) in  hi

Share Hotspot:

root@lede:~# grep 'sw[12]' /sys/kernel/debug/gpio 
 gpio-14  (                    |sw2                 ) in  hi    
 gpio-17  (                    |sw1                 ) in  lo    

AP/Rng Ext/Client

root@lede:~# grep 'sw[12]' /sys/kernel/debug/gpio 
 gpio-14  (                    |sw2                 ) in  hi    
 gpio-17  (                    |sw1                 ) in  hi 

What's the process for loading the factory image? When I try loading it via the TP-Link web GUI I get the following error:

Error code: 18011
Error occurred, please try again.

I also tried tftp server with no success.

I'm on:
Firmware Version: 3.16.9 Build 20160905 Rel.61455n
Hardware Version: TL-WR902AC v1 00000000

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.

https://downloads.lede-project.org/snapshots/targets/ar71xx/generic/lede-ar71xx-generic-tl-wr902ac-v1-squashfs-factory.bin

Google doesn't shed any light on the error so I'm at a loss other than
re-download and try again after a factory reset of the device(?)

About that switch again ...

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