FORUMS

[GUIDE] How to port Bluez to Kitkat, Lollipop & Marshmallow

1,634 posts
Thanks Meter: 5,409
 
By daniel_hk, Inactive Recognized Contributor on 8th February 2014, 10:24 AM
Post Reply Email Thread
22nd February 2016, 10:29 PM |#61  
Kyokushin's Avatar
Junior Member
Flag Warsaw
Thanks Meter: 3
 
More
Hmm, so what about CM13? It have BlueZ 5 with apt-x or not?
The Following User Says Thank You to Kyokushin For This Useful Post: [ View ] Gift Kyokushin Ad-Free
1st March 2016, 12:39 AM |#62  
NV-Dev's Avatar
Senior Member
Thanks Meter: 280
 
Donate to Me
More
Hi, has anyone been able to carry BlueZ kernel 3.4?
4th March 2016, 11:54 PM |#63  
NV-Dev's Avatar
Senior Member
Thanks Meter: 280
 
Donate to Me
More
CM-11.0 Bluez - Kernel 3.4
Hi, I had some problems with the device holder BlueZ.

It was made avaialble to the BlueZ kernel and can connect to the kernel.

But still does not work, and try to run the commands adb shell and this happens.

Shell:

Code:
bccmd -t bcsp -d /dev/ttyHS0 -b 115200 psload -r /system/etc/PSConfig_7820.psr
Result: Initialization timed out

Code:
hciattach -p /dev/ttyHS0 bcsp 3000000 flow
Result: BCSP initialization timed out

Thanks in advance, and I hope you can help me.

@Daniel_Kh

Device-tree: https://github.com/CyanogenMod-S6310..._samsung_royss
branch: cm-11.0

vendor: https://github.com/CyanogenMod-S6310...vendor_samsung
branch: cm-11.0
5th March 2016, 09:01 AM |#64  
daniel_hk's Avatar
OP Inactive Recognized Contributor
Flag Hong Kong
Thanks Meter: 5,409
 
Donate to Me
More
Quote:
Originally Posted by NV-Dev

Hi, I had some problems with the device holder BlueZ.

It was made avaialble to the BlueZ kernel and can connect to the kernel.

But still does not work, and try to run the commands adb shell and this happens.

Shell:

Code:
bccmd -t bcsp -d /dev/ttyHS0 -b 115200 psload -r /system/etc/PSConfig_7820.psr
Result: Initialization timed out

Code:
hciattach -p /dev/ttyHS0 bcsp 3000000 flow
Result: BCSP initialization timed out

Thanks in advance, and I hope you can help me.

@Daniel_Kh

Device-tree: https://github.com/CyanogenMod-S6310..._samsung_royss
branch: cm-11.0

vendor: https://github.com/CyanogenMod-S6310...vendor_samsung
branch: cm-11.0

This is one of my old threads. You didn't quote and your mention was misspelled. There was no notification to me. You are lucky that someone told me about your post. As a developer, these kind of careless mistakes should not happen.

You didn't provide the log so I can't tell what's wrong. Giving me the device tree and your commands won't help. I simply don't have your device to test.

I guess your kernel backport was not done or fail. Read the thread again. All I can tell are already there. You need to backport the bluetooth subsystem to at least 3.10.y (3.13.y or higher is recommended). Only you have the device can get this done.
Good luck!
The Following User Says Thank You to daniel_hk For This Useful Post: [ View ] Gift daniel_hk Ad-Free
7th March 2016, 01:05 PM |#65  
NV-Dev's Avatar
Senior Member
Thanks Meter: 280
 
Donate to Me
More
CM-11.0 Bluez - Kernel 3.4 (Logcat)
Quote:
Originally Posted by daniel_hk

This is one of my old threads. You didn't quote and your mention was misspelled. There was no notification to me. You are lucky that someone told me about your post. As a developer, these kind of careless mistakes should not happen.

You didn't provide the log so I can't tell what's wrong. Giving me the device tree and your commands won't help. I simply don't have your device to test.

I guess your kernel backport was not done or fail. Read the thread again. All I can tell are already there. You need to backport the bluetooth subsystem to at least 3.10.y (3.13.y or higher is recommended). Only you have the device can get this done.
Good luck!

Here it is in the log with BlueZ backported in the kernel: Logcat

Lines: 202, 1560- 1562, 1916 - 1917, 2040, 2070.

Kernel source

@daniel_hk
7th March 2016, 03:36 PM |#66  
daniel_hk's Avatar
OP Inactive Recognized Contributor
Flag Hong Kong
Thanks Meter: 5,409
 
Donate to Me
More
Quote:
Originally Posted by NV-Dev

Here it is in the log with BlueZ backported in the kernel: Logcat

Lines: 202, 1560- 1562, 1916 - 1917, 2040, 2070.

Kernel source

@daniel_hk

I can't pretended I read all your log and sources. I did a few search and follow some of your source. It already spent me over an hour...
1. The BT chip is not initialized. I don't know if you have turn the BT chip on. I assume you have.
2. I don't know which BT chip you have (I think athero?). You used BSCP and bccmd to initialize it. I assume you got it from the cm-10 (or earlier) device tree.
3. The ports are not initialized. That means the protocols are not ready. You can't configure the HCI if the chip is not initialized.
4. The command interface is not started. The bluetoothd would start it if the kernel is ready.
All the above concluded that your kernel is no ready.
Frankly, I can't follow your kernel source. Backport the bluetooth subsystem is straight forward. It is definitely not a simple job and I can't see where you really started.
Your approach seems in the right direction. I suggest you start from fresh again. Backport to 3.18-1 is a good start. All you need is the drivers/bluetooth and net/bluetooth subsystem. You may need a driver for your BT chip too but I can't find which in your source.
Again, only you have the device can get this done. Just finish the backport in kernel and everything would be in the right place.
Good luck!
The Following 2 Users Say Thank You to daniel_hk For This Useful Post: [ View ] Gift daniel_hk Ad-Free
29th March 2016, 12:29 AM |#67  
NV-Dev's Avatar
Senior Member
Thanks Meter: 280
 
Donate to Me
More
Bluetooth working now.
Quote:
Originally Posted by daniel_hk

I can't pretended I read all your log and sources. I did a few search and follow some of your source. It already spent me over an hour...
1. The BT chip is not initialized. I don't know if you have turn the BT chip on. I assume you have.
2. I don't know which BT chip you have (I think athero?). You used BSCP and bccmd to initialize it. I assume you got it from the cm-10 (or earlier) device tree.
3. The ports are not initialized. That means the protocols are not ready. You can't configure the HCI if the chip is not initialized.
4. The command interface is not started. The bluetoothd would start it if the kernel is ready.
All the above concluded that your kernel is no ready.
Frankly, I can't follow your kernel source. Backport the bluetooth subsystem is straight forward. It is definitely not a simple job and I can't see where you really started.
Your approach seems in the right direction. I suggest you start from fresh again. Backport to 3.18-1 is a good start. All you need is the drivers/bluetooth and net/bluetooth subsystem. You may need a driver for your BT chip too but I can't find which in your source.
Again, only you have the device can get this done. Just finish the backport in kernel and everything would be in the right place.
Good luck!

@daniel_hk

The bluetooth is working now.

Thanks men, you are the best!

BlueZ 5.38 with Backport 3.18 working in royss (msm7x27a and kernel 3.4)

Click image for larger version

Name:	12442931_980520998694252_773370088_n.jpg
Views:	274
Size:	18.4 KB
ID:	3699939 Click image for larger version

Name:	12899719_979769918769360_579597324_n.jpg
Views:	274
Size:	11.7 KB
ID:	3699940
29th March 2016, 05:09 AM |#68  
daniel_hk's Avatar
OP Inactive Recognized Contributor
Flag Hong Kong
Thanks Meter: 5,409
 
Donate to Me
More
Quote:
Originally Posted by NV-Dev

@daniel_hk

The bluetooth is working now.

Thanks men, you are the best!

BlueZ 5.38 with Backport 3.18 working in royss (msm7x27a and kernel 3.4)

Attachment 3699939 Attachment 3699940

Good to know that! Congratulation.
You may consider share your kernel source at github too. Others might find it useful.
The Following User Says Thank You to daniel_hk For This Useful Post: [ View ] Gift daniel_hk Ad-Free
30th March 2016, 02:16 AM |#69  
NV-Dev's Avatar
Senior Member
Thanks Meter: 280
 
Donate to Me
More
Quote:
Originally Posted by daniel_hk

Good to know that! Congratulation.
You may consider share your kernel source at github too. Others might find it useful.

The kernel is on GitHub.

If someone reads this post and need a kernel 3.4 with backport 3.18, here it is. :v

Kernel (MSM7X27A - 3.4)
31st March 2016, 09:11 AM |#70  
daniel_hk's Avatar
OP Inactive Recognized Contributor
Flag Hong Kong
Thanks Meter: 5,409
 
Donate to Me
More
Quote:

start script for BCM4330
Hi Daniel,

Thanks for this excellent post. I would never have been able to port bluetooth to kitkat without your help.

You might want add this start script for BCM4330 to the replies to your posting in the hope that it might prove useful to others as I don't have sufficient privileges.

Shlomo

I received the above PM earlier. Sharing is the essence of open source. I don't have problem posting it.
The following is his script:
Code:
#!/system/bin/sh
# modified by shlomo kut

LOG_TAG="EQUATEL-HCI"
BTUART_PORT=/dev/ttySAC0
BTSTATE=/sys/class/rfkill/rfkill0/state
PSCONFIG=/system/etc/bluetooth/bcm4330.hcd
BAUDRATE=3000000
loge ()
{
/system/bin/log -t $LOG_TAG -p e "$LOG_NAME [email protected]"
}

logi ()
{
/system/bin/log -t $LOG_TAG -p i "$LOG_NAME [email protected]"
}

failed ()
{
loge "$1: exit code $2"
exit $2
}

logi "Enable power of csr chip"
echo "1" > $BTSTATE

logi "Config with brcm_patchram_plus"
logwrapper /system/bin/brcm_patchram_plus --baudrate $BAUDRATE --patchram /etc/bluetooth/bcm4330.hcd --no2bytes $BTUART_PORT
case $? in
0) logi "brcm_patchram_plus....done";;
*) failed "port: $BTUART_PORT - brcm_patchram_plus failed" $?;
exit $?;;
esac

logwrapper /system/xbin/hciattach -n -s $BAUDRATE $BTUART_PORT bcm43xx
case $? in
0) logi "hci attached to : $BTUART_PORT";;
*) failed "port: $BTUART_PORT - hciattach failed" $?;
exit $?;;
esac

setprop bluetooth.status on

logi "started bluetooth smd transport"

exit 0
23rd April 2016, 09:27 PM |#71  
Junior Member
Thanks Meter: 0
 
More
Quote:
Originally Posted by daniel_hk

Bionic may vary from ROMs. It is wiser to patch the bionic of your ROM manually. You may follow the changes of the two commits below:
https://code.google.com/p/aosp-bluez...latform-bionic
https://code.google.com/p/aosp-bluez...latform-bionic

Link doesn't show details now.
Please, tell how to patch bionic for KK!
Thanks.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes