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

Many of factory images are currently broken, fix is in my staging tree, will push it soon.

@raydude images should be fixed now, please try again.

Thanks. I have the V1. I'll try to install the new image this evening after work.

Pepe2k,

Latest firmware installed with GUI just fine. Now if I could just get the WIFI to connect... Heh.

Thanks much for your help. I really appreciate it!

1 Like

Guessing by the silence, you got WiFi to connect lol?

Just a quickie to add something I have concocted (a bit of a hack if I'm honest) to get the internet connectivity LED working. Create a script as follows (I called mine internet_led.sh and saved it in the root user's home directory)

#! /bin/sh

while true; do
	wget -s http://www.google.com >/dev/null 2>&1

	if [ $? -eq 0 ]; then
		echo 1 > /sys/class/leds/tl-wr902ac-v1\:green\:internet/brightness
	else
		echo 0 > /sys/class/leds/tl-wr902ac-v1\:green\:internet/brightness
	fi
	
	sleep 5
done

(You can change the url passed to wget as appropriate or even swap for straight up ping - I only use wget as easytether -used to attach my cellphone via USB tethering- will not route ICMP ping packets!)

Now add this script to /etc/rc.local in Luci (under System/Startup) eg:

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

/root/internet_led.sh &
exit 0

The "&" is important! Don't forget the "&"!

There is any information/plans about support WR902AC V.3?

I think v3 is MediaTek based solution with MT7610 radio which isn't (and won't be) supported by mt76 driver.

I'm new to the TP-LINK TL-WR902AC and to OpenWRT. I have flashed OpenWRT onto the device and am going through the setup at the device. Does the device only have 1 radio, radio0? Does the 2T2R 2.4 GHz, 1T1R 5 GHz part of the spec not mean there should be more than one? Has anyone got any tips on how to have 1 wifi connection to be on wan and another on lan so that I can create a private network when I'm at hotels for example?

Also, Has anyone managed to re-purpose the WPS button? I want to try and get the button to start and stop the openvpn service and have the light indicate if it is running or not. I have found someone who does similar with the reset button but being new I'm not sure how to get interaction from the WPS

There are two radios in the device, radio0 and radio1. One of them is 2.4GHz with a 2x2 (Tx x Rx) antenna system and the other is 5GHz with 1x1 antennas.

There re two ways you can set up a wireless WAN (WWAN) configuration:

  1. dedicate one of the radios to the task by setting it to "sta" (which is 'client mode' to connect to an upstream AP) and put in the necessary SSID and security settings
    or
  2. Configure an additional interface on one of the radios -- you can have more than 1 interface on each radio. By doing this, you can have the same radio perform as an AP and as a STA mode device simultaneously. There is a performance penalty for this, but it may not matter, depending on your usage.

Set the network of the STA mode wireless interface to WWAN, and then set up the appropriate interface in the network interfaces for WWAN (usually using proto=DHCP), and assign it to the wan firewall zone.

The AP mode interface will be part of your WLAN and will be assigned to the lan firewall zone.

I have done this on my MR3020 (the predecessor to the WR902AC). It should work the same way for the WR902AC (I haven't gotten around to everything on the new device; some minor tweaks may be required).

For the button handling (to start/stop the VPN):

add this to your etc/config/system file:
config button
	option button 'wps'
	option action 'released'
	option handler 'WPS_VPN_Toggle'
	option min '0'
	option max '2'
Create a file: /etc/hotplug.d/button/00-button with execute permissions
#!/bin/sh
. /lib/functions.sh
do_button () {
        local button
        local action
        local handler
        local min
        local max
 
        config_get button $1 button
        config_get action $1 action
        config_get handler $1 handler
        config_get min $1 min
        config_get max $1 max

	if [ "$button" = "3G" -o "$button" = "WISP" -o "$button" = "AP" ] ; then
		if [ "$BUTTON" = "BTN_0" -o "$BUTTON" = "BTN_1" ] ; then
		#if [ "$BUTTON" = "BTN_0" ] ; then

			#mode=$( /root/slidesw_check )
			#case $mode in

			case $( slidesw_check ) in
				"AP")
					export BUTTON=AP
				;;
				"WISP")
					export BUTTON=WISP
				;;
				"3G")
					export BUTTON=3G
				;;
			esac
			export ACTION=pressed
		fi
	fi


        [ "$ACTION" = "$action" -a "$BUTTON" = "$button" -a -n "$handler" ] && {
                [ -z "$min" -o -z "$max" ] && eval $handler
                [ -n "$min" -a -n "$max" ] && {
                        [ $min -le $SEEN -a $max -ge $SEEN ] && eval $handler
                }
        }
}
 
config_load system
config_foreach do_button button
Create a file: /usr/bin/WPS_VPN_Toggle with execute permissions
#!/bin/sh

if ifconfig | grep "tun0" > /dev/null ; then
	/etc/init.d/openvpn stop
else
	/etc/init.d/openvpn start
fi

For the LED, I have the LED off to indicate no VPN, blinking with the heartbeat pattern for the connecting phase, and on solid when connected. Don't forget to install the kmod-ledtrig-heartbeat if you want to replicate my setup.

Add this (or possibly edit the entry) in /etc/config/system file
config led
	option default '0'
	option name 'VPN'
	option sysfs 'tp-link:green:wps'
	option trigger 'none'
I added this into /etc/init,d/openvpn under the start_instance() { function
start_instance() {
	local s="$1"
	echo heartbeat > /sys/class/leds/tp-link:green:wps/trigger
	echo 1 > /sys/class/leds/tp-link:green:wps/brightness
And this code was added to /etc/hotplug.d/iface/30-vpn (with execute permissions)
if [ "$INTERFACE" = "VPN" ] && [ "$ACTION" = "ifup" ]
	then
		echo none > $vpnled/trigger
		echo 1 > $vpnled/brightness
	fi

if [ "$INTERFACE" = "VPN" ] && [ "$ACTION" = "ifdown" ]
	then
		echo none > $vpnled/trigger
		echo 0 > $vpnled/brightness
	fi

Thanks, that all makes sense, I've managed to get the second of your suggestions to work but I can't see radio1 in the overview page, only "Generic 802.11bgn Wireless Controller (radio0)". Do I have to manually create it or should it be there automatically?

Thank you for the awesome walk through for the WPS button, I will give it a go tomorrow and report back!

I tried to install the LED heartbeat but I get the issue below, is it that it can't see it or that maybe I am running out of space? opkg update works fine. Do I need to add a different repo?

root@OpenWrt:~# opkg install kmod-ledtrig-heartbeat
Unknown package 'kmod-ledtrig-heartbeat'.
Collected errors:

  • opkg_install_cmd: Cannot install package kmod-ledtrig-heartbeat.

Did you run opkg update first?

Another possible reason for the issue could be if your snapshot install is old(er) than the current package repo supports -- this is largely intentional in the snapshot cycle because there are a lot of moving parts and the potential for things to break if they're a bit out-of-band.

In fact, since I have my MR3020 working perfectly with 17.01.4, I've been in a bit of a holding pattern to finish my config of the device -- waiting for the next official release of LEDE/OpenWRT that will support the WR902AC. I had been hoping it would be picked up in the 17.x releases, but presumably it will be part of OpenWRT 18.x (not sure of the timing of that, though). If the snapshot is too old for the packages to work reliably, it can be a bit of work to 'refresh' to the latest, re-install all packages, and restore the config. That's why I've only done a partial installation on my WR902AC.

IIRC, the radio1 definition should be there by default. Maybe something changed since the snapshot I installed a while back.

/etc/config/wireless default file from a snapshot back ~July 2017
config wifi-device 'radio0'
	option type 'mac80211'
	option channel '36'
	option hwmode '11a'
	option path 'pci0000:00/0000:00:00.0'
	option htmode 'VHT80'
	option disabled '1'

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

config wifi-device 'radio1'
	option type 'mac80211'
	option channel '11'
	option hwmode '11g'
	option path 'platform/qca953x_wmac'
	option htmode 'HT20'
	option disabled '1'

config wifi-iface 'default_radio1'
	option device 'radio1'
	option network 'lan'
	option mode 'ap'
	option ssid 'LEDE'
	option encryption 'none'

I reran it and god slightly different result this time, I guess I hadn't done the update correctly:

root@OpenWrt:~# opkg install kmod-ledtrig-heartbeat
Installing kmod-ledtrig-heartbeat (4.9.86-1) to root...
Downloading http://downloads.lede-project.org/snapshots/targets/ar71xx/generic/packages/kmod-ledtrig-heartbeat_4.9.86-1_mips_24kc.ipk
Collected errors:
 * satisfy_dependencies_for: Cannot satisfy the following dependencies for kmod-ledtrig-heartbeat:
 *      kernel (= 4.9.86-1-272b1da482a91580f65716253ec06c1f) *
 * opkg_install_cmd: Cannot install package kmod-ledtrig-heartbeat.

My kernal version is 4.9.85 so must not be compatible! I'm using the firmware linked on the OpenWRT techdata page: OpenWrt SNAPSHOT r6396-057369ae1f / LuCI Master (git-18.067.33661-4f04e61)

If I manually create radio1 in the wireless section do you think that might work? How would I choose the "option path" bit?

It's complaining the kernel is too old. The only way to update the kernel
is by updating the firmware image from the latest snapshot (go hunting
yourself from the source, not from other links on webpages which may be out
of date). Only then will ANY packages install correctly.

For future reference, the snapshots can be found here ......
https://downloads.openwrt.org/snapshots/targets/ar71xx/generic/

You need to grab the sysupgrade firmware this time round. (You would have
grabbed the factory version first time round when flashing from stock
TP-Link firmware) ....
https://downloads.openwrt.org/snapshots/targets/ar71xx/generic/openwrt-ar71xx-generic-tl-wr902ac-v1-squashfs-sysupgrade.bin

The easiest way to flash it is through Luci although it is possible to
flash it from command line if you haven't installed Luci.

You will likely need to do some re-configuring once re-flashed though
depending on what you manage to save as you go (take a backup from in
Luci!) and Luci will probably need to be the first thing you re-install
after re-flashing as it isn't part of the image! (So be prepared to SSH
into the thing!)

After a couple of goes at this, you will learn how to configure OpenWRT to
retain config files and certain files you don't want deleting during an
upgrade (there are configurable lists in Luci!), although I still get
caught out now and again!

Tony

You are using a snapshot image.
https://openwrt.org/faq/after_installation#cannot_satisfy_dependencies

And this is why I've been in that holding pattern waiting for a stable release that supports this particular device. Although it is totally workable to backup relevant files, update the snapshot, re-install packages, and restore the backup configs and other files, I figured it'd just be easier when there is a longer horizon for the kernel/package compatibility (at least for the stuff I've been doing with my device).

I'm not sure of the development timeline for the OpenWRT 18.x.x release, but I'm hoping that it is not too far out.

All of that said, this is just part of working with a device that is not yet fully supported (i.e. stable release), and it's great to have support now and it'll be even better soon :slight_smile:

Thanks for the link Tony, I just assumed that the firmware linked on the openwrt page would be the latests but you know what they say about assumptions! I will flash with the one you linked and see what config is kept/lost. Will be interesting to see if radio1 appears with this! I haven't done massive amounts of config so reinstalling from fresh won't be too much of an issue.

Thanks tmomas, I will keep an eye on that page for any other issues that come up!

It is always a risk but with a community like this it is a lot easier to give stuff a go! Thanks for all the help so far.

Edit: radio1 is now showing :+1: