Skip to content

Commit

Permalink
patches
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelscholle committed Aug 22, 2024
1 parent c7e1c51 commit efe1416
Show file tree
Hide file tree
Showing 22 changed files with 494 additions and 32 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/build_for_pi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: build on rpi

on: [push]


jobs:
build:
#runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 512
swap-size-mb: 1024
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
overprovision-lvm: 'true'
- name: test
run: |
echo "DT=$(date +'%Y-%m-%d_%H%M')" >> $GITHUB_ENV
echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Building OpenHD in CHROOT
run: |
git clone https://github.com/OpenHD/ChrootCompilationTest /opt/ChrootCompilationTest
mkdir -p /opt/ChrootCompilationTest/additionalFiles
git clone https://github.com/OpenHD/rtl88x2eu -b ${{ github.ref_name }} /opt/ChrootCompilationTest/additionalFiles/ --recursive
echo $CLOUDSMITH_API_KEY > /opt/ChrootCompilationTest/additionalFiles/cloudsmith_api_key.txt
echo "armhf" > /opt/ChrootCompilationTest/additionalFiles/arch.txt
echo "debian" > /opt/ChrootCompilationTest/additionalFiles/distro.txt
echo "bullseye" > /opt/ChrootCompilationTest/additionalFiles/flavor.txt
echo "${{ github.ref_name }}" > /opt/ChrootCompilationTest/additionalFiles/repo.txt
cd /opt/ChrootCompilationTest/
sudo apt update
sudo bash install_dep.sh
sudo bash ./build.sh pi-bullseye $API_KEY debian bullseye
75 changes: 75 additions & 0 deletions .github/workflows/build_for_x86-noble.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: build on x86 noble

on: [push]


jobs:
build:
#runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 512
swap-size-mb: 1024
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
overprovision-lvm: 'true'
- name: test
run: |
echo "DT=$(date +'%Y-%m-%d_%H%M')" >> $GITHUB_ENV
echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Building OpenHD in CHROOT
run: |
git clone https://github.com/OpenHD/OpenHD-ChrootCompiler /opt/OpenHD-ChrootCompiler
mkdir -p /opt/OpenHD-ChrootCompiler/additionalFiles
git clone https://github.com/OpenHD/rtl88x2eu -b ${{ github.ref_name }} /opt/ChrootCompilationTest/additionalFiles/ --recursive
chmod +x /opt/ChrootCompilationTest/additionalFiles/build_chroot.sh
echo $CLOUDSMITH_API_KEY > /opt/OpenHD-ChrootCompiler/additionalFiles/cloudsmith_api_key.txt
echo "AMD64" > /opt/OpenHD-ChrootCompiler/additionalFiles/arch.txt
echo "ubuntu" > /opt/OpenHD-ChrootCompiler/additionalFiles/distro.txt
echo "noble" > /opt/OpenHD-ChrootCompiler/additionalFiles/flavor.txt
echo "${{ github.ref_name }}" > /opt/OpenHD-ChrootCompiler/additionalFiles/repo.txt
cd /opt/OpenHD-ChrootCompiler/
sudo apt update
sudo bash install_dep.sh
sudo bash ./build.sh x86-minimal $API_KEY ubuntu noble
- name: debug
run: |
ls -a
cp -r /opt/OpenHD-ChrootCompiler/out/*.deb .
- name: Upload to Github
uses: 'actions/upload-artifact@v2'
with:
name: "rtl8812au"
path: |
*.deb
*.log
if-no-files-found: error

- name: Push
id: push
uses: cloudsmith-io/action@master
with:
api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
command: "push"
format: "deb"
owner: "openhd"
repo: release
distro: "ubuntu"
release: "noble"
republish: "true" # needed ONLY if version is not changing
file: "*.deb"
60 changes: 60 additions & 0 deletions .github/workflows/build_for_x86.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: build on x86 lunar

on: [push]


jobs:
build:
#runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 512
swap-size-mb: 1024
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
overprovision-lvm: 'true'
- name: remove even more
run: |
sudo apt-get purge -y \
'^llvm-.*' \
'php.*' \
'^mongodb-.*' \
'^mysql-.*' \
azure-cli \
google-chrome-stable \
firefox \
powershell \
microsoft-edge-stable \
mono-devel
sudo apt-get autoremove -y
sudo apt-get clean
- name: test
run: |
echo "DT=$(date +'%Y-%m-%d_%H%M')" >> $GITHUB_ENV
echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Checkout repository and submodules
uses: actions/checkout@v3
with:
submodules: recursive
- name: Building OpenHD in CHROOT
run: |
git clone https://github.com/OpenHD/OpenHD-ChrootCompiler /opt/OpenHD-ChrootCompiler
mkdir -p /opt/OpenHD-ChrootCompiler/additionalFiles
git clone https://github.com/OpenHD/rtl88x2eu -b ${{ github.ref_name }} /opt/OpenHD-ChrootCompiler/additionalFiles/ --recursive
echo $CLOUDSMITH_API_KEY > /opt/OpenHD-ChrootCompiler/additionalFiles/cloudsmith_api_key.txt
echo "AMD64" > /opt/OpenHD-ChrootCompiler/additionalFiles/arch.txt
echo "ubuntu" > /opt/OpenHD-ChrootCompiler/additionalFiles/distro.txt
echo "lunar" > /opt/OpenHD-ChrootCompiler/additionalFiles/flavor.txt
echo "${{ github.ref_name }}" > /opt/OpenHD-ChrootCompiler/additionalFiles/repo.txt
cd /opt/OpenHD-ChrootCompiler/
sudo apt update
sudo bash install_dep.sh
sudo bash ./build.sh x86-lunar $API_KEY ubuntu lunar
24 changes: 24 additions & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build test

on: [push]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
runs-on: ubuntu-24.04
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: build on x86
run: |
sudo apt update
sudo apt install -y build-essential
make
ls
20 changes: 16 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ CONFIG_PCI_HCI = n
CONFIG_SDIO_HCI = n
CONFIG_GSPI_HCI = n
########################## Features ###########################
CONFIG_AP_MODE = y
CONFIG_P2P = y
CONFIG_AP_MODE = n
CONFIG_P2P = n
CONFIG_MP_INCLUDED = y
CONFIG_POWER_SAVING = n
CONFIG_IPS_MODE = 0
Expand Down Expand Up @@ -168,6 +168,7 @@ CONFIG_SECURE_DMA_MEM_SIZE = 3686400
###################### Platform Related #######################
CONFIG_PLATFORM_I386_PC = y
CONFIG_PLATFORM_ARM_GENERIC = n
CONFIG_PLATFORM_ARM_RPI = n
CONFIG_PLATFORM_ARM64 = n
CONFIG_PLATFORM_ARM64_RPI = n
CONFIG_PLATFORM_ANDROID_X86 = n
Expand Down Expand Up @@ -1058,9 +1059,9 @@ ifeq ($(CONFIG_RTL8822E), y)
RTL871X := rtl8822e
ifeq ($(CONFIG_USB_HCI), y)
ifeq ($(CONFIG_BT_COEXIST), n)
MODULE_NAME = 8812eu
MODULE_NAME = 88x2eu_ohd
else
MODULE_NAME = 88x2eu
MODULE_NAME = 88x2eu_ohd
endif
endif
ifeq ($(CONFIG_PCI_HCI), y)
Expand Down Expand Up @@ -1419,6 +1420,17 @@ INSTALL_PREFIX :=
STAGINGMODDIR := /lib/modules/$(KVER)/kernel/drivers/staging
endif

ifeq ($(CONFIG_PLATFORM_ARM_RPI), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
ARCH ?= arm
CROSS_COMPILE ?=
KVER ?= $(shell uname -r)
KSRC := /lib/modules/$(KVER)/build
MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/
INSTALL_PREFIX :=
endif

ifeq ($(CONFIG_PLATFORM_ARM_GENERIC), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
ARCH ?= arm
Expand Down
39 changes: 25 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,22 @@ That's because:
3. If the monitor mode is set by ```iwconfig```, the process is done by calling the old WEXT APIs, so the cfg80211-based ```iw``` may not get the latest status and think the interface is still in managed mode

### AP/STA
Note that it has NOT BEEN TESTED.
It's currently under testing by a Chinese enthusiast, will update here if he has any progress.
According to the module vendor's ambiguous document and the crab's mysterious driver tar with a "_10MHz" suffix:
1. Enable ```CONFIG_NARROWBAND_SUPPORTING``` in ```include/hal_ic_cfg.h``` (in ```#ifdef CONFIG_RTL8822E``` section if using RTL8812EU), then ```#define CONFIG_NB_VALUE RTW_NB_CONFIG_WIDTH_10``` below
2. Rename ```hal/rtl8822e/hal8822e_fw_10M.*``` into ```hal/rtl8822e/hal8822e_fw.*``` to replace the original firmware
3. Now you get the "<tar_name>_10MHz" driver. Rebuild the driver
4. (Should we set it to 10MHz bandwidth, Mr. Crab?)
4. ```iw``` Set the channel to 10MHz bandwidth
5. If there are any tools complain about the Wi-Fi regularities when setting up a 10MHz AP, try setting the channel plan manually by ```echo 0x3E > /proc/net/rtl88x2eu/<wlan>/chan_plan```.
6. Check the ACK timeout setting below if the range is >\~3km
7. Check ```/proc/net/rtl88x2eu/<wlan>/rate_ctl``` for manually control of the rate

### Is Injecting in Other Bandwidth Available?
#### 5MHz
No. It performs like a fractional RF synthesizer with only a single tone appearing on my SDR receiver.
#### 40MHz
#### 40MHz/80MHz
It works.
Use ```iw``` to set channel & HT40 bandwidth, then set 40MHz in radiotap header (can be done by using ```-B 40``` in wfb-ng, or editing ```/etc/wfb.conf``` in OpenIPC FPV)
#### 80MHz
~~Wake me up when ```wfb-ng``` supports VHT rates.~~
OK I did that. See [here](https://github.com/libc0607/wfb-ng/commit/f7c8ea78dd8c8495bb22f184fcfd77152b25798a).
Use ```iw``` to set channel & HT40/80MHz bandwidth, then set 40MHz or 80MHz(VHT) in radiotap header (can be done by using ```-B``` in wfb-ng)

## Set (Unlocked) Channel in procfs
The chip's RF synthesizer can work in a bit wider range than regular 5GHz Wi-Fi.
Expand Down Expand Up @@ -115,15 +114,15 @@ The value you're setting is L2H. The H2L is automatically set 8dB lower.

DISCLAIMER: There's no guarantee of its performance. This may damage your hardware and I'm not gonna pay for it. Use it at your own risk. Please comply with any wireless regulations in your area.

## 802.11 DCF hacking
Note: I don't know if these things are actually working since no one can get the crab's datasheets.
Just did some global searching and replaced every place I've found.

### ACK Timeout
## ACK Timeout
Provided by Realtek.
e.g. Set ACK timeout to 100us:
```echo 100 > /proc/net/rtl88x2eu/<wlanX>/ack_timeout```

## 802.11 DCF hacking
Note: I don't know if these things are actually working since no one can get the crab's datasheets.
Just did some global searching and replaced every place I've found.

### SIFS
EXPERIMENTAL, may not work.
```/proc/net/rtl88x2eu/<wlanX>/sifs_override```
Expand All @@ -136,8 +135,20 @@ DISCLAIMER: There's no guarantee of its performance.

## Noise Monitor
Not working. Enabled every macro (like ```CONFIG_BACKGROUND_NOISE_MONITOR```) I could find and the readouts kept zero.
If you know something about it, please tell us in issue.
If you know something about it, please tell us in issue.

## Thermometer
The chip contains a thermometer for calibrating the RF part dynamically. It can be used to estimate the chip temperature.
e.g. To read the temperature:
```
cat /proc/net/rtl88x2eu/<wlan0>/thermal_state
```
Note: This value is not accurate enough. The LSB of its ADC only represents 2.5K and contains a measured value as the offset.
However, it can be used to estimate the status of the chip, "cool/warm/hot/smoked/crispy".
See [PR #4](https://github.com/libc0607/rtl88x2eu-20230815/pull/4) and [commit/5b7a66d](https://github.com/libc0607/rtl88x2eu-20230815/commit/5b7a66d3b1c7097a02247f91253993a7027e40a6#comments) for more details.
The offset can be tuned by ```echo "<offset>" > /proc/net/rtl88x2eu/<wlan0>/thermal_state```. By default, it's ```32```, based on my measurement.

## Use with OpenIPC
See the tutorial [here in OpenIPC Wiki](https://github.com/OpenIPC/wiki/blob/master/en/fpv-bl-m8812eu2-wifi-adaptors.md).
See the tutorial [here in OpenIPC Wiki](https://github.com/OpenIPC/wiki/blob/master/en/fpv-bl-m8812eu2-wifi-adaptors.md).
Or, download pre-built firmware with this driver from [here](https://github.com/libc0607/openipc-firmware).

Loading

0 comments on commit efe1416

Please sign in to comment.