OpenIPC / firmware

Alternative IP Camera firmware from an open community
https://openipc.org
MIT License
1.21k stars 233 forks source link

WIP: Add support for RTL8812EU-based Wi-Fi adapters for FPV firmware #1344

Closed libc0607 closed 5 months ago

libc0607 commented 6 months ago

Hi.

The Chinese Wi-Fi module vendor LB-LINK had recently released a high-power Wi-Fi module BL-M8812EU2 based on RTL8812EU chipset costs only ~$10 (68 CNY). Here's the product page and the purchase link. The FEM chip inside is KCT8528HE, with an impressive +29dBm (802.11g, 6Mbps, -9dB EVM) PA output and a +15.5dB (NF=1.7dB) LNA.

I bought two a few weeks ago, and the tech support from LB-LINK send me a driver tar from Realtek. It seems that the chip is gonna be the replacement of RTL8812AU which has been marked as EOL. The original driver does not support packet injection with correct rate or MCS index, so I tried to merge the "injection patch" from svpcom/rtl8812au to this driver, which can be found at here.

The progress now is that the driver build good on kernel 6.5, 802.11g/n packets can be sent at the correct rate/MCS using my own packet injecting tool, and video transmission using wfb_tx and wfb_rx in my two virtual machines (see here in youtube). The OpenIPC package makefile is avaliable at here.

The vendor also claimed that RTL8812EU supports 10MHz bandwidth, but there's no document and I don't know how to use it. The driver contains a firmware which seems to be the "10MHz firmware", but I don't have a ~6GHz spectrum analyzer either so I can't tell if it's really working -- It would be great if anyone could help.

I'm choosing to post it here now because this driver definitely needs more integration testing. If someone is also interested in this module, he can just start from here and does not need to patch the driver or write Makefile again.

Of course I'll open a pull request when it becomes somehow usable and stable.

ETE-Design commented 5 months ago

@libc0607 Seems like nobody cares about Windows when it comes to WifiBroadcasting... Will it somehow be possible to make a Windows Driver also? Would love to try it out and recieve WifiBroadcasting to OBS Studio

libc0607 commented 5 months ago

@libc0607 Seems like nobody cares about Windows when it comes to WifiBroadcasting... Will it somehow be possible to make a Windows Driver also? Would love to try it out and recieve WifiBroadcasting to OBS Studio

Theoretically it's possible but I don't think anybody gonna do it. It requires a lot of work and also support from Realtek which is obviously impossible.

You can try using an NVR (e.g. see Hi3536DV100 configs in this repo; or anything similar) as a video stream forwarder. It will act as an "abstraction layer" in the system that converts different Wi-Fi adaptors to standard ethernet UDP packets and then send them to ur Windows PC via a RJ45 connector.

widgetii commented 5 months ago

@libc0607 Seems like nobody cares about Windows when it comes to WifiBroadcasting... Will it somehow be possible to make a Windows Driver also? Would love to try it out and recieve WifiBroadcasting to OBS Studio

There is such driver https://github.com/buldo/WiFiDriver, but you're right that nobody cares about Windows for a long time

svpcom commented 5 months ago

@libc0607 Is it possible to buy it on aliexpress? Are any other cards with this chipset exists on the market?

ETE-Design commented 5 months ago

@libc0607 Seems like nobody cares about Windows when it comes to WifiBroadcasting... Will it somehow be possible to make a Windows Driver also? Would love to try it out and recieve WifiBroadcasting to OBS Studio

There is such driver https://github.com/buldo/WiFiDriver, but you're right that nobody cares about Windows for a long time

Thanks... Do you know how to get it work with OpenIPC, and how to access the Streaming on a Windows PC?

widgetii commented 5 months ago

None of OpenIPC's devs are using Windows now

libc0607 commented 5 months ago

@libc0607 Is it possible to buy it on aliexpress?

I thought there would be, but I couldn't find any after I registered. Maybe you can ask some of the BL-R8812AF1 sellers since the modules are from same vendor. And I'm gonna ask their product manager tomorrow if he knows there's any reseller outside mainland China.

Are any other cards with this chipset exists on the market?

I'm afraid not. No search results in zh-cn internet either.

ETE-Design commented 5 months ago

None of OpenIPC's devs are using Windows now

So my best shoot will be to ask @buldo, or what do you think?

svpcom commented 5 months ago

My point is that I want to invest my time only to products that are available on mass market. It is possible to add injection to most of SoftMAC drivers, but hardware should be easy to buy and it should not be EOL at least for 5 years. Also it will be very good if vendor provides docs for internal card registers (like atheros done for ath9k). Without these specs it is very hard to add features needed for injection (for example: disabling acks, use rts/cts packet, disabling csma/ca, extended channel monitoring for noise and others)

@libc0607 Is it possible to buy it on aliexpress?

I thought there would be, but I couldn't find any after I registered. Maybe you can ask some of the BL-R8812AF1 sellers since the modules are from same vendor. And I'm gonna ask their product manager tomorrow if he knows there's any reseller outside mainland China.

Are any other cards with this chipset exists on the market?

I'm afraid not. No search results in zh-cn internet either.

buldo commented 5 months ago

@libc0607 if you want to receive on windows there are much better ways than my driver:

  1. Use dedicated sbc for RX. Connect this sbc to windows via ethernet. Even $5 milk-v is enough.
  2. Use WSL with custom kernel and usb-ip pass-through. It enough to receive video stream.
ETE-Design commented 5 months ago

@libc0607 Seems like nobody cares about Windows when it comes to WifiBroadcasting... Will it somehow be possible to make a Windows Driver also? Would love to try it out and recieve WifiBroadcasting to OBS Studio

Theoretically it's possible but I don't think anybody gonna do it. It requires a lot of work and also support from Realtek which is obviously impossible.

You can try using an NVR (e.g. see Hi3536DV100 configs in this repo; or anything similar) as a video stream forwarder. It will act as an "abstraction layer" in the system that converts different Wi-Fi adaptors to standard ethernet UDP packets and then send them to ur Windows PC via a RJ45 connector.

If using the NVR will I then need one NVR for each stream I like to recieve, or is it possible to recieve multiple streams on one NVR?

svpcom commented 5 months ago

@libc0607 Could you upload datasheet for RTL8812EU here?

libc0607 commented 5 months ago

@libc0607 Could you upload datasheet for RTL8812EU here?

BL-M8812EU2 (the module) datasheet: BL-M8812EU2_datasheet_V1.0.1.0_231027(70003939).pdf

There's no RTL8812EU-CG chip datasheet (at least for now).
It's fairly new and the module has been selling in China for only 2 months ... leakers need some time XD

libc0607 commented 5 months ago

If using the NVR will I then need one NVR for each stream I like to recieve, or is it possible to recieve multiple streams on one NVR?

Maybe you can try multiple Wi-Fi adaptors on one NVR?

ETE-Design commented 5 months ago

@libc0607 if you want to receive on windows there are much better ways than my driver:

  1. Use dedicated sbc for RX. Connect this sbc to windows via ethernet. Even $5 milk-v is enough.
  2. Use WSL with custom kernel and usb-ip pass-through. It enough to receive video stream.

But with your driver you will get lowest latency cause you cut out one lead, or am I wrong? Would prefer to use as clean setup as possible. Also do you know if it is possible to recieve multiple broadcasting with only one receiver, or do I need one receiver for each sender?

If using WSL is it then possible to push the signal to a Windows OBS Studio?

libc0607 commented 5 months ago

Driver update:

The TX power setting of RTL8812EU is working. The total power consumption of the adaptor came to ~10W (5V/2.0A).
Just quickly went through the code and I found that the setting is a bit different compared with RTL8812AU.

Simply add rtw_tx_pwr_by_rate=0 rtw_tx_pwr_lmt_enable=0 when insmod,
then the TX power can be directly set by iw dev wlan0 set txpower fixed <mBm>.
The range of is 0~3150, which equals 50 times driver_txpower_override.

Another update is about regulation. Add rtw_regd_src=1 when insmod and the phy won't claim it's "self-managed", then you can use the channel you want.