Skip to content

Commit

Permalink
Merge pull request diederikdehaas#62 from evilphish/v5.1.5
Browse files Browse the repository at this point in the history
* Nuked all hardcoded reg-domain nonsense
* Set CONFIG_RTW_ADAPTIVITY_EN to "auto"
* Fixed unreachable switch in 8812au antenna (Hal_SetAntenna)
* Fixed a compile warning in "wifi_regd.c"
* Fixed a compilation error/crash
* Added kernel v4.15 support (probably not finished up, needs testing)
* More USB VID/PID added
* Spacing cleanups
* Enabled logging for power limits
* Enabled more debug
* Removed "dump_drv_version()" do not print build date (newer kernels doesn't support it anyway)
* Updated README.md (removed TODO tab) using issue reports instead
  • Loading branch information
kimocoder committed Dec 10, 2017
2 parents aa590f3 + 1324486 commit 37d7516
Show file tree
Hide file tree
Showing 21 changed files with 194 additions and 763 deletions.
15 changes: 3 additions & 12 deletions Makefile
Expand Up @@ -14,8 +14,8 @@ EXTRA_CFLAGS += -Wno-unused-parameter
EXTRA_CFLAGS += -Wno-unused-function
EXTRA_CFLAGS += -Wno-unused
EXTRA_CFLAGS += -Wno-date-time
#EXTRA_CFLAGS += -Wno-misleading-indentation
#EXTRA_CFLAGS += -Wno-uninitialized
EXTRA_CFLAGS += -Wno-misleading-indentation
EXTRA_CFLAGS += -Wno-uninitialized

GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc )
ifeq ($(GCC_VER_49),1)
Expand Down Expand Up @@ -62,7 +62,7 @@ CONFIG_TRAFFIC_PROTECT = y
CONFIG_LOAD_PHY_PARA_FROM_FILE = y
CONFIG_CALIBRATE_TX_POWER_BY_REGULATORY = n
CONFIG_CALIBRATE_TX_POWER_TO_MAX = y
CONFIG_RTW_ADAPTIVITY_EN = disable
CONFIG_RTW_ADAPTIVITY_EN = auto
CONFIG_RTW_ADAPTIVITY_MODE = normal
CONFIG_SIGNAL_SCALE_MAPPING = n
CONFIG_80211W = y
Expand Down Expand Up @@ -895,7 +895,6 @@ ifeq ($(CONFIG_WAPI_SUPPORT), y)
EXTRA_CFLAGS += -DCONFIG_WAPI_SUPPORT
endif


ifeq ($(CONFIG_EFUSE_CONFIG_FILE), y)
EXTRA_CFLAGS += -DCONFIG_EFUSE_CONFIG_FILE

Expand Down Expand Up @@ -1078,7 +1077,6 @@ KSRC := $(KERNEL_BUILD_PATH)
MODULE_NAME :=wlan
endif


ifeq ($(CONFIG_PLATFORM_ACTIONS_ATM705X), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
#EXTRA_CFLAGS += -DRTW_ENABLE_WIFI_CONTROL_FUNC
Expand Down Expand Up @@ -1291,8 +1289,6 @@ CROSS_COMPILE := /home/share/CusEnv/FreeScale/arm-eabi-4.4.3/bin/arm-eabi-
KSRC ?= /home/share/CusEnv/FreeScale/FS_kernel_env
endif



ifeq ($(CONFIG_PLATFORM_ACTIONS_ATJ227X), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ACTIONS_ATJ227X
ARCH := mips
Expand Down Expand Up @@ -1457,7 +1453,6 @@ KSRC := /home/winuser/work/Plat_sLD2T_V3010/usr/src/linux-2.6.32.2
INSTALL_PREFIX :=
endif


ifeq ($(CONFIG_PLATFORM_ARM_SUNxI), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
EXTRA_CFLAGS += -DCONFIG_PLATFORM_ARM_SUNxI
Expand Down Expand Up @@ -1807,7 +1802,6 @@ ifeq ($(CONFIG_PCI_HCI), y)
MODULE_NAME := rtw_pci
endif


endif

USER_MODULE_NAME ?=
Expand Down Expand Up @@ -1851,7 +1845,6 @@ endif

$(MODULE_NAME)-y += $(rtk_core)


$(MODULE_NAME)-$(CONFIG_WAPI_SUPPORT) += core/rtw_wapi.o \
core/rtw_wapi_sms4.o

Expand Down Expand Up @@ -1892,7 +1885,6 @@ config_r:
@echo "make config"
/bin/bash script/Configure script/config.in


.PHONY: modules clean

clean:
Expand All @@ -1910,4 +1902,3 @@ clean:
rm -fr *.mod.c *.mod *.o .*.cmd *.ko *~
rm -fr .tmp_versions
endif

14 changes: 0 additions & 14 deletions README.md
@@ -1,20 +1,6 @@
# RTL8812AU/21AU and RTL8814AU drivers
# with monitor mode and frame injection

## TODO
These are the problems that needs attention, any help would be appreciated.
```
* "Associate", "Disassocate" & "Deauthenticate" support is missing.
These should be added in order to get some functions working, like "deauth" attacks.
Check issue report @ https://github.com/aircrack-ng/rtl8812au/issues/35
* txpower control has been added, but some issues remain.
Check issue reports for more information.
* RadioTap FCS flag is set, but frame does not contain FCS.
Check issue report @ https://github.com/aircrack-ng/rtl8812au/issues/28
```
## DKMS
This driver can be installed using [DKMS]. This is a system which will automatically recompile and install a kernel module when a new kernel gets installed or updated. To make use of DKMS, install the `dkms` package, which on Debian (based) systems is done like this:
```
Expand Down
1 change: 0 additions & 1 deletion core/rtw_debug.c
Expand Up @@ -47,7 +47,6 @@ const char *rtw_log_level_str[] = {
void dump_drv_version(void *sel)
{
RTW_PRINT_SEL(sel, "%s %s\n", DRV_NAME, DRIVERVERSION);
RTW_PRINT_SEL(sel, "build time: %s %s\n", __DATE__, __TIME__);
}

void dump_drv_cfg(void *sel)
Expand Down
12 changes: 12 additions & 0 deletions core/rtw_mlme.c
Expand Up @@ -1228,7 +1228,11 @@ void rtw_surveydone_event_callback(_adapter *adapter, u8 *pbuf)
_enter_critical_bh(&pmlmepriv->lock, &irqL);

#ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
_set_timer(&adapter->recvpriv.signal_stat_timer, adapter->recvpriv.signal_stat_sampling_interval);
#else
rtw_set_signal_stat_timer(&adapter->recvpriv);
#endif
#endif

if (pmlmepriv->to_join == _TRUE) {
Expand Down Expand Up @@ -1825,7 +1829,11 @@ static void rtw_joinbss_update_network(_adapter *padapter, struct wlan_network *


#ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
_set_timer(&padapter->recvpriv.signal_stat_timer, padapter->recvpriv.signal_stat_sampling_interval);
#else
rtw_set_signal_stat_timer(&padapter->recvpriv);
#endif
#endif
padapter->recvpriv.signal_strength = ptarget_wlan->network.PhyInfo.SignalStrength;
padapter->recvpriv.signal_qual = ptarget_wlan->network.PhyInfo.SignalQuality;
Expand All @@ -1841,7 +1849,11 @@ static void rtw_joinbss_update_network(_adapter *padapter, struct wlan_network *
);
#endif
#ifdef CONFIG_NEW_SIGNAL_STAT_PROCESS
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
_set_timer(&padapter->recvpriv.signal_stat_timer, padapter->recvpriv.signal_stat_sampling_interval);
#else
rtw_set_signal_stat_timer(&padapter->recvpriv);
#endif
#endif

/* update fw_state */ /* will clr _FW_UNDER_LINKING here indirectly */
Expand Down
78 changes: 69 additions & 9 deletions core/rtw_p2p.c
Expand Up @@ -3269,9 +3269,17 @@ static void ro_ch_handler(_adapter *padapter)

}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
static void ro_ch_timer_process(struct timer_list *t)
#else
static void ro_ch_timer_process(void *FunctionContext)
#endif
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
_adapter *adapter = from_timer(adapter, t, cfg80211_wdinfo.remain_on_ch_timer);
#else
_adapter *adapter = (_adapter *)FunctionContext;
#endif
struct rtw_wdev_priv *pwdev_priv = adapter_wdev_data(adapter);

/* printk("%s\n", __FUNCTION__); */
Expand Down Expand Up @@ -4066,7 +4074,11 @@ void rtw_init_cfg80211_wifidirect_info(_adapter *padapter)

_rtw_memset(pcfg80211_wdinfo, 0x00, sizeof(struct cfg80211_wifidirect_info));

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
timer_setup(&pcfg80211_wdinfo->remain_on_ch_timer, ro_ch_timer_process, 0);
#else
_init_timer(&pcfg80211_wdinfo->remain_on_ch_timer, padapter->pnetdev, ro_ch_timer_process, padapter);
#endif
}
#endif /* CONFIG_IOCTL_CFG80211 */

Expand Down Expand Up @@ -4148,7 +4160,6 @@ int process_p2p_cross_connect_ie(PADAPTER padapter, u8 *IEs, u32 IELength)

struct wifidirect_info *pwdinfo = &(padapter->wdinfo);


if (IELength <= _BEACON_IE_OFFSET_)
return ret;

Expand Down Expand Up @@ -4185,7 +4196,6 @@ void process_p2p_ps_ie(PADAPTER padapter, u8 *IEs, u32 IELength)
u8 find_p2p = _FALSE, find_p2p_ps = _FALSE;
u8 noa_offset, noa_num, noa_index;


if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
return;
#ifdef CONFIG_CONCURRENT_MODE
Expand Down Expand Up @@ -4268,7 +4278,6 @@ void p2p_ps_wk_hdl(_adapter *padapter, u8 p2p_ps_state)
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
struct wifidirect_info *pwdinfo = &(padapter->wdinfo);


/* Pre action for p2p state */
switch (p2p_ps_state) {
case P2P_PS_DISABLE:
Expand Down Expand Up @@ -4333,7 +4342,6 @@ u8 p2p_ps_wk_cmd(_adapter *padapter, u8 p2p_ps_state, u8 enqueue)
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
u8 res = _SUCCESS;


if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)
#ifdef CONFIG_CONCURRENT_MODE
|| (padapter->hw_port != HW_PORT0)
Expand Down Expand Up @@ -4368,15 +4376,22 @@ u8 p2p_ps_wk_cmd(_adapter *padapter, u8 p2p_ps_state, u8 enqueue)

exit:


return res;

}
#endif /* CONFIG_P2P_PS */

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
static void reset_ch_sitesurvey_timer_process(struct timer_list *t)
#else
static void reset_ch_sitesurvey_timer_process(void *FunctionContext)
#endif
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
_adapter *adapter = from_timer(adapter, t, wdinfo.reset_ch_sitesurvey);
#else
_adapter *adapter = (_adapter *)FunctionContext;
#endif
struct wifidirect_info *pwdinfo = &adapter->wdinfo;

if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
Expand All @@ -4393,9 +4408,17 @@ static void reset_ch_sitesurvey_timer_process(void *FunctionContext)
pwdinfo->rx_invitereq_info.scan_op_ch_only = 0;
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
static void reset_ch_sitesurvey_timer_process2(struct timer_list *t)
#else
static void reset_ch_sitesurvey_timer_process2(void *FunctionContext)
#endif
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
_adapter *adapter = from_timer(adapter, t, wdinfo.reset_ch_sitesurvey2);
#else
_adapter *adapter = (_adapter *)FunctionContext;
#endif
struct wifidirect_info *pwdinfo = &adapter->wdinfo;

if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
Expand All @@ -4412,9 +4435,17 @@ static void reset_ch_sitesurvey_timer_process2(void *FunctionContext)
pwdinfo->p2p_info.scan_op_ch_only = 0;
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
static void restore_p2p_state_timer_process (struct timer_list *t)
#else
static void restore_p2p_state_timer_process(void *FunctionContext)
#endif
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
_adapter *adapter = from_timer(adapter, t, wdinfo.restore_p2p_state_timer);
#else
_adapter *adapter = (_adapter *)FunctionContext;
#endif
struct wifidirect_info *pwdinfo = &adapter->wdinfo;

if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
Expand All @@ -4423,9 +4454,17 @@ static void restore_p2p_state_timer_process(void *FunctionContext)
p2p_protocol_wk_cmd(adapter, P2P_RESTORE_STATE_WK);
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
static void pre_tx_scan_timer_process (struct timer_list *t)
#else
static void pre_tx_scan_timer_process(void *FunctionContext)
#endif
{
_adapter *adapter = (_adapter *) FunctionContext;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
_adapter *adapter = from_timer(adapter, t, wdinfo.pre_tx_scan_timer);
#else
_adapter *adapter = (_adapter *) FunctionContext;
#endif
struct wifidirect_info *pwdinfo = &adapter->wdinfo;
_irqL irqL;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
Expand All @@ -4436,7 +4475,6 @@ static void pre_tx_scan_timer_process(void *FunctionContext)

_enter_critical_bh(&pmlmepriv->lock, &irqL);


if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_TX_PROVISION_DIS_REQ)) {
if (_TRUE == pwdinfo->tx_prov_disc_info.benable) { /* the provision discovery request frame is trigger to send or not */
p2p_protocol_wk_cmd(adapter, P2P_PRE_TX_PROVDISC_PROCESS_WK);
Expand All @@ -4455,9 +4493,17 @@ static void pre_tx_scan_timer_process(void *FunctionContext)
_exit_critical_bh(&pmlmepriv->lock, &irqL);
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
static void find_phase_timer_process(struct timer_list *t)
#else
static void find_phase_timer_process(void *FunctionContext)
#endif
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
_adapter *adapter = from_timer(adapter, t, wdinfo.find_phase_timer);
#else
_adapter *adapter = (_adapter *)FunctionContext;
#endif
struct wifidirect_info *pwdinfo = &adapter->wdinfo;

if (rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE))
Expand Down Expand Up @@ -4714,6 +4760,16 @@ void rtw_init_wifidirect_timers(_adapter *padapter)
{
struct wifidirect_info *pwdinfo = &padapter->wdinfo;

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
timer_setup(&pwdinfo->find_phase_timer, find_phase_timer_process, 0);
timer_setup(&pwdinfo->restore_p2p_state_timer, restore_p2p_state_timer_process, 0);
timer_setup(&pwdinfo->pre_tx_scan_timer, pre_tx_scan_timer_process, 0);
timer_setup(&pwdinfo->reset_ch_sitesurvey, reset_ch_sitesurvey_timer_process, 0);
timer_setup(&pwdinfo->reset_ch_sitesurvey2, reset_ch_sitesurvey_timer_process2, 0);
#ifdef CONFIG_CONCURRENT_MODE
timer_setup(&pwdinfo->ap_p2p_switch_timer, ap_p2p_switch_timer_process, 0);
#endif
#else
_init_timer(&pwdinfo->find_phase_timer, padapter->pnetdev, find_phase_timer_process, padapter);
_init_timer(&pwdinfo->restore_p2p_state_timer, padapter->pnetdev, restore_p2p_state_timer_process, padapter);
_init_timer(&pwdinfo->pre_tx_scan_timer, padapter->pnetdev, pre_tx_scan_timer_process, padapter);
Expand All @@ -4722,6 +4778,7 @@ void rtw_init_wifidirect_timers(_adapter *padapter)
#ifdef CONFIG_CONCURRENT_MODE
_init_timer(&pwdinfo->ap_p2p_switch_timer, padapter->pnetdev, ap_p2p_switch_timer_process, padapter);
#endif
#endif
}

void rtw_init_wifidirect_addrs(_adapter *padapter, u8 *dev_addr, u8 *iface_addr)
Expand Down Expand Up @@ -5030,7 +5087,6 @@ void dbg_rtw_p2p_set_role(struct wifidirect_info *wdinfo, enum P2P_ROLE role, co
}
#endif /* CONFIG_DBG_P2P */


int rtw_p2p_enable(_adapter *padapter, enum P2P_ROLE role)
{
int ret = _SUCCESS;
Expand Down Expand Up @@ -5078,16 +5134,20 @@ int rtw_p2p_enable(_adapter *padapter, enum P2P_ROLE role)
adapter_wdev_data(padapter)->p2p_enabled = _FALSE;
#endif /* CONFIG_IOCTL_CFG80211 */


/* Disable P2P function */
if (!rtw_p2p_chk_state(pwdinfo, P2P_STATE_NONE)) {
_cancel_timer_ex(&pwdinfo->find_phase_timer);
_cancel_timer_ex(&pwdinfo->restore_p2p_state_timer);
_cancel_timer_ex(&pwdinfo->pre_tx_scan_timer);
_cancel_timer_ex(&pwdinfo->reset_ch_sitesurvey);
_cancel_timer_ex(&pwdinfo->reset_ch_sitesurvey2);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
reset_ch_sitesurvey_timer_process(&pwdinfo->reset_ch_sitesurvey);
reset_ch_sitesurvey_timer_process2(&pwdinfo->reset_ch_sitesurvey2);
#else
reset_ch_sitesurvey_timer_process(padapter);
reset_ch_sitesurvey_timer_process2(padapter);
#endif
#ifdef CONFIG_CONCURRENT_MODE
_cancel_timer_ex(&pwdinfo->ap_p2p_switch_timer);
#endif
Expand Down
13 changes: 12 additions & 1 deletion core/rtw_pwrctrl.c
Expand Up @@ -393,10 +393,17 @@ void rtw_ps_processor(_adapter *padapter)
return;
}

void pwr_state_check_handler(RTW_TIMER_HDL_ARGS);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
void pwr_state_check_handler(struct timer_list *t)
#else
void pwr_state_check_handler(RTW_TIMER_HDL_ARGS)
#endif
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
_adapter *padapter = from_timer(padapter, t, pwrctrlpriv.pwr_state_check_timer);
#else
_adapter *padapter = (_adapter *)FunctionContext;
#endif
rtw_ps_cmd(padapter);
}

Expand Down Expand Up @@ -1968,7 +1975,11 @@ void rtw_init_pwrctrl_priv(PADAPTER padapter)
#endif /* CONFIG_LPS_RPWM_TIMER */
#endif /* CONFIG_LPS_LCLK */

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
timer_setup(&pwrctrlpriv->pwr_state_check_timer, pwr_state_check_handler, 0);
#else
rtw_init_timer(&pwrctrlpriv->pwr_state_check_timer, padapter, pwr_state_check_handler);
#endif

pwrctrlpriv->wowlan_mode = _FALSE;
pwrctrlpriv->wowlan_ap_mode = _FALSE;
Expand Down

0 comments on commit 37d7516

Please sign in to comment.