Realtek RTL8723BS Bluetooth on Android

3,165 views
Skip to first unread message

spin877

unread,
Feb 3, 2016, 11:32:46 PM2/3/16
to Android-x86
Android Marshmallow and kernel version 4.4.0 Vanilla  Bluetooth works

here source

give command


rtk_hciattach -n -s 115200 /dev/ttyS1 rtk_h5

on my tablet the dev is /dev/ttyS1
for you could be another dev

attached compiled 32 and 64 bit

Now the question is:
how to integrate the Rom and initialize it in the script init.rc?
rtk_hciattach.tar.gz

Mario Holzinger

unread,
Feb 4, 2016, 1:58:32 AM2/4/16
to Android-x86
Thank you for that will try it when I get home today and will also provide a patch for everithing needed (init.sh,...) if I get it working

best regards
Mario

Mario Holzinger

unread,
Feb 5, 2016, 6:34:59 AM2/5/16
to Android-x86
May I ask for a little bit of extra information.

I am working on lollipop sources
take your precompiled binary (x32) and copy it to /etc/
take your start_bt.sh from sources and copy it to /etc/ (it allready has a auto detection for the hopfully correct dev)
take the firmware from the sources and place it according to the Makefile in /lib/firmware/rtk_bt/

manual start do not work ==> autodisabling BT when I try to activate the BT-Module
autostart by init.sh also not working same situation

do I miss somthing important?

thx
Mario

spin877

unread,
Feb 5, 2016, 7:58:05 AM2/5/16
to Android-x86

In my pre-compiled , firmware, and config files they have been integrated . 
each time you start rtk_hciattach he writes in /data/local/tmp/rtlbt_fw etc.... . and then charging .
I know it 's stupid and redundant , but I'm not a professional programmer . 
I was difficult to enter the firmware in ROM , I put the firmware in the executable :-p

I tried I start_bt.sh script but does not work for me. 
It reveals two ports com " MMIO " and locks .

the orignal code I took from here https://github.com/lwfinger/rtl8723bs_bt

>manual start do not work ==> autodisabling BT when I try to activate the BT-Module

give command

rtk_hciattach -n -s 115200 /dev/ttyS1 rtk_h5

should respond

Realtek Bluetooth :Init Process finished
Realtek Bluetooth post process
Device setup complete

do not touch.
open a new shell

give command

hciconfig

should respond

hciconfig
hci0:   Type: BR/EDR  Bus: UART
        BD Address: 00:1A:13:6B:32:C5  ACL MTU: 1021:8  SCO MTU: 255:16
        DOWN
        RX bytes:1290 acl:0 sco:0 events:29 errors:0
        TX bytes:789 acl:0 sco:0 commands:29 errors:0


It means that the drivers side is ready . Lollipop is interfering with marshmallow works on the first try


P.S.
try 
hciconfig hci0 up
excuse my English use google translate :-(

spin877

unread,
Feb 6, 2016, 7:38:41 PM2/6/16
to Android-x86

I modified the script start_bt.sh bluetooth detection.
manually it works.
how do I start it each time you start automatically?
What should I write in /system/etc/init.sh?

-------- cut here script  start_bt.sh

#!/system/bin/sh
#
# Shell script to install Bluetooth firmware and attach BT part of
# RTL8723BS
#
         RTK_DRV=`lsmod  | grep   r8723bs`

         if [ "$RTK_DRV" != "" ];then
                 TTY=`dmesg -t | grep tty | grep -m 1 MMIO | cut -b 14-18`
                 else
                 echo
                 echo "No modules r8723bs to be loaded"
                 echo
                 exit 1
                fi

                if [ "$TTY" != "" ];then
                 TTY="/dev/$TTY"
                 echo "Using device $TTY for Bluetooth"
                 /system/xbin/rtk_hciattach -n -s 115200 $TTY rtk_h5 >/data/local/tmp/hciattach.txt 2>&1 &
                 else
                 echo
                 echo "No r8723bs BT TTY device has been found"
                 echo "Either this computer has no BT device that uses hciattach, or"
                 echo "Your kernel does not have module 8250_dw configured."
                 echo "Note: The configuration variable is CONFIG_SERIAL_8250_DW."
                 echo
                fi

youling 257

unread,
Mar 8, 2016, 1:05:50 PM3/8/16
to Android-x86

Bluetooth

The WiFi drivers indeed are also drivers for Bluetooth, but getting Bluetooth working is a bit difficult. You need to patch your kernel with this patch. Then use this program to add the firmware to your Linux install and also there is a script that needs to be run each boot to turn on the Bluetooth module.


https://github.com/Manouchehri/vi8/blob/master/Ubuntu_instructions.md


This patch,how to work on android kernel ?

Chih-Wei Huang

unread,
Mar 9, 2016, 12:32:59 PM3/9/16
to Android-x86
OK, I applied the patch.
Thanks!


--
Chih-Wei
Android-x86 project
http://www.android-x86.org
Message has been deleted
Message has been deleted

spin877

unread,
Mar 13, 2016, 5:17:29 AM3/13/16
to Android-x86


in my opinion
only the patch /net/rfkill/rfkill-gpio.c not enough

We must always load the firmware rtlbt_fw with

rtk_hciattach -n -s 115200 /dev/ttyS1 rtk_h5





Il giorno sabato 12 marzo 2016 15:39:07 UTC+1, youling 257 ha scritto:
Did you succeed ?

在 2016年2月7日星期日 UTC+8上午8:38:41,spin877写道:
Message has been deleted

spin877

unread,
Mar 26, 2016, 6:36:52 AM3/26/16
to Android-x86

I think so. I tried with init.sh but I did not succeed.
I do not understand how it works
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

youling 257

unread,
Jun 4, 2016, 12:21:39 PM6/4/16
to Android-x86
https://github.com/lwfinger/rtl8723bs_bt/issues/7
“I added the lines from here. (had to edit by hand, patch didn't work, since there are other changes on 4.5 kernel in rfkill). Then enabled CONFIG_RFKILL_GPIO=m in kernel config and recompiled kernel. Re-installed rtl8723bs and rtl8723bs_bt and it worked.”
need CONFIG_RFKILL_GPIO=m

youling 257

unread,
Jun 4, 2016, 12:24:26 PM6/4/16
to Android-x86

youling 257

unread,
Jun 5, 2016, 8:08:39 AM6/5/16
to Android-x86
nice
Screenshot_20160605-194330.png
Screenshot_20160605-192810.png
Message has been deleted

Chih-Wei Huang

unread,
Jun 5, 2016, 10:34:04 PM6/5/16
to Android-x86
2016-06-06 7:17 GMT+08:00 youling 257 <youli...@gmail.com>:
> Chih-Wei Huang,I see you add CONFIG_RFKILL_GPIO=m to kernel tree,
> https://sourceforge.net/p/android-x86/kernel/ci/bf3cf2a8dded98d77e4c3ed12c19bedb65c4f955/
> I tell you,need system/bin/rtk_hciattach,please extract rtk_hciattach.tar.gz

Please use btattach (fix or modify it if necessary).

> and add to source ;need every boot,rtk_hciattach -n -s 115200 /dev/ttyS1
> rtk_h5,please add it to init.sh

Provide a patch for your device.
Message has been deleted

youling 257

unread,
Jun 5, 2016, 11:21:22 PM6/5/16
to Android-x86
Do not understand the meaning of your English
If  compile the source code to get ISO,   must modify the system.img, copy into the /bin/rtk_hciattach, copy into the /etc/init.d/2.sh, cm13 support init.d,
2.sh, it just needs to be edited.
# /system/bin/sh!
rtk_hciattach -n -s /dev/ttyS1 115200 rtk_h5 

在 2016年6月6日星期一 UTC+8上午10:34:04,Chih-Wei Huang写道:

Chih-Wei Huang

unread,
Jun 5, 2016, 11:31:17 PM6/5/16
to Android-x86
2016-06-06 11:21 GMT+08:00 youling 257 <youli...@gmail.com>:
> Do not understand the meaning of your English
> If compile the source code to get ISO, must modify the system.img, copy
> into the /bin/rtk_hciattach, copy into the /etc/init.d/2.sh, cm13 support
> init.d,
> 2.sh, it just needs to be edited.
> # /system/bin/sh!
> rtk_hciattach -n -s /dev/ttyS1 115200 rtk_h5
>
> 在 2016年6月6日星期一 UTC+8上午10:34:04,Chih-Wei Huang写道:
>>
>> 2016-06-06 7:17 GMT+08:00 youling 257 <youli...@gmail.com>:
>> > Chih-Wei Huang,I see you add CONFIG_RFKILL_GPIO=m to kernel tree,
>> >
>> > https://sourceforge.net/p/android-x86/kernel/ci/bf3cf2a8dded98d77e4c3ed12c19bedb65c4f955/
>> > I tell you,need system/bin/rtk_hciattach,please extract
>> > rtk_hciattach.tar.gz
>>
>> Please use btattach (fix or modify it if necessary).

The btattach is a standard Bluez tool which
has been integrated into our codebase.
See https://www.daemon-systems.org/man/btattach.8.html
You may contact the author if you need help
to add the support of your device.

>> > and add to source ;need every boot,rtk_hciattach -n -s 115200 /dev/ttyS1
>> > rtk_h5,please add it to init.sh
>>
>> Provide a patch for your device.

Read function init_hal_bluetooth() of init.sh
to see how to add the support for your device.

youling 257

unread,
Jun 5, 2016, 11:31:29 PM6/5/16
to Android-x86
2.sh, it just needs to be edited.
# /system/bin/sh!
rtk_hciattach -n -s 115200 /dev/ttyS1  rtk_h5 

在 2016年6月6日星期一 UTC+8上午11:21:22,youling 257写道:
Reply all
Reply to author
Forward
0 new messages