[Kernelpatch][25.03.2011] Bluetooth battery drain fix

Search This thread

trilu

Senior Member
Apr 17, 2008
68
108
munich
Hi all,

i think i have fixed the ugly bluetooth battery drain bug.
It works for me since yesterday evening. Battery drain is between 2ma and 5ma with GSM and BT enabled. Also the headset in my car works very well.

Base for my work was tytungs kernel git - i think it was v8, but not sure...
In this post you will find a patch file, the compiled kernel and the source files i have modified. I'm a absolutly beginner with compiling linux, so i am not sure that the patch file will work, diff has a realy big manual :p

http://gitorious.org/~tytung/linux-on-wince-htc/tytungs-hastarins-linux_on_wince_htc

Also i am not sure how this kernel will work with Sense roms, because Sense use btld which has the power saving features in the binary and not in the kernel.

Last but not least i will thank Charansingh for the work he has done on the BT problem and tytung for his kernel base.

If you like to test the kernel, please take also my modules, because i get with the precompiled files from tytung a version magic error.
Your feedback is highly appreciated.

Best regards
trilu


In this Post you will find the zip file for updating magldr
http://forum.xda-developers.com/showpost.php?p=12374073&postcount=7

Here you find the zip file for updating clk
http://forum.xda-developers.com/showpost.php?p=12378215&postcount=34



Just found another point to save 3 to 5ma more
I installed Typhoons CM7 Image and was wondering why me drain in standby was 7 to 10ma with BT enabled.
Yesterday with Charansingh's nightly it was arround 3 to 5ma.

The solution is to set the low power flag on brcm_patchram_plus in init.rc
service hciattach /system/bin/brcm_patchram_plus --enable_lpm --enable_hci \
--baudrate 3000000 --patchram /etc/firmware/bcm4329.hcd /dev/ttyHS0

Also seen that in a lot of images hciattach service is set in init.rc and init.htcleo.rc
In my experience the hciattach service should start only in init.rc, before bluetoothd service.
 

Attachments

  • kernel.zip
    2.5 MB · Views: 754
  • patch.zip
    3 KB · Views: 722
  • source.zip
    24 KB · Views: 326
Last edited:

arifqur

Senior Member
Nov 12, 2005
3,603
1,036
Wow!
Thank God for this.
Finally and hopefully this matter is solved.
Which Rom have you tested this kernel with?
Can I use the latest Tween's Rom?
 

mponte

Senior Member
May 15, 2008
210
38
A Coruña
here you are :) magldr version; for cLK use fastboot flash:raw command. (you'll need your own initrd.gz or the one delivered with build).

i got cLK in Typhoon 2.8.0.
kernel is on a boot.img file to flash. can i only flash this file with cwm as is?
as i see the updater-script only updates the zImage file and modules

P.S.
what's about this?
Code:
package_extract_dir("boot", "/boot");
there is no boot folder, only zImage file
 
Last edited:

seadersn

Recognized Developer
Nov 3, 2010
3,583
3,403
43
Germany
cLK version doesn't exist for now. i will make one, but this will take roundabout 4-6 hours, as i have to sleep a little bit now (only two hours the last 24h).
 

tytung

Senior Member
Jun 21, 2010
3,574
15,005
sites.google.com
Hi all,

i think i have fixed the ugly bluetooth battery drain bug.
It works for me since yesterday evening. Battery drain is between 2ma and 5ma with GSM and BT enabled. Also the headset in my car works very well.

Base for my work was tytungs kernel git - i think it was v8, but not sure...
In this post you will find a patch file, the compiled kernel and the source files i have modified. I'm a absolutly beginner with compiling linux, so i am not sure that the patch file will work, diff has a realy big manual :p

http://gitorious.org/~tytung/linux-on-wince-htc/tytungs-hastarins-linux_on_wince_htc

Also i am not sure how this kernel will work with Sense roms, because Sense use btld which has the power saving features in the binary and not in the kernel.

Last but not least i will thank Charansingh for the work he has done on the BT problem and tytung for his kernel base.

If you like to test the kernel, please take also my modules, because i get with the precompiled files from tytung a version magic error.
Your feedback is highly appreciated.

Best regards

trilu

Hi trilu,

Great job.
Thank you.

Regarding diff command:
Code:
cd tytungs-hastarins-linux_on_wince_htc
git diff > ../bt.diff
{or}
git format-patch -o ../patches origin
 

tytung

Senior Member
Jun 21, 2010
3,574
15,005
sites.google.com
how can i build a boot.img file for clk?

Create a folder including unyaffs, mkyaffs2image, unpack.sh, pack.sh, and boot.img (Get boot.img from cLK thread).

1. unpack.sh
Code:
if [ -f boot.img ]; then
  rm -rf boot
  mkdir boot
  cd boot
  ../unyaffs ../boot.img

  cd ..
  rm -rf initrd
  mkdir initrd
  cd initrd
  gzip -dc ../boot/initrd.gz | cpio -i
else
  echo cannot find boot.img
fi

2. replace boot/zImage

3. pack.sh
Code:
cd initrd
find . | cpio -o -H newc | gzip -9 > ../boot/initrd.gz
cd ..
mkyaffs2image boot/ boot.img
Then you will get a modified boot.img.
 

Attachments

  • yaffs2_tools_for_Ubuntu_x64.zip
    11.4 KB · Views: 15
Last edited:
  • Like
Reactions: louie317

mponte

Senior Member
May 15, 2008
210
38
A Coruña
Create a folder including unyaffs, mkyaffs2image, unpack.sh, pack.sh, and boot.img (Get boot.img from cLK thread).

1. unpack.sh
Code:
if [ -f boot.img ]; then
  rm -rf boot
  mkdir boot
  cd boot
  ../unyaffs ../boot.img

  cd ..
  rm -rf initrd
  mkdir initrd
  cd initrd
  gzip -dc ../boot/initrd.gz | cpio -i
else
  echo cannot find boot.img
fi

2. replace boot/zImage

3. pack.sh
Code:
cd initrd
find . | cpio -o -H newc | gzip -9 > ../boot/initrd.gz
cd ..
mkyaffs2image boot/ boot.img
Then you will get a modified boot.img.

trilu, can you make now a boot.img to test typhoon build?
 

Evil_enc

Senior Member
Aug 5, 2010
175
15
is the hd2 now officially supported? cant see any news.. all devices have working RC2. what about official cyanogenmod for hd2 leo? cant see anything on their website
 

cobhc

Senior Member
Nov 20, 2009
531
86
Nottingham
is the hd2 now officially supported? cant see any news.. all devices have working RC2. what about official cyanogenmod for hd2 leo? cant see anything on their website

We'll never get official CM7 for the HD2 as the HD2 is not a native Android device, and there is licensing issues because of that.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 74
    Hi all,

    i think i have fixed the ugly bluetooth battery drain bug.
    It works for me since yesterday evening. Battery drain is between 2ma and 5ma with GSM and BT enabled. Also the headset in my car works very well.

    Base for my work was tytungs kernel git - i think it was v8, but not sure...
    In this post you will find a patch file, the compiled kernel and the source files i have modified. I'm a absolutly beginner with compiling linux, so i am not sure that the patch file will work, diff has a realy big manual :p

    http://gitorious.org/~tytung/linux-on-wince-htc/tytungs-hastarins-linux_on_wince_htc

    Also i am not sure how this kernel will work with Sense roms, because Sense use btld which has the power saving features in the binary and not in the kernel.

    Last but not least i will thank Charansingh for the work he has done on the BT problem and tytung for his kernel base.

    If you like to test the kernel, please take also my modules, because i get with the precompiled files from tytung a version magic error.
    Your feedback is highly appreciated.

    Best regards
    trilu


    In this Post you will find the zip file for updating magldr
    http://forum.xda-developers.com/showpost.php?p=12374073&postcount=7

    Here you find the zip file for updating clk
    http://forum.xda-developers.com/showpost.php?p=12378215&postcount=34



    Just found another point to save 3 to 5ma more
    I installed Typhoons CM7 Image and was wondering why me drain in standby was 7 to 10ma with BT enabled.
    Yesterday with Charansingh's nightly it was arround 3 to 5ma.

    The solution is to set the low power flag on brcm_patchram_plus in init.rc
    service hciattach /system/bin/brcm_patchram_plus --enable_lpm --enable_hci \
    --baudrate 3000000 --patchram /etc/firmware/bcm4329.hcd /dev/ttyHS0

    Also seen that in a lot of images hciattach service is set in init.rc and init.htcleo.rc
    In my experience the hciattach service should start only in init.rc, before bluetoothd service.
    10
    can anybody build a boot.img to flash via cwm?

    here you are :) magldr version; for cLK use fastboot flash:raw command. (you'll need your own initrd.gz or the one delivered with build).
    6
    I have prepared a update for clk systems.
    Enclosed is tytungs latest kernel, and some scripts i have found for ppp.
    Also the update deletes all pairing settings for BT.
    Tested with typhoons CM7 Image only.

    Please do a complete backup before testing!!!!!!
    4
    I've tested with Charansingh CM7 nightly - but it should work with every rom which uses tytungs kernel v8 and is Gingerbread.
    As mentioned, feedback for Froyo and Sense is welcome...
    4
    Hi,

    I cant connect my BT headset to phone. It says is paired but not connected, when try to connect manually, its connecting and nothing happens. Dont know how to provide a logcat, sorry. Also tried unpair and pair it again, nothing. After applied this patch I get 9-15mA in standby, which is better result then before. Great work :D

    kernel_tytung_r8.2_beta_update.zip
    http://www.multiupload.com/FEQVJQBYZR

    Based on Trilu's patch
    Removed some debug and unnecessary code, and added some possible missing code
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone