Skip to content

Commit

Permalink
Merge pull request #246 from kimocoder/v5.2.20
Browse files Browse the repository at this point in the history
ROLLOUT: Collection of fixes both major and minor
  • Loading branch information
kimocoder committed Jan 6, 2019
2 parents 67e27a1 + 56e7415 commit 1ae2f32
Show file tree
Hide file tree
Showing 118 changed files with 152 additions and 26,743 deletions.
412 changes: 2 additions & 410 deletions Makefile

Large diffs are not rendered by default.

95 changes: 69 additions & 26 deletions README.md
@@ -1,79 +1,121 @@
## RTL8812AU/21AU and RTL8814AU drivers
## with monitor mode and frame injection
### Supports Realtek 8811, 8812, 8814 and 8821 chipsets

[![Monitor mode](https://img.shields.io/badge/monitor%20mode-working-brightgreen.svg)](#)
[![Frame Injection](https://img.shields.io/badge/frame%20injection-working-brightgreen.svg)](#)
[![GitHub version](https://badge.fury.io/gh/aircrack-ng%2Frtl8812au.svg)](https://badge.fury.io/gh/aircrack-ng%2Frtl8812au)
[![GitHub issues](https://img.shields.io/github/issues/aircrack-ng/rtl8812au.svg)](https://github.com/aircrack-ng/rtl8812au/issues)
[![GitHub forks](https://img.shields.io/github/forks/aircrack-ng/rtl8812au.svg)](https://github.com/aircrack-ng/rtl8812au/network)
[![GitHub stars](https://img.shields.io/github/stars/aircrack-ng/rtl8812au.svg)](https://github.com/aircrack-ng/rtl8812au/stargazers)
[![GitHub license](https://img.shields.io/github/license/aircrack-ng/rtl8812au.svg)](https://github.com/aircrack-ng/rtl8812au/blob/master/LICENSE)
<br>
[![Kali](https://img.shields.io/badge/Kali-supported-blue.svg)](https://www.kali.org)
[![aircrack-ng](https://img.shields.io/badge/aircrack--ng-supported-blue.svg)](https://github.com/aircrack-ng/aircrack-ng)
[![wifite2](https://img.shields.io/badge/wifite2-supported-blue.svg)](https://github.com/derv82/wifite2)

### What's NEW
```
* december: working on a major update/bugfixes.
may be seen rolling out over here https://github.com/aircrack-ng/rtl8812au/pull/246
* october: airmon-ng now got support for this driver (even without virtual interface support)
## Kernel v4.19 and v4.20 supported.
## Also working to get more old/new kernels supported.
```

### 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:
```
sudo apt-get install dkms
$ sudo apt-get install dkms
```

### Installation of Driver
In order to install the driver open a terminal in the directory with the source code and execute the following command:
```
sudo ./dkms-install.sh
$ sudo ./dkms-install.sh
```

### Removal of Driver
In order to remove the driver from your system open a terminal in the directory with the source code and execute the following command:
```
sudo ./dkms-remove.sh
$ sudo ./dkms-remove.sh
```

### Make
For building & installing the driver with 'make' use
```
make
make install
$ make
$ make install
```

### Notes
Download
```
git clone -b v5.2.20 https://github.com/aircrack-ng/rtl8812au.git
cd rtl*
$ git clone -b v5.2.20 https://github.com/aircrack-ng/rtl8812au.git
$ cd rtl*
```
Package / Build dependencies (Kali)
```
sudo apt-get install build-essential
sudo apt-get install bc
sudo apt-get install libelf-dev
sudo apt-get install linux-headers-`uname -r`
$ sudo apt-get install build-essential
$ sudo apt-get install bc
$ sudo apt-get install libelf-dev
$ sudo apt-get install linux-headers-`uname -r`
```
For Raspberry (RPI)
For Raspberry (RPI 2/3) you will need kernel sources
```
sudo apt-get install raspberrypi-kernel-headers
$ sudo wget "https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source" -O /usr/bin/rpi-source
$ sudo chmod 755 /usr/bin/rpi-source
$ sudo rpi-source
```

or, on Raspberry Pi 3 Model B+
Then you need to download and compile the driver on the RPI
```
$ git clone https://github.com/aircrack-ng/rtl8812au -b v5.2.20
$ cd rtl*
$ make
$ sudo cp 8812au.ko /lib/modules/`uname -r`/kernel/drivers/net/wireless
$ sudo depmod -a
$ sudo modprobe 88XXau
```
CONFIG_PLATFORM_I386_PC = n
CONFIG_PLATFORM_ARM64_RPI = y
then run this step to change platform in Makefile, For RPI 2/3:
```
$ sed -i 's/CONFIG_PLATFORM_I386_PC = y/CONFIG_PLATFORM_I386_PC = n/g' Makefile
$ sed -i 's/CONFIG_PLATFORM_ARM_RPI = n/CONFIG_PLATFORM_ARM_RPI = y/g' Makefile
```
But for RPI 3 B+ you will need to run those below
which builds the ARM64 arch driver:
```
$ sed -i 's/CONFIG_PLATFORM_I386_PC = y/CONFIG_PLATFORM_I386_PC = n/g' Makefile
$ sed -i 's/CONFIG_PLATFORM_ARM64_RPI = n/CONFIG_PLATFORM_ARM64_RPI = y/g' Makefile
```

For setting monitor mode
1. Fix problematic interference in monitor mode.
```
airmon-ng check kill
$ airmon-ng check kill
```
You may also uncheck the box "Automatically connect to this network when it is avaiable" in nm-connection-editor. This only works if you have a saved wifi connection.

2. Set interface down
```
sudo ip link set wlan0 down
$ sudo ip link set <wlan1> down
```
3. Set monitor mode
```
sudo iw dev wlan0 set type monitor
$ sudo airmon-ng start <wlan1>
or
$ sudo iw dev <wlan1> set type monitor
```
4. Set interface up
```
sudo ip link set wlan0 up
$ sudo ip link set <wlan1> up
```
For setting TX power
```
sudo iw wlan0 set txpower fixed 3000
$ sudo iwconfig <wlan1> txpower 30
or
$ sudo iw <wla1> nset txpower fixed 3000
```

### LED control

#### You can now control LED behaviour statically by Makefile, for example:
Expand All @@ -83,13 +125,14 @@ CONFIG_LED_ENABLE = n
```
value can be y or n

#### statically by module parameter in /etc/modprobe.d/8812au.conf or wherever, for example:
#### statically by module parameter in /etc/modprobe.d/8812au.conf or whatever, example:

```sh
options 88XXau rtw_led_enable=0
```
value can be 0 or 1


#### or dynamically by writing to /proc/net/rtl8812au/$(your interface name)/led_enable, for example:

```sh
Expand All @@ -113,5 +156,5 @@ wifi.scan-rand-mac-address=no
```
at the end of file /etc/NetworkManager/NetworkManager.conf and restart NetworkManager with the command:
```
sudo service NetworkManager restart
$ sudo service NetworkManager restart
```
7 changes: 0 additions & 7 deletions core/rtw_debug.c
Expand Up @@ -80,19 +80,12 @@ void dump_drv_cfg(void *sel)
RTW_PRINT_SEL(sel, "CONFIG_POWER_SAVING\n");
#endif

#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
RTW_PRINT_SEL(sel, "LOAD_PHY_PARA_FROM_FILE - REALTEK_CONFIG_PATH=%s\n", REALTEK_CONFIG_PATH);
#if defined(CONFIG_MULTIDRV) || defined(REALTEK_CONFIG_PATH_WITH_IC_NAME_FOLDER)
RTW_PRINT_SEL(sel, "LOAD_PHY_PARA_FROM_FILE - REALTEK_CONFIG_PATH_WITH_IC_NAME_FOLDER\n");
#endif

/* configurations about TX power */
#ifdef CONFIG_CALIBRATE_TX_POWER_BY_REGULATORY
RTW_PRINT_SEL(sel, "CONFIG_CALIBRATE_TX_POWER_BY_REGULATORY\n");
#endif
#ifdef CONFIG_CALIBRATE_TX_POWER_TO_MAX
RTW_PRINT_SEL(sel, "CONFIG_CALIBRATE_TX_POWER_TO_MAX\n");
#endif
#endif
RTW_PRINT_SEL(sel, "RTW_DEF_MODULE_REGULATORY_CERT=0x%02x\n", RTW_DEF_MODULE_REGULATORY_CERT);

Expand Down
4 changes: 2 additions & 2 deletions core/rtw_mlme_ext.c
Expand Up @@ -11844,8 +11844,8 @@ static void rtw_mlmeext_disconnect(_adapter *padapter)
self_action = MLME_ADHOC_STOPPED;
else if (MLME_IS_NULL(padapter))
self_action = MLME_ACTION_NONE;
else
rtw_warn_on(1);
//else
// rtw_warn_on(1);

/* set_opmode_cmd(padapter, infra_client_with_mlme); */

Expand Down
2 changes: 1 addition & 1 deletion dkms.conf
@@ -1,5 +1,5 @@
PACKAGE_NAME="realtek-rtl88xxau"
PACKAGE_VERSION="5.2.20.2~20181213"
PACKAGE_VERSION="5.2.20.2~20190102"
CLEAN="'make' clean"
BUILT_MODULE_NAME[0]=88XXau
PROCS_NUM=`nproc`
Expand Down
122 changes: 0 additions & 122 deletions hal/hal_btcoex.c
Expand Up @@ -4823,128 +4823,6 @@ void hal_btcoex_SetAntIsolationType(PADAPTER padapter, u8 anttype)

}

#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
int
hal_btcoex_ParseAntIsolationConfigFile(
PADAPTER Adapter,
char *buffer
)
{
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
u32 i = 0 , j = 0;
char *szLine , *ptmp;
int rtStatus = _SUCCESS;
char param_value_string[10];
u8 param_value;
u8 anttype = 4;

u8 ant_num = 3 , ant_distance = 50 , rfe_type = 1;

typedef struct ant_isolation {
char *param_name; /* antenna isolation config parameter name */
u8 *value; /* antenna isolation config parameter value */
} ANT_ISOLATION;

ANT_ISOLATION ant_isolation_param[] = {
{"ANT_NUMBER" , &ant_num},
{"ANT_DISTANCE" , &ant_distance},
{"RFE_TYPE" , &rfe_type},
{NULL , 0}
};



/* RTW_INFO("===>Hal_ParseAntIsolationConfigFile()\n" ); */

ptmp = buffer;
for (szLine = GetLineFromBuffer(ptmp) ; szLine != NULL; szLine = GetLineFromBuffer(ptmp)) {
/* skip comment */
if (IsCommentString(szLine))
continue;

/* RTW_INFO("%s : szLine = %s , strlen(szLine) = %d\n" , __func__ , szLine , strlen(szLine));*/
for (j = 0 ; ant_isolation_param[j].param_name != NULL ; j++) {
if (strstr(szLine , ant_isolation_param[j].param_name) != NULL) {
i = 0;
while (i < strlen(szLine)) {
if (szLine[i] != '"')
++i;
else {
/* skip only has one " */
if (strpbrk(szLine , "\"") == strrchr(szLine , '"')) {
RTW_INFO("Fail to parse parameters , format error!\n");
break;
}
_rtw_memset((PVOID)param_value_string , 0 , 10);
if (!ParseQualifiedString(szLine , &i , param_value_string , '"' , '"')) {
RTW_INFO("Fail to parse parameters\n");
return _FAIL;
} else if (!GetU1ByteIntegerFromStringInDecimal(param_value_string , ant_isolation_param[j].value))
RTW_INFO("Fail to GetU1ByteIntegerFromStringInDecimal\n");

break;
}
}
}
}
}

/* YiWei 20140716 , for BT coex antenna isolation control */
/* rfe_type = 0 was SPDT , rfe_type = 1 was coupler */
if (ant_num == 3 && ant_distance >= 50)
anttype = 3;
else if (ant_num == 2 && ant_distance >= 50 && rfe_type == 1)
anttype = 2;
else if (ant_num == 3 && ant_distance >= 15 && ant_distance < 50)
anttype = 2;
else if (ant_num == 2 && ant_distance >= 15 && ant_distance < 50 && rfe_type == 1)
anttype = 2;
else if ((ant_num == 2 && ant_distance < 15 && rfe_type == 1) || (ant_num == 3 && ant_distance < 15))
anttype = 1;
else if (ant_num == 2 && rfe_type == 0)
anttype = 0;
else
anttype = 0;

hal_btcoex_SetAntIsolationType(Adapter, anttype);

RTW_INFO("%s : ant_num = %d\n" , __func__ , ant_num);
RTW_INFO("%s : ant_distance = %d\n" , __func__ , ant_distance);
RTW_INFO("%s : rfe_type = %d\n" , __func__ , rfe_type);
/* RTW_INFO("<===Hal_ParseAntIsolationConfigFile()\n"); */
return rtStatus;
}


int
hal_btcoex_AntIsolationConfig_ParaFile(
IN PADAPTER Adapter,
IN char *pFileName
)
{
HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
int rlen = 0 , rtStatus = _FAIL;

_rtw_memset(pHalData->para_file_buf , 0 , MAX_PARA_FILE_BUF_LEN);

rtw_get_phy_file_path(Adapter, pFileName);
if (rtw_is_file_readable(rtw_phy_para_file_path) == _TRUE) {
rlen = rtw_retrieve_from_file(rtw_phy_para_file_path, pHalData->para_file_buf, MAX_PARA_FILE_BUF_LEN);
if (rlen > 0)
rtStatus = _SUCCESS;
}


if (rtStatus == _SUCCESS) {
/*RTW_INFO("%s(): read %s ok\n", __func__ , pFileName);*/
rtStatus = hal_btcoex_ParseAntIsolationConfigFile(Adapter , pHalData->para_file_buf);
} else
RTW_INFO("%s(): No File %s, Load from *** Array!\n" , __func__ , pFileName);

return rtStatus;
}
#endif /* CONFIG_LOAD_PHY_PARA_FROM_FILE */

u16 hal_btcoex_btreg_read(PADAPTER padapter, u8 type, u16 addr, u32 *data)
{
u16 ret = 0;
Expand Down
5 changes: 0 additions & 5 deletions hal/hal_com.c
Expand Up @@ -100,11 +100,6 @@ void rtw_hal_read_sta_dk_key(_adapter *adapter, u8 key_id)
}
#endif


#ifdef CONFIG_LOAD_PHY_PARA_FROM_FILE
char rtw_phy_para_file_path[PATH_LENGTH_MAX];
#endif

void dump_chip_info(HAL_VERSION ChipVersion)
{
int cnt = 0;
Expand Down

0 comments on commit 1ae2f32

Please sign in to comment.