svpcom / wfb-ng

WFB-NG - the next generation of long-range packet radio link based on raw WiFi radio
https://docs.px4.io/main/en/tutorials/video_streaming_wifi_broadcast.html
GNU General Public License v3.0
1.02k stars 241 forks source link

[BUG] 8812eu not changing wifi channels #378

Open aepkolol opened 1 month ago

aepkolol commented 1 month ago

Describe the bug I have a 8812au on the gs side which works perfectly, however the 8812eu on the drone refuses to change wifi channels. I can confirm the wifibroadcast@drone service is running and sent the iw command to change to channel 161. However it is stuck locked to channel 1. However it does change to monitor mode. Trying to manually change the channel to 161 gives me this error:

iw dev wlan0 set channel 161 HT20command failed: Operation not permitted (-1)

In the wiki it notes

Check with ethtool -i wlanXX that drivers version is empty (it will equal to kernel version for stock driver and empty for patched driver). NVIDIA Jetson has stock rtl8812au installed. You need to remove it!

however the driver version is not empty, like it is on the gs side with the 8812au. It's reporting the driver as

88x2eu

where the main readme says it should be "8812eu" I followed the instructions of this repo exactly, except for this part from the drivers git repo to get it to compile

Or, for arm64, run:

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

I forget the iw command I used, but it listed all the available wifi channels and most outside of a small handful in the 2.4ghz range were listed as "disabled" however it correctly lists my region as BO, and its set as such in the .cfg.

Now, the weird thing is.. I had this working a few days before. I just reflashed the jetson and followed the wiki to the letter. I'm not sure what has changed since, and I can't get it working to where it was before. So I am hoping someone can shed some light on where to go from here, otherwise I'd assume it was a driver/kernel issue.

To Reproduce Install as per the readme.md and wiki

Expected behavior Connection to gs

Screenshots If applicable, add screenshots to help explain your problem.

Your setup (please complete the following information):

Confirm you read

svpcom commented 1 month ago

It seems this channel is blocked by your CRDA rules. Run:

  1. iw reg get
  2. iw phy
aepkolol commented 1 month ago
spiri@mu2:~$ iw reg get
global
country CA: DFS-FCC
        (2402 - 2472 @ 40), (N/A, 30), (N/A)
        (5150 - 5250 @ 80), (N/A, 23), (N/A), NO-OUTDOOR, AUTO-BW
        (5250 - 5350 @ 80), (N/A, 24), (0 ms), DFS, AUTO-BW
        (5470 - 5600 @ 80), (N/A, 24), (0 ms), DFS
        (5650 - 5730 @ 80), (N/A, 24), (0 ms), DFS
        (5735 - 5835 @ 80), (N/A, 30), (N/A)
        (5925 - 7125 @ 320), (N/A, 12), (N/A), NO-OUTDOOR

spiri@mu2:~$ iw phy
Wiphy phy0
        max # scan SSIDs: 9
        max scan IEs length: 2304 bytes
        max # sched scan SSIDs: 0
        max # match sets: 0
        Retry short limit: 7
        Retry long limit: 4
        Coverage class: 0 (up to 0m)
        Device supports AP-side u-APSD.
        Supported Ciphers:
                * WEP40 (00-0f-ac:1)
                * WEP104 (00-0f-ac:5)
                * TKIP (00-0f-ac:2)
                * CCMP-128 (00-0f-ac:4)
                * CMAC (00-0f-ac:6)
                * GCMP-128 (00-0f-ac:8)
                * GCMP-256 (00-0f-ac:9)
                * CCMP-256 (00-0f-ac:10)
                * GMAC-128 (00-0f-ac:11)
                * GMAC-256 (00-0f-ac:12)
                * CMAC-256 (00-0f-ac:13)
        Available Antennas: TX 0 RX 0
        Supported interface modes:
                 * managed
                 * monitor
        Band 1:
                Capabilities: 0x19e3
                        RX LDPC
                        HT20/HT40
                        Static SM Power Save
                        RX HT20 SGI
                        RX HT40 SGI
                        TX STBC
                        RX STBC 1-stream
                        Max AMSDU length: 7935 bytes
                        DSSS/CCK HT40
                Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
                Minimum RX AMPDU time spacing: 16 usec (0x07)
                HT Max RX data rate: 300 Mbps
                HT TX/RX MCS rate indexes supported: 0-15
                Bitrates (non-HT):
                        * 1.0 Mbps
                        * 2.0 Mbps
                        * 5.5 Mbps
                        * 11.0 Mbps
                        * 6.0 Mbps
                        * 9.0 Mbps
                        * 12.0 Mbps
                        * 18.0 Mbps
                        * 24.0 Mbps
                        * 36.0 Mbps
                        * 48.0 Mbps
                        * 54.0 Mbps
                Frequencies:
                        * 2412 MHz [1] (21.0 dBm)
                        * 2417 MHz [2] (21.0 dBm)
                        * 2422 MHz [3] (21.0 dBm)
                        * 2427 MHz [4] (21.0 dBm)
                        * 2432 MHz [5] (21.0 dBm)
                        * 2437 MHz [6] (21.0 dBm)
                        * 2442 MHz [7] (21.0 dBm)
                        * 2447 MHz [8] (21.0 dBm)
                        * 2452 MHz [9] (21.0 dBm)
                        * 2457 MHz [10] (21.0 dBm)
                        * 2462 MHz [11] (21.0 dBm)
                        * 2467 MHz [12] (disabled)
                        * 2472 MHz [13] (disabled)
                        * 2484 MHz [14] (disabled)
        Band 2:
                Capabilities: 0x9e3
                        RX LDPC
                        HT20/HT40
                        Static SM Power Save
                        RX HT20 SGI
                        RX HT40 SGI
                        TX STBC
                        RX STBC 1-stream
                        Max AMSDU length: 7935 bytes
                        No DSSS/CCK HT40
                Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
                Minimum RX AMPDU time spacing: 16 usec (0x07)
                HT Max RX data rate: 300 Mbps
                HT TX/RX MCS rate indexes supported: 0-15
                VHT Capabilities (0x03d071b2):
                        Max MPDU length: 11454
                        Supported Channel Width: neither 160 nor 80+80
                        RX LDPC
                        short GI (80 MHz)
                        TX STBC
                        SU Beamformee
                        MU Beamformee
                        +HTC-VHT
                VHT RX MCS set:
                        1 streams: MCS 0-9
                        2 streams: MCS 0-9
                        3 streams: not supported
                        4 streams: not supported
                        5 streams: not supported
                        6 streams: not supported
                        7 streams: not supported
                        8 streams: not supported
                VHT RX highest supported: 780 Mbps
                VHT TX MCS set:
                        1 streams: MCS 0-9
                        2 streams: MCS 0-9
                        3 streams: not supported
                        4 streams: not supported
                        5 streams: not supported
                        6 streams: not supported
                        7 streams: not supported
                        8 streams: not supported
                VHT TX highest supported: 780 Mbps
                Bitrates (non-HT):
                        * 6.0 Mbps
                        * 9.0 Mbps
                        * 12.0 Mbps
                        * 18.0 Mbps
                        * 24.0 Mbps
                        * 36.0 Mbps
                        * 48.0 Mbps
                        * 54.0 Mbps
                Frequencies:
                        * 5080 MHz [16] (disabled)
                        * 5100 MHz [20] (disabled)
                        * 5120 MHz [24] (disabled)
                        * 5140 MHz [28] (disabled)
                        * 5160 MHz [32] (20.0 dBm)
                        * 5180 MHz [36] (20.0 dBm)
                        * 5200 MHz [40] (20.0 dBm)
                        * 5220 MHz [44] (20.0 dBm)
                        * 5240 MHz [48] (20.0 dBm)
                        * 5260 MHz [52] (20.0 dBm) (radar detection)
                        * 5280 MHz [56] (20.0 dBm) (radar detection)
                        * 5300 MHz [60] (20.0 dBm) (radar detection)
                        * 5320 MHz [64] (20.0 dBm) (radar detection)
                        * 5340 MHz [68] (20.0 dBm) (radar detection)
                        * 5360 MHz [72] (disabled)
                        * 5380 MHz [76] (disabled)
                        * 5400 MHz [80] (disabled)
                        * 5420 MHz [84] (disabled)
                        * 5440 MHz [88] (disabled)
                        * 5460 MHz [92] (disabled)
                        * 5480 MHz [96] (20.0 dBm) (radar detection)
                        * 5500 MHz [100] (20.0 dBm) (radar detection)
                        * 5520 MHz [104] (20.0 dBm) (radar detection)
                        * 5540 MHz [108] (20.0 dBm) (radar detection)
                        * 5560 MHz [112] (20.0 dBm) (radar detection)
                        * 5580 MHz [116] (20.0 dBm) (radar detection)
                        * 5600 MHz [120] (disabled)
                        * 5620 MHz [124] (disabled)
                        * 5640 MHz [128] (disabled)
                        * 5660 MHz [132] (20.0 dBm) (radar detection)
                        * 5680 MHz [136] (20.0 dBm) (radar detection)
                        * 5700 MHz [140] (20.0 dBm) (radar detection)
                        * 5720 MHz [144] (20.0 dBm) (radar detection)
                        * 5745 MHz [149] (20.0 dBm)
                        * 5765 MHz [153] (20.0 dBm)
                        * 5785 MHz [157] (20.0 dBm)
                        * 5805 MHz [161] (20.0 dBm)
                        * 5825 MHz [165] (20.0 dBm)
                        * 5845 MHz [169] (disabled)
                        * 5865 MHz [173] (disabled)
                        * 5885 MHz [177] (disabled)
                        * 5905 MHz [181] (disabled)
                        * 5925 MHz [185] (disabled)
                        * 5945 MHz [189] (12.0 dBm)
                        * 5965 MHz [193] (12.0 dBm)
                        * 5985 MHz [197] (12.0 dBm)
                        * 6005 MHz [201] (12.0 dBm)
                        * 6025 MHz [205] (12.0 dBm)
                        * 6045 MHz [209] (12.0 dBm)
                        * 6065 MHz [213] (12.0 dBm)
                        * 6085 MHz [217] (12.0 dBm)
                        * 6105 MHz [221] (12.0 dBm)
                        * 6125 MHz [225] (12.0 dBm)
                        * 6145 MHz [229] (12.0 dBm)
                        * 6165 MHz [233] (12.0 dBm)
                        * 6185 MHz [237] (12.0 dBm)
                        * 6205 MHz [241] (12.0 dBm)
                        * 6225 MHz [245] (12.0 dBm)
                        * 6245 MHz [249] (12.0 dBm)
                        * 6265 MHz [253] (12.0 dBm)
        Supported commands:
                 * new_interface
                 * set_interface
                 * new_key
                 * join_ibss
                 * set_pmksa
                 * del_pmksa
                 * flush_pmksa
                 * remain_on_channel
                 * frame
                 * set_channel
                 * connect
                 * disconnect
                 * update_ft_ies
        WoWLAN support:
                 * wake up on anything (device continues operating normally)
        software interface modes (can always be added):
                 * monitor
        interface combinations are not supported
        Device supports SAE with AUTHENTICATE command
        Device supports scan flush.
        Device supports randomizing MAC-addr in scans.
        max # scan plans: 1
        max scan plan interval: -1
        max scan plan iterations: 0
        Supported TX frame types:
                 * IBSS: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * managed: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * AP: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * AP/VLAN: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * P2P-client: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
                 * P2P-GO: 0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xa0 0xb0 0xc0 0xd0 0xe0 0xf0
        Supported RX frame types:
                 * IBSS: 0xd0
                 * managed: 0x40 0xb0 0xd0
                 * AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
                 * AP/VLAN: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
                 * P2P-client: 0x40 0xd0
                 * P2P-GO: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0
        Supported extended features:
                * [ RRM ]: RRM
spiri@mu2:~$ sudo iw reg set BO
spiri@mu2:~$ iw reg get
global
country 98: DFS-UNSET
        (2402 - 2472 @ 40), (N/A, 20), (N/A)
        (5250 - 5330 @ 80), (N/A, 24), (0 ms), DFS
        (5735 - 5835 @ 80), (N/A, 30), (N/A)
svpcom commented 1 month ago

This is very strange - it should works, but please run the following commands:

  1. sudo ethtool -i wlan0
  2. sudo iw dev
  3. sudo iw dev wlan1 set channel 161 HT20
svpcom commented 1 month ago

if command (3) will not report an error but iw dev afterwards don't show 161 then it is normal - 8812eu driver doesn't report current channel right

aepkolol commented 1 month ago
spiri@mu2:~$ iw reg get
global
country CA: DFS-FCC
        (2402 - 2472 @ 40), (N/A, 30), (N/A)
        (5150 - 5250 @ 80), (N/A, 23), (N/A), NO-OUTDOOR, AUTO-BW
        (5250 - 5350 @ 80), (N/A, 24), (0 ms), DFS, AUTO-BW
        (5470 - 5600 @ 80), (N/A, 24), (0 ms), DFS
        (5650 - 5730 @ 80), (N/A, 24), (0 ms), DFS
        (5735 - 5835 @ 80), (N/A, 30), (N/A)
        (5925 - 7125 @ 320), (N/A, 12), (N/A), NO-OUTDOOR

spiri@mu2:~$ sudo ethtool -i wlan0
[sudo] password for spiri:
driver: rtl88x2eu
version: v5.15.0.1-197-ge90764eb9.202311
firmware-version: 1.15
expansion-rom-version:
bus-info: 1-3.3:1.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no
spiri@mu2:~$ sudo iw dev
phy#1
        Interface wlan1
                ifindex 8
                wdev 0x100000001
                addr d8:44:89:5c:09:8a
                ssid BELL676
                type managed
                txpower 12.00 dBm
phy#0
        Interface wlan0
                ifindex 7
                wdev 0x1
                addr 78:22:88:19:2a:63
                type managed
                txpower 42949572.96 dBm
spiri@mu2:~$ sudo iw dev wlan1 set channel 161 HT20
command failed: Device or resource busy (-16)

wlan1 is an 8812bu I have attached to ssh into the drone over wifi

svpcom commented 1 month ago

@aepkolol

phy#0
        Interface wlan0
                ifindex 7
                wdev 0x1
                addr 78:22:88:19:2a:63
                type managed

it should be in monitor mode

aepkolol commented 1 month ago

@aepkolol

phy#0
        Interface wlan0
                ifindex 7
                wdev 0x1
                addr 78:22:88:19:2a:63
                type managed

it should be in monitor mode

This was after a reboot without wfb running.

With mode set to monitor

spiri@mu2:~$ sudo iw dev
phy#1
        Interface wlan1
                ifindex 8
                wdev 0x100000001
                addr d8:44:89:5c:09:8a
                ssid BELL676
                type managed
                txpower 12.00 dBm
phy#0
        Interface wlan0
                ifindex 7
                wdev 0x1
                addr 78:22:88:19:2a:63
                type monitor
                channel 1 (2412 MHz), width: 20 MHz (no HT), center1: 2412 MHz
                txpower 18.00 dBm
spiri@mu2:~$ sudo iw dev wlan1 set channel 161 HT20
command failed: Device or resource busy (-16)
svpcom commented 1 month ago

Device or resource busy (-16) check that no other processes (wpa_supplicant, dhclient, etc) use this card.

aepkolol commented 1 month ago

Sorry, I realize I did

sudo iw dev wlan1 set channel 161 HT20

but that was targeting wlan1, which I use for normal wifi. Doing it for wlan0 outputs nothing to the terminal, but the channel stays the same.

spiri@mu2:~$ sudo iw dev wlan0 set channel 161 HT20
spiri@mu2:~$ iw wlan0 info
Interface wlan0
        ifindex 7
        wdev 0x1
        addr 78:22:88:19:2a:63
        type monitor
        wiphy 0
        channel 1 (2412 MHz), width: 20 MHz (no HT), center1: 2412 MHz
        txpower 18.00 dBm
svpcom commented 1 month ago

this is normal. It switch channel, but driver doesn't report it (driver bug, you can fill ticket to driver author)

aepkolol commented 4 weeks ago

If I connect to a normal network, I can see with iw dev that it changes channels properly. It just seems like setting the channel manually with sudo iwconfig wlan0 channel 161 refuses to work. Even if the driver isn't reporting the channel change, I'm unable to see a connection on either side of wfb. No log message mentioning bad encryption keys, etc. It's just as if it isn't pushing a signal out.

I can see in wfb-cli drone and gs that packets are being injected on the tx side however. Just neither are receiving.