[Android Development on Bada] hunktb:
Thanks again. I am not a developer and I do not have a wave 2, but I am just trying to investigate / learn things and share them at the same time

In your logs (dmesg) I see four times what I understand as trying to start bluetooth, and three times what I understand failing to start (process killed), fourth time it is not killed, but it seems it stops trying after phone going to sleep

<5>[ 21.355389] init: starting 'hciattach'

<6>[ 22.292372] acc_open

<6>[ 22.293782] acc_release

<5>[ 23.179830] init: starting 'bluetoothd'

<6>[ 23.193764] init: Created socket '/dev/socket/dbus_bluetooth' with mode '660', user '1002', group '1002'

<6>[ 23.215142] init: Created socket '/dev/socket/bluetooth' with mode '660', user '1002', group '1002'

<5>[ 24.397136] init: service 'bluetoothd' is being killed

<6>[ 24.405965] init: waitpid returned pid 467, status = 00000009

<5>[ 24.415316] init: process 'bluetoothd', pid 467 exited

<5>[ 24.425653] init: process 'bluetoothd' killing any children in process group

... (two more times similar, with others pid = process id, 970, 978, and last one just bluetooth start, followed by sleep; maybe there is no error because it stops trying when sleeping)

<5>[ 118.618262] init: starting 'hciattach'

<5>[ 120.428560] init: starting 'bluetoothd'

<6>[ 120.439218] init: Created socket '/dev/socket/dbus_bluetooth' with mode '660', user '1002', group '1002'

<6>[ 120.447362] init: Created socket '/dev/socket/bluetooth' with mode '660', user '1002', group '1002'

<6>[ 122.555406] request_suspend_state: sleep (3->3) at 122496103268 (2013-05-04 17:22:42.567764691 UTC)

In my S8500, dmesg do not shows these "killed" / "exited" messages related with bluetooth

Starting without wifi and bluetooth activated show this:

<5>[ 37.355129] init: starting 'hciattach'

<6>[ 38.933431] acc_open

<6>[ 38.935629] acc_release

<5>[ 39.198756] init: starting 'bluetoothd'

<6>[ 39.212837] init: Created socket '/dev/socket/dbus_bluetooth' with mode '660', user '1002', group '1002'

<6>[ 39.231650] init: Created socket '/dev/socket/bluetooth' with mode '660', user '1002', group '1002'

Starting wifi with bluetooth activated show this extra info in dmesg

<5>[ 314.455477] init: starting 'wpa_supplicant'

<6>[ 314.465450] init: Created socket '/dev/socket/wpa_wlan0' with mode '660', user '1010', group '1010'

<4>[ 315.556059]

<4>[ 315.556066] Dongle Host Driver, version 5.90.195.75

<4>[ 315.556071] Compiled in drivers/net/wireless/bcmdhd on Dec 27 2012 at 09:00:45

<4>[ 315.558631] wl_android_wifi_on in

<4>[ 315.560364] wifi_set_power = 1

<4>[ 315.770113] =========== WLAN going back to live ========

<4>[ 315.772979] sdio_reset_comm():

<4>[ 315.919291] dhdsdio_write_vars: Download, Upload and compare of NVRAM succeeded.

<6>[ 316.000696] wake enabled for irq 164

<4>[ 316.014714] wifi_get_mac_addr

<4>[ 316.022877] Firmware up: op_mode=1, Broadcom Dongle Host Driver mac=b4:07:f9:29:13:09

<4>[ 316.049481] Firmware version = wl0: Apr 11 2012 15:30:54 version 4.218.248.42

(b4:07:f9:29:13:09 is my wifi mac address)

Starting badadroid with wifi and bluetooth activated shows a mixture of both logs

Searching where badadroid starts bluetooth, I think it is in /init.wave.rc and /init.rc

# permissions for bluetooth.

chown bluetooth bluetooth /dev/s3c2410_serial0

chmod 0600 /dev/s3c2410_serial0

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

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

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

service hciattach /system/bin/brcm_patchram_plus --enable_hci --enable_lpm \

--baudrate 3000000 --patchram /vendor/firmware/bcm4329.hcd /dev/s3c2410_serial0

class main

user bluetooth

group bluetooth net_bt_admin

disabled

oneshot

service bluetoothd /system/bin/bluetoothd -n

class main

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 bluetoothd drop uid to bluetooth with the right linux capabilities

group bluetooth net_bt_admin misc

disabled

rfkill is a linux command that allows start/stop radio (wifi, bluetooth)

Googling, I found that rfkill has some files and could be used to start/stop/query radio

http://m8-android-kernel.googlecode.com/svn/trunk/Documentation/rfkill.txt

Looking in sys/class/rfkill just after badadroid start without bluetooth activated

lrwxrwxrwx root root 2013-05-05 19:45 rfkill0 -> ../../devices/platform/bt_rfkill/rfkill/rfkill0

lrwxrwxrwx root root 2013-05-05 19:45 rfkill1 -> ../../devices/platform/s3c-sdhci.1/mmc_host/mmc1/mmc1:0001/mmc1:0001:2/ieee80211/phy0/rfkill1

lrwxrwxrwx root root 2013-05-05 19:45 rfkill2 -> ../../devices/platform/s3c-sdhci.1/mmc_host/mmc1/mmc1:0001/mmc1:0001:2/rfkill/rfkill2

lrwxrwxrwx root root 2013-05-05 19:45 rfkill3 -> ../../devices/platform/s5pv210-uart.0/tty/s3c2410_serial0/hci0/rfkill3

After bluetooth start and stop, it changes

lrwxrwxrwx root root 2013-05-05 19:49 rfkill0 -> ../../devices/platform/bt_rfkill/rfkill/rfkill0

lrwxrwxrwx root root 2013-05-05 19:49 rfkill1 -> ../../devices/platform/s3c-sdhci.1/mmc_host/mmc1/mmc1:0001/mmc1:0001:2/ieee80211/phy0/rfkill1

lrwxrwxrwx root root 2013-05-05 19:49 rfkill2 -> ../../devices/platform/s3c-sdhci.1/mmc_host/mmc1/mmc1:0001/mmc1:0001:2/rfkill/rfkill2

lrwxrwxrwx root root 2013-05-05 19:49 rfkill4 -> ../../devices/platform/s5pv210-uart.0/tty/s3c2410_serial0/hci0/rfkill4

How to get more logs/info about the reason process are ending ?

Maybe some extra/special rfkill instruction has to be done in wave 2 to activate hardware? If there a way that some wave 2 user tries something similar to linux rfkill command to see if that activates bluetooth hardware?

Edit1:

After some search, more logs adding "-d" (debug) parameter to bluetoothd and brcm_patchram_plus.c in init.rc and init.wave.rc according to

http://code.google.com/p/broadcom-bluetooth/source/browse/brcm_patchram_plus.c

http://manpages.ubuntu.com/manpages/lucid/man8/bluetoothd.8.html

But I don't know how to do it, because they are in /, a readonly filesystem, and I am not able to edit with vi.

If I run that manually (I assume I get error as I have already that process running)

/system/bin/bluetoothd[B] -d [/B]-n
bluetoothd[1355]: Bluetooth deamon 4.93
bluetoothd[1355]: external/bluetooth/bluez/src/main.c:parse_config() parsing main.conf
bluetoothd[1355]: external/bluetooth/bluez/src/main.c:parse_config() discovto=120
bluetoothd[1355]: external/bluetooth/bluez/src/main.c:parse_config() pairto=0
bluetoothd[1355]: external/bluetooth/bluez/src/main.c:parse_config() pageto=8192
bluetoothd[1355]: external/bluetooth/bluez/src/main.c:parse_config() name=%m
bluetoothd[1355]: external/bluetooth/bluez/src/main.c:parse_config() class=0x40020C
bluetoothd[1355]: external/bluetooth/bluez/src/main.c:parse_config() discov_interval=30
bluetoothd[1355]: external/bluetooth/bluez/src/main.c:parse_config() deviceid=android:generic:1.5
bluetoothd[1355]: external/bluetooth/bluez/src/main.c:parse_config() default_link_policy=7
bluetoothd[1355]: Unable to get on D-Bus

It seems to parse /etc/bluetooth/main.conf

/system/bin/brcm_patchram_plus -d --enable_hci --enable_lpm --baudrate 3000000 --patchram /vendor/firmware/bcm4329.hcd /dev/s3c2410_serial0...

That provides more logs in logcat, not in dmesg

D/brcm_patchram_plus( 1505): option enable_hci
D/brcm_patchram_plus( 1505):
D/brcm_patchram_plus( 1505): option enable_lpm
D/brcm_patchram_plus( 1505):
D/brcm_patchram_plus( 1505): option baudrate
D/brcm_patchram_plus( 1505): with arg 3000000
D/brcm_patchram_plus( 1505):
D/brcm_patchram_plus( 1505): option patchram
D/brcm_patchram_plus( 1505): with arg /vendor/firmware/bcm4329.hcd
D/brcm_patchram_plus( 1505):
D/brcm_patchram_plus( 1505): /dev/s3c2410_serial
E/brcm_patchram_plus( 1505): port /dev/s3c2410_serial could not be opened, error 2

After that, I looked into previous logcat from Ravariya (I was thinking that errors will be just in dmesg)

I/bluedroid( 336): Starting hciattach daemon
D/BluetoothMasReceiver( 955): Bluetooth STATE CHANGED to 11
E/brcm_patchram_plus( 395): [B]open(/data/bdaddr) failed: No such file or directory (2)[/B]
...
E/brcm_patchram_plus( 968): Done setting line discpline
W/bluedroid( 336): Bluetoothd already started, unexpectedly!
I/bluedroid( 336): Starting bluetoothd deamon
...
E/bluetooth_common.cpp( 336): dbus_func_args_timeout_valist: D-Bus error in AddReservedServiceRecords: org.freedesktop.DBus.Error.ServiceUnknown (The name org.bluez was not provided by any .service files)
E/BluetoothService.cpp( 336): setBluetoothTetheringNative true
E/bluetooth_common.cpp( 336): dbus_func_args_timeout_valist: D-Bus error in Register: org.freedesktop.DBus.Error.ServiceUnknown (The name org.bluez was not provided by any .service files)
I/backup_data_changed( 336): com.android.providers.settings
D/BluetoothAdapterStateMachine( 336): WarmUp process message: 101
D/BluetoothEventLoop( 336): Property Changed: Powered : true
D/BluetoothAdapterStateMachine( 336): WarmUp process message: 54
D/BluetoothEventLoop( 336): Property Changed: Pairable : true
D/BluetoothEventLoop( 336): Property Changed: Class : 524812
D/BluetoothEventLoop( 336): Property Changed: Pairable : true
D/BluetoothEventLoop( 336): Property Changed: Discoverable : false
D/BluetoothAdapterStateMachine( 336): WarmUp process message: 53
...
D/BluetoothAdapterStateMachine( 336): WarmUp process message: 104
E/BluetoothAdapterStateMachine( 336): Bluetooth adapter SDP failed to load
E/BluetoothService.cpp( 336): setBluetoothTetheringNative false
E/BluetoothEventLoop.cpp( 336): tearDownEventLoop: D-Bus error: org.bluez.Error.DoesNotExist (Does Not Exist)
I/bluedroid( 336): Stopping bluetoothd deamon
I/bluedroid( 336): Stopping hciattach deamon
D/BluetoothAdapterStateMachine( 336): Bluetooth state 11 -> 10
D/BluetoothAdapterStateMachine( 336): PowerOff process message: 101

The first error seems related with bdaddr, and I have found here http://code.google.com/p/broadcom-bluetooth/source/browse/brcm_patchram_plus.c this comment

** If the Android system property "ro.bt.bcm_bdaddr_path" is

** set, then the bd_addr will be read from this path.

** This is overridden by --bd_addr on the command line.

In my S8500

cat /data/bdaddr
D4:E8:B2:9E:39:DE

Just a possible test: check if it is possible create a file /data/bdaddr with similar content (a valid mac address), and check again logs for errors.