Skip to content
68 changes: 68 additions & 0 deletions .cache.mk

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# RTL8812AU/21AU and RTL8814AU linux driver with monitor mode and frame injection
The master branch is based on https://github.com/ulli-kroll/rtl8821au branch v4.3.22-beta/rework.
According to rtw_version.c the real driver version is 4.3.20.
`The master branch is based on https://github.com/ulli-kroll/rtl8821au branch v4.3.22-beta/rework.
According to rtw_version.c the real driver version is 4.3.20.`

The branch v4.3.21 may be built for RTL8814AU or RTL8812AU/RTL8821AU chipset.
# Info
`We recommend building from the v5.1.5 branch, which got kernel v4.12 support & more adapters supported.
Both the 8812AU & 8814AU is supported on the v5.1.5 branch.`


The branch v4.3.21 may also be built for RTL8814AU or RTL8812AU/RTL8821AU chipset.
Notice, kernel v4.12 support is still missing on the v4.3.21 branch.

for building RTL8812AU/RTL8821AU driver type:

Expand Down
10 changes: 9 additions & 1 deletion hal/phydm/phydm_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,11 @@ typedef enum _RT_SPINLOCK_TYPE{

typedef struct rtl8192cd_priv *prtl8192cd_priv;
typedef struct stat_info STA_INFO_T,*PSTA_INFO_T;
#if defined (LINUX_VERSION_CODE) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
typedef struct legacy_timer_emu RT_TIMER, *PRT_TIMER;
#else
typedef struct timer_list RT_TIMER, *PRT_TIMER;
#endif
typedef void * RT_TIMER_CALL_BACK;

#ifdef CONFIG_PCI_HCI
Expand Down Expand Up @@ -277,8 +281,12 @@ typedef enum _RT_SPINLOCK_TYPE{
#elif defined (CONFIG_BIG_ENDIAN)
#define ODM_ENDIAN_TYPE ODM_ENDIAN_BIG
#endif


#if defined (LINUX_VERSION_CODE) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
typedef struct legacy_timer_emu RT_TIMER, *PRT_TIMER;
#else
typedef struct timer_list RT_TIMER, *PRT_TIMER;
#endif
typedef void * RT_TIMER_CALL_BACK;
#define STA_INFO_T struct sta_info
#define PSTA_INFO_T struct sta_info *
Expand Down
4 changes: 4 additions & 0 deletions include/osdep_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,12 @@ extern void rtw_init_timer(_timer *ptimer, void *padapter, void *pfunc);
__inline static unsigned char _cancel_timer_ex(_timer *ptimer)
{
#ifdef PLATFORM_LINUX
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
return del_timer_sync(&ptimer->t);
#else
return del_timer_sync(ptimer);
#endif
#endif
#ifdef PLATFORM_FREEBSD
_cancel_timer(ptimer,0);
return 0;
Expand Down
35 changes: 34 additions & 1 deletion include/osdep_service_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@
#include <linux/semaphore.h>
#endif
#include <linux/sem.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0))
#define HAVE_SIGNAL_FUNCTIONS_OWN_HEADER
#endif
#ifdef HAVE_SIGNAL_FUNCTIONS_OWN_HEADER
#include <linux/sched/signal.h>
#else
#include <linux/sched.h>
#endif
#include <linux/etherdevice.h>
#include <linux/wireless.h>
#include <net/iw_handler.h>
Expand Down Expand Up @@ -133,7 +140,15 @@
#else
typedef struct semaphore _mutex;
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
typedef struct legacy_timer_emu {
struct timer_list t;
void (*function)(unsigned long);
unsigned long data;
} _timer;
#else
typedef struct timer_list _timer;
#endif

struct __queue {
struct list_head queue;
Expand Down Expand Up @@ -265,23 +280,41 @@ __inline static void rtw_list_delete(_list *plist)
}

#define RTW_TIMER_HDL_ARGS void *FunctionContext

#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
static void legacy_timer_emu_func(struct timer_list *t)
{
struct legacy_timer_emu *lt = from_timer(lt, t, t);
lt->function(lt->data);
}
#endif
__inline static void _init_timer(_timer *ptimer,_nic_hdl nic_hdl,void *pfunc,void* cntx)
{
//setup_timer(ptimer, pfunc,(u32)cntx);
ptimer->function = pfunc;
ptimer->data = (unsigned long)cntx;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
timer_setup(&ptimer->t, legacy_timer_emu_func, 0);
#else
init_timer(ptimer);
#endif
}

__inline static void _set_timer(_timer *ptimer,u32 delay_time)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
mod_timer(&ptimer->t, (jiffies+(delay_time*HZ/1000)));
#else
mod_timer(ptimer , (jiffies+(delay_time*HZ/1000)));
#endif
}

__inline static void _cancel_timer(_timer *ptimer,u8 *bcancelled)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0))
del_timer_sync(&ptimer->t);
#else
del_timer_sync(ptimer);
#endif
*bcancelled= _TRUE;//TRUE ==1; FALSE==0
}

Expand Down
573 changes: 573 additions & 0 deletions os_dep/linux/.rtw_radiotap.o.d

Large diffs are not rendered by default.

36 changes: 35 additions & 1 deletion os_dep/linux/ioctl_cfg80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,19 @@ void rtw_cfg80211_indicate_connect(_adapter *padapter)
#endif

DBG_871X(FUNC_ADPT_FMT" call cfg80211_roamed\n", FUNC_ADPT_ARG(padapter));
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
{
struct cfg80211_roam_info roam_info = {
.channel = notify_channel,
.bssid = cur_network->network.MacAddress,
.req_ie = pmlmepriv->assoc_req+sizeof(struct rtw_ieee80211_hdr_3addr)+2,
.req_ie_len = pmlmepriv->assoc_req_len-sizeof(struct rtw_ieee80211_hdr_3addr)-2,
.resp_ie = pmlmepriv->assoc_rsp+sizeof(struct rtw_ieee80211_hdr_3addr)+6,
.resp_ie_len = pmlmepriv->assoc_rsp_len-sizeof(struct rtw_ieee80211_hdr_3addr)-6,
};
cfg80211_roamed(padapter->pnetdev, &roam_info, GFP_ATOMIC);
}
#else
cfg80211_roamed(padapter->pnetdev
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39) || defined(COMPAT_KERNEL_RELEASE)
, notify_channel
Expand All @@ -811,6 +824,7 @@ void rtw_cfg80211_indicate_connect(_adapter *padapter)
, pmlmepriv->assoc_rsp+sizeof(struct rtw_ieee80211_hdr_3addr)+6
, pmlmepriv->assoc_rsp_len-sizeof(struct rtw_ieee80211_hdr_3addr)-6
, GFP_ATOMIC);
#endif
}
else
{
Expand Down Expand Up @@ -1873,10 +1887,17 @@ enum nl80211_iftype {
NL80211_IFTYPE_MAX = NUM_NL80211_IFTYPES - 1
};
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
struct net_device *ndev,
enum nl80211_iftype type,
struct vif_params *params)
#else
static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
struct net_device *ndev,
enum nl80211_iftype type, u32 *flags,
struct vif_params *params)
#endif
{
enum nl80211_iftype old_type;
NDIS_802_11_NETWORK_INFRASTRUCTURE networkType;
Expand Down Expand Up @@ -3951,7 +3972,12 @@ static int rtw_cfg80211_add_monitor_if(_adapter *padapter, char *name, struct ne
mon_ndev->type = ARPHRD_IEEE80211_RADIOTAP;
strncpy(mon_ndev->name, name, IFNAMSIZ);
mon_ndev->name[IFNAMSIZ - 1] = 0;
mon_ndev->destructor = rtw_ndev_destructor;
#if (LINUX_VERSION_CODE>=KERNEL_VERSION(4,11,9))
mon_ndev->needs_free_netdev = false;
mon_ndev->priv_destructor = rtw_ndev_destructor;
#else
mon_ndev->destructor = rtw_ndev_destructor;
#endif

#if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,29))
mon_ndev->netdev_ops = &rtw_cfg80211_monitor_if_ops;
Expand Down Expand Up @@ -4018,7 +4044,11 @@ static int
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0))
unsigned char name_assign_type,
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0))
enum nl80211_iftype type, struct vif_params *params)
#else
enum nl80211_iftype type, u32 *flags, struct vif_params *params)
#endif
{
int ret = 0;
struct net_device* ndev = NULL;
Expand Down Expand Up @@ -6476,7 +6506,11 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy)
#endif

#if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0))
wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN;
#else // kernel >= 4.12
wiphy->max_sched_scan_reqs = 1;
#endif
#ifdef CONFIG_PNO_SUPPORT
wiphy->max_sched_scan_ssids = MAX_PNO_LIST_COUNT;
#endif
Expand Down
7 changes: 7 additions & 0 deletions os_dep/linux/usb_intf.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,15 @@ static struct usb_device_id rtw_usb_id_tbl[] ={
{USB_DEVICE(0x13b1, 0x003f),.driver_info = RTL8812}, /* Linksys - WUSB6300 */
{USB_DEVICE(0x2357, 0x0101),.driver_info = RTL8812}, /* TP-Link - Archer T4U */
{USB_DEVICE(0x2357, 0x0103),.driver_info = RTL8812}, /* TP-Link - T4UH */
{USB_DEVICE(0x2357, 0x010D),.driver_info = RTL8812}, /* TP-Link - Archer T4U AC1300 */
{USB_DEVICE(0x2357, 0x010E),.driver_info = RTL8812}, /* TP-Link - Archer T4UH AC1300 */
{USB_DEVICE(0x2357, 0x010F),.driver_info = RTL8812}, /* TP-Link - T4UHP */
{USB_DEVICE(0x2357, 0x0122),.driver_info = RTL8812}, /* TP-Link - T4UHP (other) */
{USB_DEVICE(0x20f4, 0x805b),.driver_info = RTL8812}, /* TRENDnet - */
{USB_DEVICE(0x0411, 0x025d),.driver_info = RTL8812}, /* Buffalo - WI-U3-866D */
{USB_DEVICE(0x050D, 0x1109),.driver_info = RTL8812}, /* Belkin F9L1109 - SerComm */
{USB_DEVICE(0x148F, 0x9097), .driver_info = RTL8812}, /* Amped Wireless ACA1 */
{USB_DEVICE(0x0BDA, 0x8812), .driver_info = RTL8812}, /* Alfa - AWUS036AC */
#endif

#ifdef CONFIG_RTL8821A
Expand All @@ -193,6 +199,7 @@ static struct usb_device_id rtw_usb_id_tbl[] ={
{USB_DEVICE(0x0411, 0x0242),.driver_info = RTL8821}, /* ELECOM - WDC-433DU2H */
{USB_DEVICE(0x2019, 0xAB32),.driver_info = RTL8821}, /* Planex - GW-450S */
{USB_DEVICE(0x0846, 0x9052),.driver_info = RTL8821}, /* Netgear - A6100 */
{USB_DEVICE(0x0411, 0x029b),.driver_info = RTL8821}, /* Buffalo - WI-U2-433DHP */
#endif

#ifdef CONFIG_RTL8192E
Expand Down