rtl8723be Wi-Fi and Bluetooth on Android-x86 (CM13 and beyond)

447 views
Skip to first unread message

Daniel Wörner

unread,
Dec 11, 2017, 2:36:50 AM12/11/17
to Android-x86
Hi everyone! First post here :D
*I've been a linux user for a long time, but I'm not that technical nor I have the knowledge to speak or write about many things, if you see someting missing or not properly explained or detailed, do not hesitate to tell me. I'll be grateful to receive advise and learn more, as well as correcting things so everyone can understand!

First of all, thanks for the amazing job you're all making! I finally got rid of Windows 10 on my 2 in 1 HP Pavilion 11-k172la by dual booting CM-x86 13.0 r1 and Arch Linux. I'm a musician, and being able to read and annotate on PDFs for free and in a much better and faster way than in Windows is something I thought impossible for the last 6 months. I had tried RemixOS and PhoenixOS with no succes (no accelerometers, no networks, etc) CM works beautifully on my computer (both 13 and 14), but I had a couple problems with it, which I'll explain in the following lines:

As you can read in the topic, my laptop has a rtl8723be wireless. According to many pages I have read, it has both Wi-Fi and Bluetooth, but so far I've just managed to make Wi-Fi work in Arch Linux and Android. "Out of the box", Wi-Fi works but has very low signal and disconnects from networks. The bluetooth doesn't show anything (in fact I still can't make it work under Arch Linux, and I've been reading that it has no kernel support yet, haven't tried everything yet)

The Arch Wiki page gave me an answer to the solution in linux, you can see it on the following link:


In a few words, the kernel module doesn't know to handle power safe properly and which of the two antennas are connected, so we have to tell the kernel to not use power safe and point the right antenna, which might be "1" or "2" (instead of "0", the default option). According to various forums I've been reading, it's Realtek's fault, and it should be solved on newer kernel versions.
So, in Arch Linux (which has systemd in charge of everything) I could create the file "/etc/modprobe.d/rtl8723ae.conf" with the proper parameters for the module:

/etc/modprobe.d/rtl8723be.conf
options rtl8723be ant_sel=2 fwlps=0 

So I though, as Android is based on Linux as well, that maybe I could send the same command, somehow. And as I'm using a linux distribution, I easily could access Android partition and look for some files and answers. That's how I found init.sh script and init.d folder. First I started messing around with init.sh with no success, then I read about making a file as in the previously shown method and finally managed to get it running:

As the system loads everything on boot, as it should, in order to make things right I have to unload the "rtl8723be" and "wl" modules, so I can reload the rtl module with the proper parameters. I ran the following commands in CM 13 with root access enabled, in the bundled console.

rmmod rtl8723be
rmmod wl
modprobe rtl8723be ant_sel=1 fwlps=0

I tried with ant_sel=2 (as it worked in archlinux) with no succes. Then I tried ant_sel=1 and voila, so you have to try before going any further. It may panic your system, happened to me a couple times reloading the modules with different parameters.
That gave me the signal strenght I needed, so then I nedded a way to make changes persistent. So I made this file, according to some website I haven't been able to find again:

/<android filesystem>/system/etc/init.d/50wifi

function fix_rwifi()
                   rmmod rtl8723be
                   rmmod wl
                   #modprobe rtl8723be ant_sel=2 fwlps=0 disable_watchdog=1 ips=0 msi=1
                   modprobe rtl8723be ant_sel=1 fwlps=0 disable_watchdog=1 ips=0
                   #modprobe wl
}

fix_rwifi

return0

I tried many things; as you can see, there are more parameters than before and I even made a function a la init.sh, so as you might suspect, I don't clearly know what worked. Certainly, The only thing I know that worked is the ant_sel parameter, which is clearly the most important. The other parameters are properly explained in the module's information (execute "modinfo rtl8723be") and may prove useful as well.
I saw the number prefix for the init.d file in a ubuntu forum I think, but I don't know if the "50" does anything, if someone can explain, thanks!

So that covers my Wi-Fi. Bluetooth is another story and still can't get to solve it, so any information regarding this problem will be really appreciated!

Before finishing, I must clarify that I first installed CM-x86 14.1-rc1 but as Wi-Fi didn't work I thought it was that version's fault, so I downloaded CM-13 and installed it. Both work really nice and smooth, but none has out of the box wifi and bluetooth. I think the file init.d/50wifi should work on any of the versions above 13 as well, but didn't try.

Thanks again, I hope to read from you soon!
Have a nice week!

Michael Goffioul

unread,
Dec 11, 2017, 6:21:26 AM12/11/17
to andro...@googlegroups.com
On Mon, Dec 11, 2017 at 2:36 AM, Daniel Wörner <danwpr...@gmail.com> wrote:
I saw the number prefix for the init.d file in a ubuntu forum I think, but I don't know if the "50" does anything, if someone can explain, thanks!

This is used to specify an order or execution for the scripts. There are executed in alphabetical order when listing the direactory, using a number prefix is a simple way to order them.

Michael.

Daniel Wörner

unread,
Dec 11, 2017, 4:36:58 PM12/11/17
to Android-x86
That makes sense, thanks Michael! In fact there were already two files in init.d: 00banner and 90userinit. So the file started with 00 runs first and the 90 last, am I right?
And does the function I made in the 50wifi script make a difference or I could just have written the commands right into the file? i.e:

/system/etc/init.d/50wifi


rmmod rtl8723be
rmmod wl
modprobe rtl8723be ant_sel
=1 fwlps=0

And thinking more about it, as init.sh has some interesting functions for detecting specific hardware and tweaking the system for whatever it finds, it would be even better to make one function there so everyone who installs android-x86 in a computer with rtl8723be or rtl8723ae has it working out of the box, but I still don't have the knowledge to make such script (I just know how to tell the system to do it, whether it has the rtl card or not). As far as I know and tested, rtl8723be doesn't work out of the box on android-x86 6 and 7.1 rc1, nor wi-fi neither bluetooth. And I checked init.sh and there are no indications to look for any wireless interface.
Going back to the script, I would gladly help making it with proper directions. What I know is that in PhoenixOS they made a function for detecting a couple wireless interfaces (not mine, certainly). That added to watching how init.sh is written, I can add the function to the file, but can't make it so it detects whether the system has the rtl8723be or not. Oh, I forgot: In the link I provided previously, which leads to Arch Linux's wiki regarding wireless configuration, it states that both rtl8723be and rtl8723ae may have the same problems, so if a script is made for this, it would not cover just one model.

I have another question: Is it possible to manually change modules? I mean, replace rtl8723 files or the entire rtl_something folder with another version of the same modules or I'll screw my system? I would replace them for the modules provided in this page:


This is what I still can't try on Arch Linux but will as soon as I can access github's page (for some strange reason, github and some other sites are unaccesible from my home). This might fix wi-fi and bluetooth as well, so if it works on arch linux maybe it works on android too...


Chih-Wei Huang

unread,
Dec 25, 2017, 9:52:12 PM12/25/17
to Android-x86
First of all, thank you for the sharing.

2017-12-12 5:36 GMT+08:00 Daniel Wörner <danwpr...@gmail.com>:
>
> That makes sense, thanks Michael! In fact there were already two files in
> init.d: 00banner and 90userinit. So the file started with 00 runs first and
> the 90 last, am I right?
> And does the function I made in the 50wifi script make a difference or I
> could just have written the commands right into the file? i.e:
>
> /system/etc/init.d/50wifi

I guess /system/etc/init.d/* is a CM(LineageOS) only extension.
Android(-x86) doesn't have the dir and won't exec such scripts.

It's better to modify the init.sh for your model
and come out an official patch for android-x86.
You can see examples in function init_hal_bluetooth().

> rmmod rtl8723be
> rmmod wl
> modprobe rtl8723be ant_sel=1 fwlps=0
>
> And thinking more about it, as init.sh has some interesting functions for
> detecting specific hardware and tweaking the system for whatever it finds,
> it would be even better to make one function there so everyone who installs
> android-x86 in a computer with rtl8723be or rtl8723ae has it working out of
> the box, but I still don't have the knowledge to make such script (I just
> know how to tell the system to do it, whether it has the rtl card or not).
> As far as I know and tested, rtl8723be doesn't work out of the box on
> android-x86 6 and 7.1 rc1, nor wi-fi neither bluetooth. And I checked
> init.sh and there are no indications to look for any wireless interface.
> Going back to the script, I would gladly help making it with proper
> directions. What I know is that in PhoenixOS they made a function for
> detecting a couple wireless interfaces (not mine, certainly). That added to
> watching how init.sh is written, I can add the function to the file, but
> can't make it so it detects whether the system has the rtl8723be or not. Oh,
> I forgot: In the link I provided previously, which leads to Arch Linux's
> wiki regarding wireless configuration, it states that both rtl8723be and
> rtl8723ae may have the same problems, so if a script is made for this, it
> would not cover just one model.

FYI, my notebook, ASUS X556UB also uses rtl8723be.
It works well in both Linux (Fedora) and Android-x86.
Both wifi and bluetooth work.

Therefore I don't think a workaround for all rtl8723be devices
is appropriate. It's better to limit the workaround to some
models which have the issues.


> I have another question: Is it possible to manually change modules? I mean,
> replace rtl8723 files or the entire rtl_something folder with another
> version of the same modules or I'll screw my system? I would replace them
> for the modules provided in this page:
>
> https://github.com/lwfinger/rtlwifi_new/tree/master/rtl8723be

Yes, it's possible, if you know how to build
an external module with our kernel.
(not too difficult, you could google it)

> This is what I still can't try on Arch Linux but will as soon as I can
> access github's page (for some strange reason, github and some other sites
> are unaccesible from my home). This might fix wi-fi and bluetooth as well,
> so if it works on arch linux maybe it works on android too...




--
Chih-Wei
Android-x86 project
http://www.android-x86.org
Reply all
Reply to author
Forward
0 new messages