OpenWrt Forum Archive

Topic: how to enable WN722N (AR9271) wifi usb on MR3020 ?

The content of this topic has been archived on 30 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

hi,

i'm trying to make a repeater,

- cat /proc/bus/usb/devices lists the dongle
- installed "kmod-ath9k-htc" / rebooted

what else do i need to do to make radio1(usb) appear under network/wifi ?

Did you enable the interface?

  
  uci set wireless.radio1.disabled=0;
  uci commit wireless
  wifi

My quick&dirty method of using a secondary usb wifi interface as uplink:

  # install drivers
  opkg install kmod-rt2800-lib kmod-rt2800-usb kmod-rt2x00-lib kmod-rt2x00-usb

  # create wireless wan interface 
  uci set network.wwan=interface
  uci set network.wwan.proto=dhcp
  uci set network.wwan.hostname="$STATION"
  uci commit network

  # enable wifi interface
  uci set wireless.radio1.disabled=0;

  # connect wifi to access point
  uci set wireless.radio1.channel=$WLAN_CHANNEL
  uci set wireless.@wifi-iface[1].network=wwan
  uci set wireless.@wifi-iface[1].mode=sta
  uci set wireless.@wifi-iface[1].ssid="$WLAN_SSID"
  uci set wireless.@wifi-iface[1].encryption="$WLAN_ENCRYPT"
  uci set wireless.@wifi-iface[1].key="$WLAN_KEY"
  uci commit wireless
  wifi

  # enable wwan as wan zone (so internal lan/wlan requests get routed to Internet) 
  uci set firewall.@zone[1].network="wan wan6 wwan"
  uci commit firewall
  /etc/init.d/firewall restart

Watch out that even though it's radio1 it can show up as wlan0, that's a bit tricky.

root@OpenWrt:~# uci set wireless.radio1.disabled=0;
uci: Invalid argument



root@OpenWrt:~# wifi detect
config wifi-device  radio1
    option type     mac80211
    option channel  11
    option macaddr    64:66:b3:XX:XX:XX
    option hwmode    11ng
    option htmode    HT20
    list ht_capab    SHORT-GI-20
    list ht_capab    SHORT-GI-40
    list ht_capab    RX-STBC1
    list ht_capab    DSSS_CCK-40
    # REMOVE THIS LINE TO ENABLE WIFI:
    option disabled 1

config wifi-iface
    option device   radio1
    option network  lan
    option mode     ap
    option ssid     OpenWrt
    option encryption none



so why doesn't it show up in the gui?
wifi detect is blank if i reboot with the stick plugged in,
but it works when i plug it in after reboot

"uci" doesn't work? I think it's essential for OpenWrt to function properly.

You can also edit /etc/config/wireless and remove "option disabled 1".

And try "wifi status".

# cat /etc/config/wireless

config wifi-device 'radio0'
        option type 'mac80211'
        option channel '11'
        option hwmode '11g'
        option path 'pci0000:00/0000:00:00.0'
        option htmode 'HT20'
        option disabled '0'

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

After I install kmod-ath9k-htc and reboot. It not happen.

I am using Wzr-hp-AG300H and MR3420, and using OpenWrt Barrier Breaker 14.07

After install kmod-ath9k-htc, and enter this code, nothing happen.

Anyone use WN722N (AR9271) successfully?

I have a WN722N too, which doesn't work under Barrier Breaker.
It was working fine under Attitude Adjustment.

I have opened a ticket about 9 months ago...
ath9k_htc: Failed to initialize the device

Wed Jun 11 10:35:32 2014 kern.info kernel: [75345.844000] usb 1-1: new high-speed USB device number 2 using ifxusb_hcd
Wed Jun 11 10:35:33 2014 kern.info kernel: [75346.068000] usb 1-1: ath9k_htc: Firmware htc_9271.fw requested
Wed Jun 11 10:35:35 2014 kern.info kernel: [75348.792000] usb 1-1: ath9k_htc: Transferred FW: htc_9271.fw, size: 51272
Wed Jun 11 10:35:36 2014 kern.err kernel: [75349.800000] ath9k_htc 1-1:1.0: ath9k_htc: Target is unresponsive
Wed Jun 11 10:35:36 2014 kern.err kernel: [75349.804000] ath9k_htc: Failed to initialize the device
Wed Jun 11 10:35:36 2014 kern.info kernel: [75349.808000] usb 1-1: ath9k_htc: USB layer deinitialized

Can you confirm (by checking the system log) if you're facing the same problem?

(Last edited by angelos on 26 Feb 2015, 12:52)

Thank you so much, Anglos. It was working fine with AA.
This is my logs, but i dont understand it.  I use Wzr-hp-AG300H, I just install kmod-ath9k-htc and restart!

[   23.650000] hub 1-0:1.0: USB hub found
[   23.660000] hub 1-0:1.0: 2 ports detected
[   23.670000] nf_conntrack version 0.5.0 (1979 buckets, 7916 max)
[   23.820000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[   23.830000] ohci-platform ohci-platform: Generic Platform OHCI Controller
[   23.830000] ohci-platform ohci-platform: new USB bus registered, assigned bus number 2
[   23.840000] ohci-platform ohci-platform: irq 14, io mem 0x1c000000
[   23.910000] hub 2-0:1.0: USB hub found
[   23.910000] hub 2-0:1.0: 2 ports detected
[   23.980000] usb 1-1: new high-speed USB device number 2 using ehci-platform
[   24.060000] usbcore: registered new interface driver ath9k_htc
[   24.150000] usb 1-1: ath9k_htc: Firmware htc_9271.fw requested
[   24.550000] usb 1-1: ath9k_htc: Transferred FW: htc_9271.fw, size: 51272
[   24.780000] ath9k_htc 1-1:1.0: ath9k_htc: HTC initialized with 33 credits
[   24.980000] ath9k_htc 1-1:1.0: ath9k_htc: FW Version: 1.3
[   24.980000] ath: EEPROM regdomain: 0x809c
[   24.980000] ath: EEPROM indicates we should expect a country code
[   24.980000] ath: doing EEPROM country->regdmn map search
[   24.980000] ath: country maps to regdmn code: 0x52
[   24.980000] ath: Country alpha2 being used: CN
[   24.980000] ath: Regpair used: 0x52
[   24.980000] ieee80211 phy2: Atheros AR9271 Rev:1
[   24.990000] cfg80211: Calling CRDA for country: CN
[   24.990000] cfg80211: Current regulatory domain intersected:
[   25.000000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[   25.010000] cfg80211:   (2402000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm)
[   25.020000] Registered led device: ath9k_htc-phy2
[   26.950000] device eth0 entered promiscuous mode
[   28.620000] ar71xx: pll_reg 0xb8050010: 0x110000
[   28.620000] eth0: link up (1000Mbps/Full duplex)
[   28.640000] br-lan: port 1(eth0) entered forwarding state
[   28.640000] br-lan: port 1(eth0) entered forwarding state
[   29.950000] ar71xx: pll_reg 0xb8050014: 0x1099
[   29.950000] eth1: link up (100Mbps/Full duplex)
[   30.640000] br-lan: port 1(eth0) entered forwarding state

I think I want to do the same as culo, but I'm a total noob when it comes to linux/telnet commands...

I want the TL-MR3020 router to connect to a wireless signal with the TL-WN722N (AR9271) wifi USB, and connect the LAN port (bridge?) to the WAN port of another router. I believe the first problem is I need to install the drivers for the USB dongle with "opkg install kmod-ath9k-htc" but the router is only connected to my laptop through the LAN port, so I must bridge the internal wireless to the LAN port and connect the wireless to a wireless network, right? How do I do that?

EDIT: currently using openwrt-15.05.1-ar71xx-generic-tl-mr3020-v1-squashfs-factory.bin with default settings, telnet is installed in Windows 10 and successfully connects to the router with 192.168.1.1. The GUI (LuCI) is also accessible through the brower and the same IP.

EDIT2: TL-WN722N is still not listed/detected, only the internal wireless. I downgraded to openwrt-12.09-ar71xx-generic-tl-mr3020-v1-squashfs-factory.bin (Attitude Adjustment) but USB wifi still doesn't appear. After connecting to internet with internal wireless, I did the following:
opkg update
opkg install kmod-ath9k-htc
reboot
rm -f /etc/config/wireless
wifi detect > /etc/config/wireless
But the USB wifi is still not listed...

(Last edited by johnyept on 25 Jun 2017, 19:37)

Are you sure that your WN-722 has the Atheros chip?  There are different versions, same model number but later ones have I think a Realtek chip.

mk24 wrote:

Are you sure that your WN-722 has the Atheros chip?  There are different versions, same model number but later ones have I think a Realtek chip.

Wow I didn't notice that! Mine is v2 which according to the wiki (wikidevi.com/wiki/TP-LINK_TL-WN722N_v2) corresponds to rtl8188eu. So from the top:

- Removed USB WiFi
- System -> Backup / Flash firmware -> Don't keep settings
- openwrt-15.05.1-ar71xx-generic-tl-mr3020-v1-squashfs-factory.bin
- login (browser), Network -> WiFi -> Scan -> select my home wireless -> Join Network
- type WPA passphrase, Create / Assign firewall-zone: LAN -> Submit
- click on "unsaved changes" -> Save and Apply
- System -> Software -> Update lists, free space 296kb
- Filter available packages with "8188"
- installed kmod-net-rtl8188eu (which also installs r8188eu-firmware), free space 56kb
- System -> Reboot
- On telnet:

root@OpenWrt:/# dmesg | grep usb
[    4.120000] usbcore: registered new interface driver usbfs
[    4.120000] usbcore: registered new interface driver hub
[    4.130000] usbcore: registered new device driver usb
[  503.050000] usbcore: registered new interface driver r8188eu
[  639.320000] usb 1-1: new high-speed USB device number 2 using ehci-platform
root@OpenWrt:/# rm -f /etc/config/wireless
root@OpenWrt:/# wifi detect > /etc/config/wireless
root@OpenWrt:/# cat /etc/config/wireless
config wifi-device  radio0
        option type     mac80211
        option channel  11
        option hwmode   11g
        option path     'platform/ar933x_wmac'
        option htmode   HT20
        # REMOVE THIS LINE TO ENABLE WIFI:
        option disabled 1

config wifi-iface
        option device   radio0
        option network  lan
        option mode     ap
        option ssid     OpenWrt
        option encryption none

Still no luck...

(Last edited by johnyept on 25 Jun 2017, 22:52)

You have to remove the disabled line of course.  Your jffs may crash because there isn't a whole 64k erase block free. Also, AP mode is not supported by many Realtek drivers.

mk24 wrote:

You have to remove the disabled line of course.  Your jffs may crash because there isn't a whole 64k erase block free. Also, AP mode is not supported by many Realtek drivers.

The disabled line is for the internal wifi, the usb wifi is still not listed. I tried with the previous firmware which has more free space but other drivers::

- openwrt-14.07-ar71xx-generic-tl-mr3020-v1-squashfs-factory.bin
- System -> Software -> Update lists, free space 428kb
- Filter available packages with "8188" (no kmod-net-rtl8188eu available)
- Installed kmod-rtl8192ce (which also installs kmod-rtlwifi-pci, kmod-rtlwifi, kmod-rtl8192c-common)
- installed kmod-rtl8192cu (which also installs kmod-rtlwifi-usb)
- installed kmod-rtl8192de, free space 196kb
- installed r8188eu-firmware, free space 180kb
- System -> Reboot

On Telnet I get the same results, only the internal wifi listed instead of 2 wifis as I believe it should be. Either I'm missing some command/step or the combination of router/usb wifi are just incompatible.

Since 12.09 and 14.07 didn't have the correct drivers (to my knowledge), and 15.05.1 was left with 56kb free after installing kmod-net-rtl8188eu and r8188eu-firmware, I tried 15.05 which has 360kb free before installing these 2 packages and 124knb free after. A little better in terms of free space, but the results is still the same...

root@OpenWrt:/# wifi detect
config wifi-device  radio0
        option type     mac80211
        option channel  11
        option hwmode   11g
        option path     'platform/ar933x_wmac'
        option htmode   HT20
        # REMOVE THIS LINE TO ENABLE WIFI:
        option disabled 1

config wifi-iface
        option device   radio0
        option network  lan
        option mode     ap
        option ssid     OpenWrt
        option encryption none

It only sees the internal wifi but not the usb wifi, although it does recognize when it's inserted.

root@OpenWrt:/# dmesg | grep usb
[    4.130000] usbcore: registered new interface driver usbfs
[    4.130000] usbcore: registered new interface driver hub
[    4.140000] usbcore: registered new device driver usb
[   12.240000] usbcore: registered new interface driver r8188eu
[  120.590000] usb 1-1: new high-speed USB device number 2 using ehci-platform

(Last edited by johnyept on 26 Jun 2017, 23:30)

I don't think it is supported.  I have a RTL8188SU based dongle that I can't get to work with OpenWrt either. It sort of works with desktop Linux using the R8712 driver-- still it does not appear in iw though Network Manager somehow finds it.

When you see the "new high speed USB device" and nothing more, that means no driver claimed the device.  Also I think r8188eu is for PCI chips.

That's very unfortunate... I bought the TL-WN722N and the TL-ANT2408C high gain antenna specifically for the job, and the MR3020 router just happened to be available, so I thought I could put it to good use.

Do you know of any cheap router that could be compatible with this USB wifi, or another USB wifi that works with OpenWRT, MR3020 and the high gain antenna?

EDIT: angelos and thelovemyth both had a WN722N v1 working with AA, so first I'll try to buy a used one and report back if it works with AA (12.09), BB (14.07) or CC (15.05.x)

(Last edited by johnyept on 27 Jun 2017, 08:52)

Ok, here's my final findings. WN722N v1.1 works on all firmwares. I tested on AA (12.09), BB (14.07) and CC (15.05/15.05.1) and all 4 correctly detected the usb adapter and successfully connected to a wireless network after installing the kmod-ath9k-ht drivers. I'm actually using it right now: MR3020 with OpenWrt 15.05.1, using WN722N v1.1 to connect to WiFi, and LAN port connected WAN port of another router on the other side of the house, where I'm connected to.

So here's the steps I took to use MR3020 as a bridge from usb wlan to lan:

- System -> Backup / Flash firmware -> Don't keep settings
- flash any of the 4 available OpenWrt firmwares
- on the browser, go to 192.168.1.1
- Network -> WiFi -> Scan -> select a wireless network -> Join Network
- type WPA passphrase, Submit
- click on "unsaved changes" -> Save & Apply
- System -> Software -> Update lists
- Filter available packages with "kmod-ath9k-htc"
- install kmod-ath9k-htc and reboot
- connect usb adapter
- go to telnet 192.168.1.1
- dmesg | grep usb (to check if it was detected correctly)
- rm -f /etc/config/wireless (to remove current wireless adapter)
- wifi detect > /etc/config/wireless (to make both adapters visible)
- on the browser, go to 192.168.1.1
- Network -> WiFi -> Scan with radio1 (WN722N) -> select a wireless network -> Join Network
- type WPA passphrase, Submit
- click on "unsaved changes" -> Save & Apply

It was only after doing all this that I discovered a mod to add an external antenna to MR3020. Live and learn... for now I'll keep it as is, but in the future I'll probably try the mod!

(Last edited by johnyept on 1 Jul 2017, 23:36)

The discussion might have continued from here.