[G1 Android Development] pramods:
Hey, I am able to run all the services on Hero build for G1, and even all the sockets are created perfectly,

# ls -l /dev/socket

ls -l /dev/socket

srw-rw---- bluetooth bluetooth 2009-07-02 13:27 bluetooth

srw-rw---- bluetooth bluetooth 2009-07-02 13:27 dbus_bluetooth

srw------- system system 2009-07-02 13:26 installd

srwxrwxrwx bluetooth bluetooth 2009-07-02 13:26 dbus

srw-rw-rw- root root 2009-07-02 13:26 zygote

srw-rw---- root radio 2009-07-02 13:26 rild

srw-rw---- radio system 2009-07-02 13:26 rild-debug

srw-rw---- root mount 2009-07-02 13:26 vold

srw-rw-rw- root root 2009-07-02 13:26 property_service

theoretically this is what is required to start the bluetooth, but I am not able to see the bluetooth started in UI, it still remain at Turning on.

-Pramod

PS: Even the bts service is up and running

root 559 1 7764 1348 ffffffff afe0d25c S /system/bin/bts

bluetooth 560 1 744 228 c00bb774 afe0d25c S /system/bin/hciattach

any custom app that can interact with bluetooth device?

ITS WORKING, BLUETOOTH IS WORKING ON G1 HERO, only problem, you have to work with command line.

# hcitool scan

hcitool scan

Scanning ...

00:03:7A:FE:91:46 n/a

#

00:03:7A:FE:91:46 is the bluetooth address of my laptop!!!!

=================

STEP to make bluetooth work on G1 Hero build, someone will need to make all this automate, as with the compass sensor[which I figured out need to be replaced from previous version of G1 build].

Step 1: Change the init.rc and init.trout.rc files [ you will need to inflate the boot.img and then repack, I will have the boot.img attached] the changes I did to these file are

init.rc

---------

service dbus /system/bin/dbus-daemon --system --nofork

socket dbus stream 660 bluetooth bluetooth

user bluetooth

group bluetooth net_bt_admin root misc

service hcid /system/bin/hcid -s -n -f /system/etc/bluez/hcid.conf

socket bluetooth stream 660 bluetooth bluetooth

socket dbus_bluetooth stream 660 bluetooth bluetooth

# init.rc does not yet support applying capabilities, so run as root and

# let hcid drop uid to bluetooth with the right linux capabilities

group bluetooth net_bt_admin misc root

disabled

service hfag /system/bin/sdptool add --channel=10 HFAG

user bluetooth

group bluetooth net_bt_admin root misc

disabled

oneshot

service hsag /system/bin/sdptool add --channel=11 HSAG

user bluetooth

group bluetooth net_bt_admin root misc

disabled

oneshot

service hciattach /system/bin/hciattach \

-n -s 115200 /dev/ttyHS0 texas 4000000 flow

user bluetooth

group bluetooth net_bt_admin root misc

disabled

#btips

service btips /system/bin/bts

socket bluetooth stream 660 bluetooth bluetooth

socket dbus_bluetooth stream 660 bluetooth bluetooth

group bluetooth net_bt_admin misc root

disabled

oneshot

-------------------CHANGE THE APPROPRIATE SECTION, remaining thing is as is---------------

init.trout.rc

--------

# bluetooth power up/down interface

chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type

chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state

chmod 0660 /sys/class/rfkill/rfkill0/state

service hciattach /system/bin/logwrapper /system/bin/hciattach \

-n -s 115200 /dev/ttyHS0 texas 4000000 flow

user bluetooth

group bluetooth net_bt_admin misc root

disabled

---------removed the legacy, that is not required, the current kernel trout uses rfkill so others are not required---------

repack the boot.img follow this tutorial http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images

upload the old brf6300.bin from /system/etc/firmware to hero /system/etc/firmware and then rename the original TIInit_5.3.53.bts to some thing and rename the brf6300.bin to TIInit_5.3.53.bts

step 2: enter fastboot, flash the boot.img using fastboot flash boot boot-new.img and then fastboot reboot

step3 : enter the adb shell as soon as possible after adb remount[ make sure you do this as fast or at the first instance else there permission issues]

step 4: at root prompt, enter chmod 777 /dev/socket as first command and then chmod 777 /dev/socket/dbus

step 5: see the process running by ps command, you should see dbus-daemon with bluetooth user

step 6: let boot the Hero exit the adb shell

step 7: push the hcitool from adb [if you have compiled android then the location of this file is mydroid/out/target/product/dream/symbols/system/bin by using

adb push hcitool /system/bin/ and enter the adb shell and give the execute permission to this file

step 8: enter the adb shell session and enter start hcid then start hciattach and ps, you should see the process /system/bin/hcid and /system/bin/hciattach

step 9: ls -l /dev/socket should show you bluetooth and dbus_bluetooth

step 10: from setting option of hero, start the bluetooth, and look at the adb shell session for process and you should see /system/bin/bts

step11: from adb shell run hcitool scan and see the nearing bluetooth device !!!!!

Enjoy bluetooth on HERO G1 port....

here is the file with boot-new.img and hcitool

http://www.megaupload.com/?d=YH3YNFY5