diff --git a/.github/workflows/autocompiler.yml b/.github/workflows/autocompiler.yml new file mode 100644 index 00000000..723afa67 --- /dev/null +++ b/.github/workflows/autocompiler.yml @@ -0,0 +1,57 @@ +name: autoinstaller + +on: [push] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + +jobs: + build: + runs-on: ubuntu-latest + env: + CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: install dependencies + run: | + sudo apt install -y ruby-dev + sudo gem install fpm + + - name: create installer + run: | + mkdir ../temp + mkdir ../temp2 + cp -r packagedir/* ../temp2 + rm -Rf packagedir + mv * ../temp + mkdir -p packagedir/opt/rtl8812au/ + mv ../temp/* packagedir/opt/rtl8812au + mv ../temp2/* packagedir/ + fpm -a arm64 -s dir -t deb -n rtl8812au-autocompiler -v 2.3.4-$(date '+%m%d%H%M') -C ./packagedir/ -p rtl8812au-autocompiler.deb --after-install packagedir/opt/rtl8812au/after-install.sh + ls -a + + + - name: Upload to Github + uses: 'actions/upload-artifact@v2' + with: + name: "rtl8812au-autocompiler" + path: | + *.deb + + - name: Push + id: push + uses: cloudsmith-io/action@master + with: + api-key: ${{ secrets.CLOUDSMITH_API_KEY }} + command: "push" + format: "deb" + owner: "openhd" + repo: "openhd-2-3-evo" + distro: "any-distro" + release: "any-version" + republish: "true" # needed ONLY if version is not changing + file: "*.deb" diff --git a/.gitignore b/.gitignore index 0971eb15..0b1c4653 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ modules.order *.mod.c .tmp_versions .cache.mk +.idea diff --git a/Kconfig b/Kconfig index e73fc154..d8cd3091 100644 --- a/Kconfig +++ b/Kconfig @@ -1,5 +1,6 @@ config RTL8812AU tristate "Realtek 8812A USB WiFi" depends on USB - ---help--- + select WIRELESS_EXT + help Help message of RTL8812AU diff --git a/Makefile b/Makefile index 21003ffc..bbd0723f 100755 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ EXTRA_CFLAGS += -Wno-unused-function EXTRA_CFLAGS += -Wno-unused EXTRA_CFLAGS += -Wno-cast-function-type EXTRA_CFLAGS += -Wno-date-time -#EXTRA_CFLAGS += -Wno-misleading-indentation +EXTRA_CFLAGS += -Wno-misleading-indentation EXTRA_CFLAGS += -Wno-uninitialized # Relax some warnings from '-Wextra' so we won't get flooded with warnings EXTRA_CFLAGS += -Wno-sign-compare @@ -94,7 +94,7 @@ CONFIG_USB2_EXTERNAL_POWER = y CONFIG_RTW_DEBUG = y # default log level is _DRV_INFO_ = 4, # please refer to "How_to_set_driver_debug_log_level.doc" to set the available level. -CONFIG_RTW_LOG_LEVEL = 4 #Consti10 3==DRV_WARNING +CONFIG_RTW_LOG_LEVEL = 3 #Consti10 3==DRV_WARNING ######################## Wake On Lan ########################## CONFIG_WOWLAN = n CONFIG_WAKEUP_TYPE = 0x7 #bit2: deauth, bit1: unicast, bit0: magic pkt. diff --git a/after-install.sh b/after-install.sh new file mode 100644 index 00000000..65d9cb56 --- /dev/null +++ b/after-install.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +systemctl enable rtl8812auEasyCompile +chmod +x /usr/local/bin/rtl8812auEasyCompile.sh \ No newline at end of file diff --git a/core/rtw_cmd.c b/core/rtw_cmd.c index 5c337b2d..5d7be4a6 100644 --- a/core/rtw_cmd.c +++ b/core/rtw_cmd.c @@ -1496,7 +1496,7 @@ u8 rtw_joinbss_cmd(_adapter *padapter, struct wlan_network *pnetwork) #endif /* CONFIG_80211N_HT */ #ifdef CONFIG_RTW_80211R - /*IEEE802.11-2012 Std. Table 8-101¡XAKM suite selectors*/ + /*IEEE802.11-2012 Std. Table 8-101�XAKM suite selectors*/ if ((rtw_chk_ft_flags(padapter, RTW_FT_STA_SUPPORTED)) && ((psecuritypriv->rsn_akm_suite_type == 3) || (psecuritypriv->rsn_akm_suite_type == 4)) ) { @@ -2103,6 +2103,10 @@ u8 rtw_set_chbw_cmd(_adapter *padapter, u8 ch, u8 bw, u8 ch_offset, u8 flags) RTW_INFO(FUNC_NDEV_FMT" ch:%u, bw:%u, ch_offset:%u\n", FUNC_NDEV_ARG(padapter->pnetdev), ch, bw, ch_offset); + if(true){ + RTW_WARN(FUNC_NDEV_FMT" ch:%u, bw:%u, ch_offset:%uOpenHD channel debug\n", + FUNC_NDEV_ARG(padapter->pnetdev), ch, bw, ch_offset); + } /* check input parameter */ diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index c6abf49f..4fd8df1c 100644 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -3317,6 +3317,10 @@ unsigned int on_action_spct_ch_switch(_adapter *padapter, struct sta_info *psta, RTW_INFO(FUNC_NDEV_FMT" from "MAC_FMT"\n", FUNC_NDEV_ARG(padapter->pnetdev), MAC_ARG(psta->cmn.mac_addr)); + if(true){ + RTW_WARN(FUNC_NDEV_FMT" from "MAC_FMT"OpenHD channel debug\n", + FUNC_NDEV_ARG(padapter->pnetdev), MAC_ARG(psta->cmn.mac_addr)); + } for_each_ie(ie, ies, ies_len) { if (ie->id == WLAN_EID_CHANNEL_SWITCH) { diff --git a/hal/rtl8812a/usb/rtl8812au_xmit.c b/hal/rtl8812a/usb/rtl8812au_xmit.c index a6148227..aa86d06a 100644 --- a/hal/rtl8812a/usb/rtl8812au_xmit.c +++ b/hal/rtl8812a/usb/rtl8812au_xmit.c @@ -112,24 +112,15 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz , u8 ba SET_TX_DESC_QUEUE_SEL_8812(ptxdesc, pattrib->qsel); /* offset 12 */ - // Not injected - if(pattrib->inject != 0xa5) - { - if (!pattrib->qos_en) { - SET_TX_DESC_HWSEQ_EN_8812(ptxdesc, 1); /* Hw set sequence number */ - } else { - SET_TX_DESC_SEQ_8812(ptxdesc, pattrib->seqnum); - } - } + + if (!pattrib->qos_en) { + SET_TX_DESC_HWSEQ_EN_8812(ptxdesc, 1); /* Hw set sequence number */ + } else + SET_TX_DESC_SEQ_8812(ptxdesc, pattrib->seqnum); /* injected frame */ if(pattrib->inject == 0xa5) { - /* Prevent sequence number from being overwritten */ - SET_TX_DESC_HWSEQ_EN_8812(ptxdesc, 0); /* Hw do not set sequence number */ - SET_TX_DESC_SEQ_8812(ptxdesc, pattrib->seqnum); /* Copy inject sequence number to TxDesc */ - SET_TX_DESC_RETRY_LIMIT_ENABLE_8812(ptxdesc, 1); - if (pattrib->retry_ctrl == _TRUE) { SET_TX_DESC_DATA_RETRY_LIMIT_8812(ptxdesc, 6); } else { @@ -328,7 +319,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz , u8 ba if (pattrib->retry_ctrl == _TRUE) SET_TX_DESC_DATA_RETRY_LIMIT_8812(ptxdesc, 6); else - SET_TX_DESC_DATA_RETRY_LIMIT_8812(ptxdesc, 0); + SET_TX_DESC_DATA_RETRY_LIMIT_8812(ptxdesc, 12); } #ifdef CONFIG_XMIT_ACK @@ -416,9 +407,7 @@ s32 rtl8812au_xmit_buf_handler(PADAPTER padapter) break; /* only XMITBUF_DATA & XMITBUF_MGNT */ - pxmitframe = (struct xmit_frame *) pxmitbuf->priv_data; rtw_write_port_and_wait(padapter, pxmitbuf->ff_hwaddr, pxmitbuf->len, (unsigned char *)pxmitbuf, 500); - rtw_free_xmitframe(pxmitpriv, pxmitframe); } while (1); #ifdef CONFIG_LPS_LCLK @@ -453,7 +442,7 @@ u32 upload_txpktbuf_8812au(_adapter *adapter, u8 *buf, u32 buflen) } rtw_write32(adapter, REG_PKTBUF_DBG_CTRL, 0xff800000+(beacon_head<<6) + qw_addr); loop_cnt = 0; - while ((rtw_read32(adapter, REG_PKTBUF_DBG_CTRL) & BIT23) != _FALSE) { + while ((rtw_read32(adapter, REG_PKTBUF_DBG_CTRL) & BIT23) == false) { rtw_udelay_os(10); if (loop_cnt++ == 100) return _FALSE; diff --git a/include/drv_types.h b/include/drv_types.h index 3c05228d..a0401138 100644 --- a/include/drv_types.h +++ b/include/drv_types.h @@ -334,6 +334,8 @@ struct registry_priv { #endif u8 RegEnableTxPowerByRate; u8 RegTxPowerIndexOverride; + int32_t openhd_override_channel; + int32_t openhd_override_channel_width; u8 target_tx_pwr_valid; s8 target_tx_pwr_2g[RF_PATH_MAX][RATE_SECTION_NUM]; diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c index 62f6b4c7..6af3dd1b 100644 --- a/os_dep/linux/ioctl_cfg80211.c +++ b/os_dep/linux/ioctl_cfg80211.c @@ -408,7 +408,6 @@ u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset, u8 if (ret != _SUCCESS) goto exit; - #if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)) cfg80211_ch_switch_notify(adapter->pnetdev, &chdef, 0, 0); #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) @@ -5010,13 +5009,17 @@ struct cfg80211_chan_def *chandef){ chandef->center_freq1 = center_freq; chandef->center_freq2 = center_freq2; //RTW_INFO("%s : channel %d width %d freq1 %d freq2 %d center_freq %d offset %d\n", __func__, channel, width, chandef->center_freq1, chandef->center_freq2, chandef->chan->center_freq,rtw_get_oper_choffset(padapter)); + // Consti10: this method seems to be used + if(true){ + RTW_WARN("OpenHD channel debug: %s : channel %d width %d freq1 %d freq2 %d center_freq %d offset %d\n", __func__, channel, width, chandef->center_freq1, chandef->center_freq2, chandef->chan->center_freq,rtw_get_oper_choffset(padapter)); + } } else { return -EINVAL; } return 0; - } +// Consti10: In monitor mode, this method seems to be not used (set_monitor_channel is used instead) static int cfg80211_rtw_set_channel(struct wiphy *wiphy #if (CFG80211_API_LEVEL >= KERNEL_VERSION(2, 6, 35)) , struct net_device *ndev @@ -5058,12 +5061,17 @@ static int cfg80211_rtw_set_channel(struct wiphy *wiphy RTW_INFO(FUNC_ADPT_FMT" ch:%d bw:%d, offset:%d\n" , FUNC_ADPT_ARG(padapter), chan_target, chan_width, chan_offset); + if(true){ + RTW_WARN(FUNC_ADPT_FMT" ch:%d bw:%d, offset:%d OpenHD channel debug\n" + , FUNC_ADPT_ARG(padapter), chan_target, chan_width, chan_offset); + } rtw_set_chbw_cmd(padapter, chan_target, chan_width, chan_offset, RTW_CMDF_WAIT_ACK); return 0; } +// Consti10: In monitor mode, this method is used the set the channel freq, at least on ubuntu 5.19.X static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy #if (CFG80211_API_LEVEL >= KERNEL_VERSION(3, 8, 0)) , struct cfg80211_chan_def *chandef @@ -5158,6 +5166,22 @@ static int cfg80211_rtw_set_monitor_channel(struct wiphy *wiphy RTW_INFO(FUNC_ADPT_FMT" ch:%d bw:%d, offset:%d\n" , FUNC_ADPT_ARG(padapter), target_channal, target_width, target_offset); + // OpenHD channel via module param + { + if(padapter->registrypriv.openhd_override_channel){ + target_channal=padapter->registrypriv.openhd_override_channel; + RTW_WARN("OpenHD: using openhd_override_channel"); + } + if(padapter->registrypriv.openhd_override_channel_width){ + target_width=padapter->registrypriv.openhd_override_channel_width; + RTW_WARN("OpenHD: using openhd_override_channel_width"); + } + } + + if(true){ + RTW_WARN(FUNC_ADPT_FMT" ch:%d bw:%d, offset:%d OpenHD channel debug\n" + , FUNC_ADPT_ARG(padapter), target_channal, target_width, target_offset); + } rtw_set_chbw_cmd(padapter, target_channal, target_width, target_offset, RTW_CMDF_WAIT_ACK); return 0; @@ -7819,6 +7843,7 @@ static struct cfg80211_ops rtw_cfg80211_ops = { .flush_pmksa = cfg80211_rtw_flush_pmksa, #ifdef CONFIG_AP_MODE + .add_virtual_intf = cfg80211_rtw_add_virtual_intf, .del_virtual_intf = cfg80211_rtw_del_virtual_intf, diff --git a/os_dep/linux/os_intfs.c b/os_dep/linux/os_intfs.c index 74857213..457c4be8 100644 --- a/os_dep/linux/os_intfs.c +++ b/os_dep/linux/os_intfs.c @@ -588,6 +588,17 @@ int rtw_tx_pwr_by_rate = CONFIG_TXPWR_BY_RATE_EN; module_param(rtw_tx_pwr_by_rate, int, 0644); MODULE_PARM_DESC(rtw_tx_pwr_by_rate, "0:Disable, 1:Enable, 2: Depend on efuse"); +// OpenHD params +int openhd_override_channel = 0; +module_param(openhd_override_channel, int, 0644); +MODULE_PARM_DESC(openhd_override_channel, "OpenHD easy (CRDA workaround)"); +// +int openhd_override_channel_width = 0; +module_param(openhd_override_channel_width, int, 0644); +MODULE_PARM_DESC(openhd_override_channel_width, "OpenHD easy (CRDA workaround)"); +// + + #ifdef CONFIG_TXPWR_LIMIT int rtw_tx_pwr_lmt_enable = CONFIG_TXPWR_LIMIT_EN; module_param(rtw_tx_pwr_lmt_enable, int, 0644); @@ -1013,6 +1024,11 @@ uint loadparam(_adapter *padapter) registry_par->RegTxPowerIndexOverride = (u8)rtw_tx_pwr_idx_override; RTW_INFO("OpenHD:rtw_tx_pwr_idx_override:%d\n",(int)rtw_tx_pwr_idx_override); + registry_par->openhd_override_channel = openhd_override_channel; + registry_par->openhd_override_channel_width = openhd_override_channel_width; + RTW_WARN("OpenHD: openhd_override_channel %d, openhd_override_channel_width: %d", + registry_par->openhd_override_channel,registry_par->openhd_override_channel_width); + rtw_regsty_load_target_tx_power(registry_par); diff --git a/packagedir/etc/systemd/system/rtl8812auEasyCompile.service b/packagedir/etc/systemd/system/rtl8812auEasyCompile.service new file mode 100644 index 00000000..0847751b --- /dev/null +++ b/packagedir/etc/systemd/system/rtl8812auEasyCompile.service @@ -0,0 +1,13 @@ +[Unit] +Description=rtl8812au Compiler +After=multi-user.target + +[Service] +Type=simple +ExecStart=/usr/local/bin/rtl8812auEasyCompile.sh +User=root + + +[Install] +WantedBy=multi-user.target + diff --git a/packagedir/usr/local/bin/rtl8812auEasyCompile.sh b/packagedir/usr/local/bin/rtl8812auEasyCompile.sh new file mode 100644 index 00000000..03d3e809 --- /dev/null +++ b/packagedir/usr/local/bin/rtl8812auEasyCompile.sh @@ -0,0 +1,13 @@ +#!/bin/bash +echo "We're now compiling the rtl8812au driver into your stock kernel" +sudo apt install -y dkms +cd /opt/rtl8812au/ +sudo ./dkms-install.sh > /opt/installrtl.log +systemctl disable rtl8812auEasyCompile +sudo rm -Rf /etc/systemd/system/rtl8812auEasyCompile.service +sudo rm -Rf /usr/local/bin/rtl8812auEasyCompile.sh +echo "cleanup done" +rm /etc/motd +mv /etc/motd2 /etc/motd +systemctl enable openhd +reboot