sebanc / brunch

Boot ChromeOS on x86_64 PC - Supports Intel CPU/GPU from 8th gen or AMD Ryzen
GNU General Public License v3.0
3.56k stars 388 forks source link

Alternate (more stable) driver for the RTL8723BS #1497

Open ouija opened 2 years ago

ouija commented 2 years ago

Hi there,

I've tested brunch on this Toshiba Encore 2 WT8-B device of mine, and found that the RTL8723BS driver is suffering from random disconnects and issues caused by the driver, and wanted to mention that when building a custom Android-x86 installation, I discovered that this alternate driver is more stable and resolves the issues with disconnects and network timeouts.

Figured I'd mention this, if there were a possibility you could include it maybe as the default driver OR as an optional one to be selected.

Thanks!

clee604 commented 2 years ago

Hi @ouija , thanks for tagging my issue and discovering this alternate driver. I've only recently been learning Linux commands, are you able to provide some rough instructions on how to install this driver so I can test it as well? Thanks!

ouija commented 2 years ago

It's a bit of a complex process, in that you need to compile the module (driver) when building the kernel (for chromeos/brunch) OR build one for a similar kernel version and architecture.

When I have time I'll attempt to do this and post back my results (and instructions on how to use this driver) provided I can get it working!

ouija commented 2 years ago

I've managed to rebuild the alternate rtl8723bs module for Brunch/ChromeOS for all available kernel versions (click here to download)

This certainly seems to provide a more stable connection in brunch/chromeos for my device than the staging driver that is included.

To install, you'll need to download the zip file, and use the 8723bs.ko that corresponds to the kernel you are booting with.

PROCEED WITH CAUTION! I take zero responsibility if you mess anything up or if these instructions are unclear.

Download the file and open the .zip with File Explorer in ChromeOS so that it is mounted.

Press CTRL-ALT-T to open a crosh window, and then type shell followed by sudo su - to enter the shell as the root user.

To remove/uninstall the current kernel module for the rtl8723bs, type rmmod r8723bs

Verify this module has been unloaded by running a lsmod | grep 8723 command and see if there is anything listed.

Please ensure that you use the same module compiled for kernel version as what you are currently running (if you don't know what kernel version you are running, you can type uname -a in the terminal shell and should see the version in the output)

Now you can test the downloaded module to ensure it will load in your current enviroment, by typing: insmod /media/archive/rtl8723bs-alt.zip/rtl8723bs/<your_kernel_version/8723bs.ko If it loaded successfully, you shouldn't see any output, and if you do another lsmod | grep 8723 you should see it listed, and if so, it will work successfully as a replacement module.

Unload the module before continuing, by running rmmod 8723bs

Now you copy the compiled kernel module from the mounted zip file to the kernel module directory and replace the existing one: cp /media/archive/rtl8723bs-alt.zip/rtl8723bs/<your_kernel_version/8723bs.ko /lib/modules/<your_kernel_version>-brunch-sebanc/kernel/drivers/staging/rtl8723bs/r8723bs.so

And ensure that the file permissions are set to 644 by typing chmod 644 /lib/modules/<your_kernel_version>-brunch-sebanc/kernel/drivers/staging/rtl8723bs/r8723bs.so

And you can reboot, and hopefully if all went well, the module will be loaded on next boot and working better than previously.

Hopefully this is clear and makes sense (and works for whoever tries this); I'm writing this off the top of my head, so again, I take no responsibility if this breaks your brunch/chromeos install!

clee604 commented 2 years ago

Thanks!

The good news is it didn't break my install. The bad news is I still have an error when connecting, though now the error is "not associated" compared to unknown

dmesg shows some deauth error: [ 154.478029] RTL8723BS: rtw_set_802_11_connect(wlan0) fw_state = 0x00000008 [ 154.574260] RTL8723BS: start auth [ 154.578711] RTL8723BS: auth success, start assoc [ 154.585930] RTL8723BS: rtw_cfg80211_indicate_connect(wlan0) BSS not found !! [ 154.585955] RTL8723BS: assoc success [ 154.598600] RTL8723BS: send eapol packet [ 154.621333] RTL8723BS: send eapol packet [ 154.622789] RTL8723BS: set pairwise key camid:4, addr:80:2a:a8:17:5f:ce, kid:0, type:AES [ 154.627537] RTL8723BS: sta recv deauth reason code(6) sta:80:2a:a8:17:5f:ce, ignore = 0 [ 154.629498] RTL8723BS: set group key camid:5, addr:80:2a:a8:17:5f:ce, kid:2, type:AES [ 177.425389] init: ml-service (mojo_service) post-start process (6205) terminated with status 2 [ 188.142688] RTL8723BS: rtw_set_802_11_connect(wlan0) fw_state = 0x00000008 [ 195.910950] RTL8723BS: rtw_set_802_11_connect(wlan0) fw_state = 0x00000008

Googling the error along with RTL8723BS shows some recent posts on patches with comments in the code about this error. Not sure if it is related and beyond my level of understanding but it gives me hope maybe it'll get fixed in future kernels. The comment specifically on error reason code 6 seems to be from 2013 though, so maybe not... https://www.spinics.net/lists/linux-staging/msg13157.html