The RTL8720DN is an Arduino-like microcontroller that also has support for dual-band Wi-Fi (2.4GHz and 5GHz) and Bluetooth. 5GHz Wi-Fi support is rare in both microcontrollers and single-board computers, making the RTL8720DN a uniquely attractive as far as embedded devices go for the Wii U gamepad.
That being said, the Wii U gamepad requires slight tweaks to the 802.11 protocol, and the RTL8720DN's lower level MLME commands are done in closed source binary blobs, with the source only available by acquiring a commercial license and signing an NDA with Realtek. This repo provides patches to this closed source firmware to allow connecting to the Wii U.
NOTE: Using these patches will prevent the RTL8720DN from connecting to non-Wii U access points.
These instructions are for if you simply want to use the patched firmware:
- Set up Arduino IDE for the RTL8720DN using the official instructions.
- Download
lib_wps.aandlib_wlan.afrom the Releases tab. - Locate the existing
lib_wps.aandlib_wlan.afiles in the Arduino/Realtek data folders. This will differ by platform.
- On Linux, they are typically located in:
~/.arduino15/packages/realtek/hardware/AmebaD/3.1.7/variants/common_libs
- (Optional) Back up the two files in case you want to restore normal Wi-Fi functionality later. It is not necessary to back these up, they can always be re-acquired from Realtek's official GitHub repository.
- Replace the existing
lib_wps.aandlib_wlan.awith the files you downloaded. - Done! Any programs compiled with Arduino IDE should now include the patched firmware.
These instructions are for if you want to patch the firmware yourself before installing and using it:
- Set up Arduino IDE for the RTL8720DN using the official instructions.
- Locate the existing
lib_wps.aandlib_wlan.afiles in the Arduino/Realtek data folders. This will differ by platform.
- On Linux, they are typically located in:
~/.arduino15/packages/realtek/hardware/AmebaD/3.1.7/variants/common_libs
- (Optional) Back up the two files in case you want to restore normal Wi-Fi functionality later. It is not necessary to back these up, they can always be re-acquired from Realtek's official GitHub repository.
- Install GCC for ARM 32-bit. This will differ by platform.
- On Arch Linux:
pacman -S arm-none-eabi-gcc arm-none-eabi-newlib
- Clone the Wii U patched wpa_supplicant:
git clone https://github.com/rolandoislas/drc-hostap.git
- Apply
rtl8720dn_wps_common.patchby running the following command in the directory you just cloned:
git apply rtl8720dn_wps_common.patch
This patch adds the necessary byte rotation required for the WPS PIN authentication.
- From the
wpa_supplicantrepository, compile onlysrc/wps/wps_common.cusing the following command:
arm-none-eabi-gcc -march=armv8-m.main+fp -mfloat-abi=hard -c -O2 -DRTL8720DN -I<drc-hostap-directory>/src/utils -I<drc-hostap-directory>/src -D__BYTE_ORDER=__LITTLE_ENDIAN -DCONFIG_TENDONIN <drc-hostap-directory>/src/wps/wps_common.c
Replace <drc-hostap-directory> with the directory you cloned wpa_supplicant to earlier.
- You should now have a compiled object file
wps_common.o. Inject it into the existinglib_wps.afile using AR:
ar r lib_wps.a wps_common.o
- Compile
rom_rtw_psk_wiiu.cinto an object file using the following command:
arm-none-eabi-gcc -march=armv8-m.main+fp -mfloat-abi=hard -c -O2 -D__BYTE_ORDER=__LITTLE_ENDIAN rom_rtw_psk_wiiu.c
This is a decompilation/reimplementation of Realtek's PTK calculation function that adds the byte rotation required for connection to the Wii U.
- You should now have a compiled object file
rom_rtw_psk_wiiu.o. Inject it into the existinglib_wlan.afile using AR:
ar r lib_wlan.a rom_rtw_psk_wiiu.o
- Open
lib_wlan.awith an archiving tool like 7-Zip or Ark. Extract the following files from it:
rom_rtw_psk.o
rom_rtw_ieee80211.o
- Using a hex editor, do the following:
- In
rom_rtw_psk.o, replace all instances ofrom_psk_CalcPTKwithrom_psk_CalcNVM(can be anything as long as it's the same length and not the original string). This will ensure the Arduino compiler will use our PTK calculation function instead of Realtek's. - In
rom_rtw_ieee80211.o, go to offsets0xB34and0xB3Cand replace the three bytes00 0F ACat each offset withA4 C0 E1. This will spoof our OUI (organizationally unique identifier) to Nintendo's so the console believes we are a gamepad.
- Inject these modified objects back into
lib_wlan.ausing AR:
ar r lib_wlan.a rom_rtw_psk.o
ar r lib_wlan.a rom_rtw_ieee80211.o
- Ensure your patched files have replaced the original files located earlier on.
- Done! Any programs compiled with Arduino IDE should now include the patched firmware.