Building bluez lib in Android

597 views
Skip to first unread message

Magnus Falk

unread,
Aug 31, 2009, 7:59:28 PM8/31/09
to 0xlab-discuss
Hi,

I've been trying to get my pretty Apple bluetooth keyboard to work
with my new HTC Hero and found this post written by Erin:
http://i-miss-erin.blogspot.com/2009/06/android-bluetooth-introduction-part-i.html#comment-form

She seemed to know what she was talking about so I started pestering
her in the comment section about how to compile full bluetooth
support. Now, I'm not a total newbie when it comes to programming but
my C and Make skills aren't all that so I find myself having problems
with some of the steps that are probably obvious to you guys.

Okay, so I downloaded the source tree and built the whole thing. So
far so good. Step two though, not so good:

2. then start to build bluez hidd
$ cd $MYDROID/external/bluez
$ . ../../build/envsetup.sh
$ touch `find -name "*.c"`
$ cd utils/hidd
$ mm

Result:
make: Entering directory `/home/bugbear/prg/android/
mydroid'
target thumb C: hciattach <= /home/bugbear/prg/android/mydroid/
external/bluez/utils/tools/hciattach.c
/home/bugbear/prg/android/mydroid/external/bluez/utils/tools/
hciattach.c:1127: warning: missing initializer
/home/bugbear/prg/android/mydroid/external/bluez/utils/tools/
hciattach.c:1127: warning: (near initialization for 'uart[24].p_id')
target thumb C: hciattach <= /home/bugbear/prg/android/mydroid/
external/bluez/utils/tools/hciattach_st.c
target thumb C: hciattach <= /home/bugbear/prg/android/mydroid/
external/bluez/utils/tools/hciattach_tialt.c
make: *** No rule to make target `out/target/product/generic/obj/lib/
libbluetooth.so', needed by `out/target/product/generic/obj/
EXECUTABLES/hciattach_intermediates/LINKED/hciattach'.
Stop.
make: Leaving directory `/home/bugbear/prg/android/mydroid'

This last solution by Erin didn't mention the Android.mk that was in
the old forum post she first linked to (http://groups.google.com/group/
android-platform/browse_thread/thread/73eed70fb229d7ae?pli=1), so at
first I renamed it so that it wouldn't run. But when the first tip
didn't work I tried putting it back with the following result:

make: Entering directory `/home/bugbear/prg/android/mydroid'
/home/bugbear/prg/android/mydroid/external/bluez/utils/hidd/Android.mk:
10: *** commands commence before first target. Stop.
make: Leaving directory `/home/bugbear/prg/android/mydroid'

Not one of those stupid tab-things since I removed all spaces from the
file at least.

I've resynced the repo now and am doing a full rebuild to see if it
gets better but in the meantime I would love to get an idea about what
I'm doing so that I can explain to others in more layman's terms how
to get bluetooth fully working on an Android phone. Because none of
the commands in step two make any sense to me, why am I creating the
*.c files for instance?

I have a question over at superuser.com and would love to be able to
give a better answer: http://superuser.com/questions/19744/pairing-apple-wireless-keyboard-with-android

Erin Yueh

unread,
Aug 31, 2009, 10:19:54 PM8/31/09
to 0xlab-...@googlegroups.com
Hi Magnus,

On Tue, Sep 1, 2009 at 07:59, Magnus Falk<magnu...@gmail.com> wrote:
>
> Hi,
>
> I've been trying to get my pretty Apple bluetooth keyboard to work
> with my new HTC Hero and found this post written by Erin:

[....]


> make: *** No rule to make target `out/target/product/generic/obj/lib/
> libbluetooth.so', needed by `out/target/product/generic/obj/
> EXECUTABLES/hciattach_intermediates/LINKED/hciattach'.
> Stop.
> make: Leaving directory `/home/bugbear/prg/android/mydroid'
>

It seems like you didn't build bluetooth library before you build
hidd. I wrote my comments about doing two things, one is to build all
libraries for Android and the other is to build hidd only. I forgot to
mention one more thing. I added "BOARD_HAVE_BLUETOOTH := true" one
line in BoardConfig.mk file. It would allow you to rebuild bluetooth
related library when you type 'make'.

> This last solution by Erin didn't mention the Android.mk that was in
> the old forum post she first linked to (http://groups.google.com/group/
> android-platform/browse_thread/thread/73eed70fb229d7ae?pli=1), so at
> first I renamed it so that it wouldn't run. But when the first tip
> didn't work I tried putting it back with the following result:
>
> make: Entering directory `/home/bugbear/prg/android/mydroid'
> /home/bugbear/prg/android/mydroid/external/bluez/utils/hidd/Android.mk:
> 10: *** commands commence before first target.  Stop.
> make: Leaving directory `/home/bugbear/prg/android/mydroid'
>

Android.mk file is like Makefile in native C environment. If Android
build system see this file in a folder, it would read this file and
build library or binary files for it. If you have problem on building
it and don't know what is wrong, you can remove/delete this file from
this folder. Then you should be able to build other stuff and wont get
stuck from this file.

> Not one of those stupid tab-things since I removed all spaces from the
> file at least.
>
> I've resynced the repo now and am doing a full rebuild to see if it
> gets better but in the meantime I would love to get an idea about what
> I'm doing so that I can explain to others in more layman's terms how
> to get bluetooth fully working on an Android phone. Because none of
> the commands in step two make any sense to me, why am I creating the
> *.c files for instance?
>

It's not easy to understand Android build system and also not easy to
build library for normal users, non-developers. You need to study
related documents from Android website. If you still have interests to
build bluetooth library, then you can send your problem on this
mailing list, I am glad to help you.

Regards,
Erin Yueh
http://0xlab.org

>[...]

Julian Chu

unread,
Aug 31, 2009, 10:23:04 PM8/31/09
to 0xlab-...@googlegroups.com
seems you have to build libbluetooth.so first?

walkingice@walkingice:~/code/zeroxdroid/external/bluez$ source ../../build/envsetup.sh
walkingice@walkingice:~/code/zeroxdroid/external/bluez$ cd libs/
walkingice@walkingice:~/code/zeroxdroid/external/bluez/libs$ mm -b  #-b means force rebuild
make: Entering directory `/home/walkingice/code/zeroxdroid'
build/core/product_config.mk:261: WARNING: adding test OTA key
============================================
TARGET_PRODUCT=beagleboard
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=
============================================
target thumb C: libbluetooth <= /home/walkingice/code/zeroxdroid/external/bluez/libs/src/bluetooth.c
target thumb C: libbluetooth <= /home/walkingice/code/zeroxdroid/external/bluez/libs/src/sdp.c
(...skip...)
target SharedLib: libbluetooth (out/target/product/beagleboard/obj/SHARED_LIBRARIES/libbluetooth_intermediates/LINKED/libbluetooth.so)
target Prelink: libbluetooth (out/target/product/beagleboard/symbols/system/lib/libbluetooth.so)
libelfcopy: Warning: Range lists in .debug_info section aren't in ascending order!
libelfcopy: Warning: Range lists in .debug_ranges section start at 0x40
libelfcopy: Warning: There is an overlap [0x48 - 0x0] in .debug_ranges section.
libelfcopy: Warning: There is a hole [0x40 - 0xd90] in .debug_ranges section.
libelfcopy: Warning: There is an overlap [0xd98 - 0xc8] in .debug_ranges section.
libelfcopy: Warning: There is a hole [0xd90 - 0x12f0] in .debug_ranges section.
libelfcopy: Warning: There is an overlap [0x12f8 - 0x1140] in .debug_ranges section.
target Strip: libbluetooth (out/target/product/beagleboard/obj/lib/libbluetooth.so)
Notice file: /home/walkingice/code/zeroxdroid/external/bluez/libs/NOTICE -- out/target/product/beagleboard/obj/NOTICE_FILES/src//system/lib/libbluetooth.so.txt
Install: out/target/product/beagleboard/system/lib/libbluetooth.so
Finding NOTICE files: out/target/product/beagleboard/obj/NOTICE_FILES/hash-timestamp
Combining NOTICE files: out/target/product/beagleboard/obj/NOTICE.html
gzip -c out/target/product/beagleboard/obj/NOTICE.html > out/target/product/beagleboard/obj/NOTICE.html.gz
make: Leaving directory `/home/walkingice/code/zeroxdroid'


walkingice@walkingice:~/code/zeroxdroid/external/bluez/utils/hidd$ mm
make: Entering directory `/home/walkingice/code/zeroxdroid'
build/core/product_config.mk:261: WARNING: adding test OTA key
============================================
TARGET_PRODUCT=beagleboard
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=
============================================
target thumb C: attest <= /home/walkingice/code/zeroxdroid/external/bluez/utils/test/attest.c
target Executable: attest (out/target/product/beagleboard/obj/EXECUTABLES/attest_intermediates/LINKED/attest)
target Non-prelinked: attest (out/target/product/beagleboard/symbols/system/bin/attest)
(...skip...)
libelfcopy: Warning: There is a hole [0x3148 - 0x31f0] in .debug_ranges section.
libelfcopy: Warning: There is an overlap [0x31f8 - 0x31a8] in .debug_ranges section.
target Strip: liba2dp (out/target/product/beagleboard/obj/lib/liba2dp.so)
Install: out/target/product/beagleboard/system/bin/hciattach
Install: out/target/product/beagleboard/system/lib/libhcid.so
Install: out/target/product/beagleboard/system/bin/hcid
Install: out/target/product/beagleboard/system/bin/sdptool
Install: out/target/product/beagleboard/system/lib/bluez-plugin/audio.so
Install: out/target/product/beagleboard/system/lib/bluez-plugin/input.so
Install: out/target/product/beagleboard/system/lib/liba2dp.so
Install: out/target/product/beagleboard/system/xbin/attest
Install: out/target/product/beagleboard/system/xbin/auth-agent
Install: out/target/product/beagleboard/system/xbin/avinfo
Install: out/target/product/beagleboard/system/xbin/dund
Install: out/target/product/beagleboard/system/xbin/hciconfig
Install: out/target/product/beagleboard/system/xbin/hcitool
Install: out/target/product/beagleboard/system/xbin/hstest
Install: out/target/product/beagleboard/system/xbin/l2ping
Install: out/target/product/beagleboard/system/xbin/l2test
Install: out/target/product/beagleboard/system/xbin/pand
Install: out/target/product/beagleboard/system/xbin/passkey-agent
Install: out/target/product/beagleboard/system/xbin/rctest
Install: out/target/product/beagleboard/system/xbin/rfcomm
Install: out/target/product/beagleboard/system/xbin/scotest
Finding NOTICE files: out/target/product/beagleboard/obj/NOTICE_FILES/hash-timestamp
Combining NOTICE files: out/target/product/beagleboard/obj/NOTICE.html
gzip -c out/target/product/beagleboard/obj/NOTICE.html > out/target/product/beagleboard/obj/NOTICE.html.gz
make: Leaving directory `/home/walkingice/code/zeroxdroid'
walkingice@walkingice:~/code/zeroxdroid/external/bluez/utils/hidd$

--
Julian Chu.  a.k.a. WalkingIce -- 會走路的冰塊
http://walkingice.twbbs.org  只放拖鞋的鞋櫃

Magnus Falk

unread,
Sep 1, 2009, 8:53:30 PM9/1/09
to 0xlab-discuss
Okay, thanks to Julians tip about how to build libbluetooth I made
some progress, but it still won't build the hidd binary.

bugbear@Tiny:~/prg/android/mydroid/$ ls out/target/product/generic/
system/xbin/
add-property-tag check-lost+found dbus-send hstest nc
pand rctest showslab tcpdump
attest cpueater dexdump l2ping netperf
passkey-agent rfcomm sqlite3 timeinfo
auth-agent crasher dund l2test netserver
procmem scotest ssh
avinfo daemonize hciconfig latencytop opcontrol
procrank scp strace
btool dbus-monitor hcitool librank oprofiled
rawbu showmap su

It seems to buildall the bluez utils _except_ hidd, even though I run
make from inside the hidd dir. When I look inside the Makefile.am in
the hidd dir there seems to be some sort of condition:

if HIDD
bin_PROGRAMS = hidd

Do I need to set this condition somewhere or should it just work? I
added the 'BOARD_HAVE_BLUETOOTH := true' to the generic board type
config, but it made no difference.

Suggestions as to what I'm doing wrong?

Cheers,
Magnus

On Sep 1, 4:23 am, Julian Chu <walking...@0xlab.org> wrote:
> On Tue, Sep 1, 2009 at 7:59 AM, Magnus Falk <magnus.f...@gmail.com> wrote:
>
> > Hi,
>
> > I've been trying to get my pretty Apple bluetooth keyboard to work
> > with my new HTC Hero and found this post written by Erin:
>
> >http://i-miss-erin.blogspot.com/2009/06/android-bluetooth-introductio...
> (out/target/product/beagleboard/obj/SHARED_LIBRARIES/libbluetooth_intermedi-ates/LINKED/libbluetooth.so)
> target Prelink: libbluetooth
> (out/target/product/beagleboard/symbols/system/lib/libbluetooth.so)
> libelfcopy: Warning: Range lists in .debug_info section aren't in ascending
> order!
> libelfcopy: Warning: Range lists in .debug_ranges section start at 0x40
> libelfcopy: Warning: There is an overlap [0x48 - 0x0] in .debug_ranges
> section.
> libelfcopy: Warning: There is a hole [0x40 - 0xd90] in .debug_ranges
> section.
> libelfcopy: Warning: There is an overlap [0xd98 - 0xc8] in .debug_ranges
> section.
> libelfcopy: Warning: There is a hole [0xd90 - 0x12f0] in .debug_ranges
> section.
> libelfcopy: Warning: There is an overlap [0x12f8 - 0x1140] in .debug_ranges
> section.
> target Strip: libbluetooth
> (out/target/product/beagleboard/obj/lib/libbluetooth.so)
> Notice file: /home/walkingice/code/zeroxdroid/external/bluez/libs/NOTICE --
> out/target/product/beagleboard/obj/NOTICE_FILES/src//system/lib/libbluetoot-h.so.txt
> *Install: out/target/product/beagleboard/system/lib/libbluetooth.so*
> Finding NOTICE files:
> out/target/product/beagleboard/obj/NOTICE_FILES/hash-timestamp
> Combining NOTICE files: out/target/product/beagleboard/obj/NOTICE.html
> gzip -c out/target/product/beagleboard/obj/NOTICE.html >
> out/target/product/beagleboard/obj/NOTICE.html.gz
> make: Leaving directory `/home/walkingice/code/zeroxdroid'
>
> walkingice@walkingice:~/code/zeroxdroid/external/bluez/utils/hidd$ mm
> make: Entering directory `/home/walkingice/code/zeroxdroid'
> build/core/product_config.mk:261: WARNING: adding test OTA key
> ============================================
> TARGET_PRODUCT=beagleboard
> TARGET_BUILD_VARIANT=eng
> TARGET_SIMULATOR=
> TARGET_BUILD_TYPE=release
> TARGET_ARCH=arm
> HOST_ARCH=x86
> HOST_OS=linux
> HOST_BUILD_TYPE=release
> BUILD_ID=
> ============================================
> target thumb C: attest <=
> /home/walkingice/code/zeroxdroid/external/bluez/utils/test/attest.c
> target Executable: attest
> (out/target/product/beagleboard/obj/EXECUTABLES/attest_intermediates/LINKED-/attest)

Erin Yueh

unread,
Sep 1, 2009, 9:53:10 PM9/1/09
to 0xlab-...@googlegroups.com
Hi,

2009/9/2 Magnus Falk <magnu...@gmail.com>:


>
> Okay, thanks to Julians tip about how to build libbluetooth I made
> some progress, but it still won't build the hidd binary.
>
> bugbear@Tiny:~/prg/android/mydroid/$ ls out/target/product/generic/
> system/xbin/
> add-property-tag  check-lost+found  dbus-send  hstest      nc
> pand           rctest   showslab  tcpdump
> attest            cpueater          dexdump    l2ping      netperf
> passkey-agent  rfcomm   sqlite3   timeinfo
> auth-agent        crasher           dund       l2test      netserver
> procmem        scotest  ssh
> avinfo            daemonize         hciconfig  latencytop  opcontrol
> procrank       scp      strace
> btool             dbus-monitor      hcitool    librank     oprofiled
> rawbu          showmap  su
>
> It seems to buildall the bluez utils _except_ hidd, even though I run
> make from inside the hidd dir. When I look inside the Makefile.am in
> the hidd dir there seems to be some sort of condition:
>

Good! you made the first step and it's only libbluetooth. Now, you can
make bluez utils.
You can type mm with -b (force rebuild) or touch all related *.c files
like what i do. Touch *.c files and it would change the file modified
time. When you build from source code, it will check the modified
time.

erin@daydreamer:~/android/mydroid_G1/external/bluez$ cd utils/
erin@daydreamer:~/android/mydroid_G1/external/bluez/utils$ touch `find
-name *.c`
erin@daydreamer:~/android/mydroid_G1/external/bluez/utils$ mm
make: Entering directory `/home/erin/android/mydroid_G1'


build/core/product_config.mk:261: WARNING: adding test OTA key
============================================

TARGET_PRODUCT=htc_dream


TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=
============================================

No private recovery resources for TARGET_DEVICE dream


target thumb C: attest <=

/home/erin/android/mydroid_G1/external/bluez/utils/test/attest.c
target Executable: attest
(out/target/product/dream/obj/EXECUTABLES/attest_intermediates/LINKED/attest)
target Non-prelinked: attest
(out/target/product/dream/symbols/system/bin/attest)
target Strip: attest
(out/target/product/dream/obj/EXECUTABLES/attest_intermediates/attest)
target thumb C: auth-agent <=
/home/erin/android/mydroid_G1/external/bluez/utils/test/auth-agent.c
target Executable: auth-agent
(out/target/product/dream/obj/EXECUTABLES/auth-agent_intermediates/LINKED/auth-agent)
target Non-prelinked: auth-agent
(out/target/product/dream/symbols/system/bin/auth-agent)
target Strip: auth-agent
(out/target/product/dream/obj/EXECUTABLES/auth-agent_intermediates/auth-agent)
[...]
Install: out/target/product/dream/system/bin/hciattach
Install: out/target/product/dream/system/lib/libhcid.so
Install: out/target/product/dream/system/bin/hcid
Install: out/target/product/dream/system/bin/sdptool
Install: out/target/product/dream/system/lib/bluez-plugin/audio.so
Install: out/target/product/dream/system/lib/bluez-plugin/input.so
Install: out/target/product/dream/system/lib/liba2dp.so
Install: out/target/product/dream/system/xbin/attest
Install: out/target/product/dream/system/xbin/auth-agent
Install: out/target/product/dream/system/xbin/avinfo
Install: out/target/product/dream/system/xbin/dund
Install: out/target/product/dream/system/xbin/hciconfig
Install: out/target/product/dream/system/xbin/hcitool
Install: out/target/product/dream/system/xbin/hidd
Install: out/target/product/dream/system/xbin/hstest
Install: out/target/product/dream/system/xbin/l2ping
Install: out/target/product/dream/system/xbin/l2test
Install: out/target/product/dream/system/xbin/pand
Install: out/target/product/dream/system/xbin/passkey-agent
Install: out/target/product/dream/system/xbin/rctest
Install: out/target/product/dream/system/xbin/rfcomm
Install: out/target/product/dream/system/xbin/scotest
Finding NOTICE files: out/target/product/dream/obj/NOTICE_FILES/hash-timestamp
Combining NOTICE files: out/target/product/dream/obj/NOTICE.html
gzip -c out/target/product/dream/obj/NOTICE.html >
out/target/product/dream/obj/NOTICE.html.gz
make: Leaving directory `/home/erin/android/mydroid_G1'

If you still cannot find hidd, check this Android.mk file. It should
look like as below:
erin@daydreamer:~/android/mydroid_G1/external/bluez/utils$ cat hidd/Android.mk
LOCAL_PATH:= $(call my-dir)

#
# hidd
#

include $(CLEAR_VARS)

LOCAL_SRC_FILES:= \
main.c \
sdp.c \
fakehid.c

LOCAL_CFLAGS:= \
-DVERSION=\"3.36\" \
-DSTORAGEDIR=\"/tmp\" \
-DNEED_PPOLL

LOCAL_C_INCLUDES:= \
$(call include-path-for, bluez-libs) \
$(call include-path-for, bluez-utils)/common

LOCAL_SHARED_LIBRARIES := \
libbluetooth

LOCAL_STATIC_LIBRARIES := \
libbluez-utils-common-static

LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_MODULE_TAGS := eng
LOCAL_MODULE:=hidd

include $(BUILD_EXECUTABLE)

Magnus Falk

unread,
Sep 2, 2009, 3:21:00 AM9/2/09
to 0xlab-...@googlegroups.com
Oooh, sweet trick with the touching Erin! Hadn't thought about that!

One more question though: it seems like you're building the htc_dream target, while I'm building the generic target. How do I change that? Or doesn't it matter in this case?

And oh, when I copied the the Android makefile once again it worked. Seems like it was stupid of me to switch all the spaces to tabs in the first place. Now remember why I hate make... =P

The pushing of the hidd binary to the phone didn't work though, but I guess that's just a matter of mounting it properly and I think I remember seeing such instructions in the tutorial I used to gain root access:

failed to copy 'out/target/product/generic/system/xbin/hidd' to '/system/bin/hidd': Read-only file system

Well, gotta run off to work, I'll dig into it tonight.

Thanks a lot for you help and patience guys, especially Erin!

Cheers,
Magnus

Erin Yueh

unread,
Sep 2, 2009, 5:07:24 AM9/2/09
to 0xlab-...@googlegroups.com
Hi!
almost last mile.... :)

On Wed, Sep 2, 2009 at 15:21, Magnus Falk<magnu...@gmail.com> wrote:
> Oooh, sweet trick with the touching Erin! Hadn't thought about that!
>
> One more question though: it seems like you're building the htc_dream
> target, while I'm building the generic target. How do I change that? Or
> doesn't it matter in this case?

it doesn't matter in this case. Both of them are built for arm
machines. You can use this command to check what version it is.
erin@daydreamer:~/android/mydroid_G1/out/target/product/dream/system/xbin$
file hidd
hidd: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically
linked (uses shared libs), stripped
If you'd like to change the target to G1 (htc_dream), you could read
this document in Android site.
http://source.android.com/documentation/building-for-dream

> And oh, when I copied the the Android makefile once again it worked. Seems
> like it was stupid of me to switch all the spaces to tabs in the first
> place. Now remember why I hate make... =P
> The pushing of the hidd binary to the phone didn't work though, but I guess
> that's just a matter of mounting it properly and I think I remember seeing
> such instructions in the tutorial I used to gain root access:
> failed to copy 'out/target/product/generic/system/xbin/hidd' to
> '/system/bin/hidd': Read-only file system

yes, it's file system permission problem. Just try below commands in
your Android phone:
$ su
$ mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system

it would allow you upload hidd file to /system/xbin folder. If you
still cannot upload it, use 'chmod 777 /system' to modify folder
permission too.

After uploading hidd successfully, you could follow
"http://groups.google.com/group/android-platform/browse_thread/thread/73eed70fb229d7ae?pli=1"
this article (step from hcitool scan) to setup your bluetooth
keyboard.

I hope we can hear your good news soon!

Magnus Falk

unread,
Sep 2, 2009, 3:14:32 PM9/2/09
to 0xlab-discuss
> After uploading hidd successfully, you could follow
> "http://groups.google.com/group/android-platform/browse_thread/thread/..."
> this article (step from hcitool scan) to setup your bluetooth
> keyboard.
>
> I hope we can hear your good news soon!
>
> Regards,
> Erin Yuehhttp://0xlab.org

Okay, almost there now =)

# hcitool scan
Device is not available: No such device

# hcitool dev
Devices:

The problem seems to be that there is no bluetooth device running. I
tried the following, but no luck:

# hciconfig hci0
Can't get device info: No such device

I also tried rebooting the phone, but it didn't work either. It seems
to me that I'm missing something fundamental... Oh yeah, Bluetooth is
actually switched on, I doublechecked =P

Any guesses?

Cheers,
Magnus

Erin Yueh

unread,
Sep 2, 2009, 11:18:11 PM9/2/09
to 0xlab-...@googlegroups.com
Hi,
On Thu, Sep 3, 2009 at 03:14, Magnus Falk<magnu...@gmail.com> wrote:
[...]

>
> I also tried rebooting the phone, but it didn't work either. It seems
> to me that I'm missing something fundamental... Oh yeah, Bluetooth is
> actually switched on, I doublechecked =P
>
Let's verify bluetooth functions from UI first. Turn BT on from
Settings menu, then...

1. check running process: we can see these three lines as below
$ su
# ps
bluetooth 36 1 1180 744 c00ad64c afe0d25c S /system/bin/dbus-daemon
bluetooth 81 1 744 328 c00ad64c afe0d25c S /system/bin/hciattach
bluetooth 106 1 1608 1016 c00ad64c afe0d25c S /system/bin/hcid

2. run hciconfig, it would tell us bluetooth device detailed information
# hciconfig -a
hci0: Type: UART
BD Address: 00:22:A5:B8:AD:65 ACL MTU: 1021:4 SCO MTU: 180:4
UP RUNNING PSCAN
RX bytes:2333 acl:9 sco:0 events:60 errors:0
TX bytes:697 acl:8 sco:0 commands:35 errors:0
Features: 0xff 0xff 0x2d 0xfe 0x9b 0xf9 0x00 0x80
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF PARK
Link mode: SLAVE ACCEPT
Name: 'Android Dev Phone 1'
Class: 0x48020c
Service Classes: Capturing, Telephony
Device Class: Phone, Smart phone
HCI Ver: 2.0 (0x3) HCI Rev: 0x0 LMP Ver: 2.0 (0x3) LMP Subver: 0x1126
Manufacturer: Texas Instruments Inc. (13)

3. From Android Setting UI, click 'Scan for devices', when you see
your Apple Wireless Keyboard, click it and pair with it.

4. After you see 'Paired but not connected' in your keyboard. Go back
to terminal, run hcitool to scan nearby devices,
# hcitool scan
Scanning ...
00:1D:4F:A7:9A:49 Apple Wireless Keyboard
00:22:43:C6:5B:B9 daydreamer-0
00:18:C5:42:18:78 Erin-Nokia N73
00:10:60:D0:00:14 SPEED

# hidd --connect 00:1D:4F:A7:9A:49
# hcitool con
Connections:
< ACL 00:1D:4F:A7:9A:49 handle 1 state 1 lm MASTER

5. DONE! you should be able to use your Apple Wireless Keyboard!

Cheers,
Erin Yueh
http://0xlab.org

Magnus Falk

unread,
Sep 3, 2009, 1:02:09 PM9/3/09
to 0xlab-discuss

> 1. check running process: we can see these three lines as below
> $ su
> # ps
> bluetooth 36    1     1180  744   c00ad64c afe0d25c S /system/bin/dbus-daemon
> bluetooth 81    1     744   328   c00ad64c afe0d25c S /system/bin/hciattach
> bluetooth 106   1     1608  1016  c00ad64c afe0d25c S /system/bin/hcid

Bleh, on my phone, only the dbus-daemon shows up. Some searching
turned up how to start the other two, but it didn't seem to help,
hcitool -a just got me a blank line and hcitool scan the same old
"Device is not available: No such device".

Is there an rc-file with settings somewhere I need to edit for the
hciattach and hcid daemons to be running?

Cheers,
Magnus

Erin Yueh

unread,
Sep 3, 2009, 10:33:49 PM9/3/09
to 0xlab-...@googlegroups.com
Hi!

On Fri, Sep 4, 2009 at 01:02, Magnus Falk<magnu...@gmail.com> wrote:
>
[...]

> Bleh, on my phone, only the dbus-daemon shows up. Some searching
> turned up how to start the other two, but it didn't seem to help,
> hcitool -a just got me a blank line and hcitool scan the same old
> "Device is not available: No such device".
>
> Is there an rc-file with settings somewhere I need to edit for the
> hciattach and hcid daemons to be running?
>

mmh....check *.rc files in "/" folder in Android. Did you see
Bluetooth ON in Settings menu? If we turn it one, it would start to
run other two processes. At least, it's the normal procedure in G1.
Except, HERO is not using native bluez library.

I mentioned bluetooth initialize in Android on my blog before,
http://i-miss-erin.blogspot.com/2009/06/android-bluetooth-introduction-part-i.html
http://i-miss-erin.blogspot.com/2009/05/few-notes-for-android-bluetooth.html

actually, you don't need to edit *.rc files, Settings application
would check Bluetooth value and decide whether it should run hcid or
not.

could you please cat your *.rc files and use ps to list all running
processes in your Android? then we could understand HERO more here.

Magnus Falk

unread,
Sep 4, 2009, 4:12:16 AM9/4/09
to 0xlab-...@googlegroups.com
Yep, Bluetooth i definitely on in the menu. But it doesn't seem like it starts any additional processes. Here's a ps after I started bluetooth:

# ps
USER PID PPID VSIZE RSS WCHAN PC NAME
root 1 0 292 204 c00be9b0 0000c79c S /init
root 2 0 0 0 c0071064 00000000 S kthreadd
root 3 2 0 0 c0061740 00000000 S ksoftirqd/0
root 4 2 0 0 c0086354 00000000 S watchdog/0
root 5 2 0 0 c006de64 00000000 S events/0
root 6 2 0 0 c006de64 00000000 S khelper
root 7 2 0 0 c006de64 00000000 S suspend
root 8 2 0 0 c006de64 00000000 S early_suspend
root 9 2 0 0 c006de64 00000000 S kblockd/0
root 10 2 0 0 c006de64 00000000 S kmmcd
root 11 2 0 0 c006de64 00000000 S btaddconn
root 12 2 0 0 c006de64 00000000 S btdelconn
root 13 2 0 0 c006de64 00000000 S kondemand/0
root 14 2 0 0 c006de64 00000000 S qmi
root 15 2 0 0 c0034460 00000000 D rpcrouter
root 16 2 0 0 c006de64 00000000 S detection/0
root 17 2 0 0 c0036628 00000000 S krpcserversd
root 18 2 0 0 c0092ea0 00000000 S pdflush
root 19 2 0 0 c0092ea0 00000000 S pdflush
root 20 2 0 0 c0097068 00000000 S kswapd0
root 21 2 0 0 c006de64 00000000 S aio/0
root 22 2 0 0 c006de64 00000000 S panel_on/0
root 23 2 0 0 c006de64 00000000 S cabc_work_q
root 24 2 0 0 c0034e24 00000000 S kadspd
root 25 2 0 0 c019fb74 00000000 S mtdblockd
root 26 2 0 0 c01a6640 00000000 S USB mass_storag
root 27 2 0 0 c006de64 00000000 S synaptics_wq
root 29 2 0 0 c006de64 00000000 S kstriped
root 30 2 0 0 c026cc40 00000000 S krfcommd
root 31 2 0 0 c01dcb84 00000000 S mmcqd
system 32 1 808 268 c018fa2c afe0c45c S /system/bin/servicemanager
root 33 1 852 404 c00befd4 afe0c584 S /system/bin/vold
root 34 1 668 268 c01f2cf8 afe0cdec S /system/bin/debuggerd
radio 35 1 11076 1160 ffffffff afe0cacc S /system/bin/rild
root 36 1 72644 21676 c00befd4 afe0c584 S zygote
media 37 1 28228 4368 ffffffff afe0c45c S /system/bin/mediaserver
bluetooth 38 1 1188 752 c00be9b0 afe0d25c S /system/bin/dbus-daemon
root 39 1 800 308 c0258b10 afe0c1bc S /system/bin/installd
compass 41 1 1196 580 c01bf7d0 afe0c45c S /system/bin/akm8973
shell 43 1 3328 160 ffffffff 0000e8f4 S /sbin/adbd
root 59 2 0 0 c0034c38 00000000 D snd_rpc
system 62 36 202552 32432 ffffffff afe0c45c S system_server
root 78 2 0 0 c0034c38 00000000 D audmgr_rpc
misc 101 36 131348 24196 ffffffff afe0d3e4 S android.process.acore
radio 106 36 116564 21036 ffffffff afe0d3e4 S com.android.phone
nobody 115 36 253876 46484 ffffffff afe0d3e4 S com.htc.launcher
app_28 146 36 96184 13656 ffffffff afe0d3e4 S com.htc.socialnetwork.provider
app_11 165 36 106200 16556 ffffffff afe0d3e4 S com.google.process.gapps
app_47 208 36 98016 14852 ffffffff afe0d3e4 S com.android.mms
app_29 216 36 99956 14848 ffffffff afe0d3e4 S android.process.media
app_42 227 36 109612 17488 ffffffff afe0d3e4 S com.htc.android.htcime
app_44 238 36 93404 14372 ffffffff afe0d3e4 S com.htc.htctwitter
app_33 247 36 93128 12656 ffffffff afe0d3e4 S com.htc.provider.weather
app_37 256 36 93620 13428 ffffffff afe0d3e4 S com.htc.android.worldclock
app_32 262 36 95688 15628 ffffffff afe0d3e4 S com.htc.android.psclient
app_18 271 36 98292 13948 ffffffff afe0d3e4 S com.htc.dcs
app_20 280 36 97648 14252 ffffffff afe0d3e4 S com.android.calendar
app_22 300 36 92720 13176 ffffffff afe0d3e4 S com.htc.providers.uploads
app_20 315 36 99216 13912 ffffffff afe0d3e4 S com.htc.calendar
app_12 324 36 101732 16328 ffffffff afe0d3e4 S com.htc.android.mail
app_5 326 36 101260 13948 ffffffff afe0d3e4 S com.android.browser
app_39 347 36 96916 14284 ffffffff afe0d3e4 S com.htc.music
app_35 353 36 92904 12116 ffffffff afe0d3e4 S com.htc.provider.settings
app_6 367 36 99148 11660 ffffffff afe0d3e4 S com.google.android.partnersetup
app_54 373 36 96260 17148 ffffffff afe0d3e4 S com.newsrob
app_41 384 36 103836 17012 ffffffff afe0d3e4 S com.google.android.apps.maps:FriendService
app_30 402 36 95492 13508 ffffffff afe0d3e4 S com.htc.album
app_10 410 36 95268 14428 ffffffff afe0d3e4 S com.htc.android.footprints
system 418 36 98968 13688 ffffffff afe0d3e4 S com.android.settings
app_40 428 36 93288 12540 ffffffff afe0d3e4 S com.google.android.gm
app_3 449 36 91920 12188 ffffffff afe0d3e4 S com.htc.htclocationservice
shell 516 43 740 332 c005efe8 afe0d08c S /system/bin/sh
root 517 516 740 332 c005efe8 afe0d08c S sh
root 526 1 7768 1564 ffffffff afe0d25c S /system/bin/bts
root 534 517 888 348 00000000 afe0c1bc R ps
#

# ls *.rc
init.goldfish.rc
init.hero.rc
init.rc
# cat init.rc

on init

sysclktz 0

loglevel 3

# setup the global environment
export PATH /sbin:/system/sbin:/system/bin:/system/xbin
export LD_LIBRARY_PATH /system/lib
export ANDROID_BOOTLOGO 1
export ANDROID_ROOT /system
export ANDROID_ASSETS /system/app
export ANDROID_DATA /data
export EXTERNAL_STORAGE /sdcard
export BOOTCLASSPATH /system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/com.htc.framework.jar:/system/framework/com.htc.android.pimlib.jar:/system/framework/com.scalado.util.ScaladoUtil.jar:/system/framework/com.htc.android.easopen.jar

# Backward compatibility
symlink /system/etc /etc

# create mountpoints and mount tmpfs on sqlite_stmt_journals
mkdir /sdcard 0000 system system
mkdir /system
mkdir /data 0771 system system
mkdir /cache 0770 system cache
mkdir /sqlite_stmt_journals 01777 root root
mount tmpfs tmpfs /sqlite_stmt_journals size=4m

mount rootfs rootfs / ro remount

write /proc/sys/kernel/panic_on_oops 1
write /proc/sys/kernel/hung_task_timeout_secs 0
write /proc/cpu/alignment 4
write /proc/sys/kernel/sched_latency_ns 10000000
write /proc/sys/kernel/sched_wakeup_granularity_ns 2000000
# enlarge unix socket buffer for BTIPS
write /proc/sys/net/unix/max_dgram_qlen 999

# mount mtd partitions
# Mount /system rw first to give the filesystem a chance to save a checkpoint
mount yaffs2 mtd@system /system
mount yaffs2 mtd@system /system ro remount

# We chown/chmod /data again so because mount is run as root + defaults
mount yaffs2 mtd@userdata /data nosuid nodev
chown system system /data
chmod 0771 /data

# Same reason as /data above
mount yaffs2 mtd@cache /cache nosuid nodev
chown system cache /cache
chmod 0770 /cache

# This may have been created by the recovery system with odd permissions
chown system system /cache/recovery
chmod 0770 /cache/recovery

# create basic filesystem structure
mkdir /data/misc 01771 system misc
mkdir /data/misc/hcid 0770 bluetooth bluetooth
mkdir /data/local 0771 shell shell
mkdir /data/local/tmp 0771 shell shell
mkdir /data/data 0771 system system
mkdir /data/app-private 0771 system system
mkdir /data/app 0771 system system
mkdir /data/property 0700 root root
# btips DDB location
mkdir /data/btips 0770 bluetooth bluetooth
mkdir /data/btips/TI 0770 bluetooth bluetooth
symlink /data/local /data/drm
mkdir /data/local/rights 0777 shell shell
chown shell shell /data/drm

# create dalvik-cache and double-check the perms
mkdir /data/dalvik-cache 0771 system system
chown system system /data/dalvik-cache
chmod 0771 /data/dalvik-cache

# create the lost+found directories, so as to enforce our permissions
mkdir /data/lost+found 0770
mkdir /cache/lost+found 0770

# double check the perms, in case lost+found already exists, and set owner
chown root root /data/lost+found
chmod 0770 /data/lost+found
chown root root /cache/lost+found
chmod 0770 /cache/lost+found

on boot
# basic network init
ifup lo
hostname localhost
domainname localdomain

# set RLIMIT_NICE to allow priorities from 19 to -20
setrlimit 13 40 40

# Set timeout value for rmnet stats.
write /sys/devices/virtual/net/rmnet0/timeout_suspend 5000000

# Define the oom_adj values for the classes of processes that can be
# killed by the kernel. These are used in ActivityManagerService.
setprop ro.FOREGROUND_APP_ADJ 0
setprop ro.VISIBLE_APP_ADJ 1
setprop ro.SECONDARY_SERVER_ADJ 2
setprop ro.HOME_APP_ADJ 4
setprop ro.HIDDEN_APP_MIN_ADJ 7
setprop ro.CONTENT_PROVIDER_ADJ 14
setprop ro.EMPTY_APP_ADJ 15

# Define the memory thresholds at which the above process classes will
# be killed. These numbers are in pages (4k).
setprop ro.FOREGROUND_APP_MEM 1536
setprop ro.VISIBLE_APP_MEM 2048
setprop ro.SECONDARY_SERVER_MEM 4096
setprop ro.HOME_APP_MEM 4096
setprop ro.HIDDEN_APP_MEM 5120
setprop ro.CONTENT_PROVIDER_MEM 5632
setprop ro.EMPTY_APP_MEM 6144

# Write value must be consistent with the above properties.
# Note that the driver only supports 6 slots, so we have HOME_APP at the
# same memory level as services.
write /sys/module/lowmemorykiller/parameters/adj 0,1,2,7,14,15

write /proc/sys/vm/overcommit_memory 1
write /proc/sys/vm/min_free_order_shift 4
write /sys/module/lowmemorykiller/parameters/minfree 1536,2048,4096,5120,5632,6144

# Set init its forked children's oom_adj.
write /proc/1/oom_adj -16
#ruu
write /sqlite_stmt_journals/screen_lock_status 0
write /sqlite_stmt_journals/pattern_lock_status 0
chown system system /sqlite_stmt_journals/screen_lock_status
chmod 644 /sqlite_stmt_journals/screen_lock_status
chown system system /sqlite_stmt_journals/pattern_lock_status
chmod 644 /sqlite_stmt_journals/pattern_lock_status

# Permissions for System Server and daemons.
chown radio system /sys/android_power/state
chown radio system /sys/android_power/request_state
chown radio system /sys/android_power/acquire_full_wake_lock
chown radio system /sys/android_power/acquire_partial_wake_lock
chown radio system /sys/android_power/release_wake_lock
chown radio system /sys/power/state
chown radio system /sys/power/wake_lock
chown radio system /sys/power/wake_unlock
chmod 0660 /sys/power/state
chmod 0660 /sys/power/wake_lock
chmod 0660 /sys/power/wake_unlock
chown system system /sys/class/timed_output/vibrator/enable
chown system system /sys/class/leds/keyboard-backlight/brightness
chown system system /sys/class/leds/lcd-backlight/brightness
chown system system /sys/class/leds/lcd-backlight/auto
chown system system /sys/class/leds/lcd-backlight/auto_brightness
chown system system /sys/class/leds/lcd-backlight/fade
chown system system /sys/class/leds/button-backlight/brightness
chown system system /sys/class/leds/jogball-backlight/brightness
chown system system /sys/class/leds/red/brightness
chown system system /sys/class/leds/green/brightness
chown system system /sys/class/leds/blue/brightness
chown system system /sys/class/leds/amber/brightness
chown system system /sys/class/leds/red/device/grpfreq
chown system system /sys/class/leds/red/device/grppwm
chown system system /sys/class/leds/red/device/blink
chown system system /sys/class/leds/green/blink
chown system system /sys/class/leds/green/off_timer
chown system system /sys/class/leds/amber/blink
chown system system /sys/class/leds/amber/off_timer
chown system system /sys/class/timed_output/vibrator/enable
chown system system /sys/module/sco/parameters/disable_esco
chown system system /sys/kernel/ipv4/tcp_wmem_min
chown system system /sys/kernel/ipv4/tcp_wmem_def
chown system system /sys/kernel/ipv4/tcp_wmem_max
chown system system /sys/kernel/ipv4/tcp_rmem_min
chown system system /sys/kernel/ipv4/tcp_rmem_def
chown system system /sys/kernel/ipv4/tcp_rmem_max
chown root radio /proc/cmdline

# Define TCP buffer sizes for various networks
# ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax,
setprop net.tcp.buffersize.default 4094,131072,196608,4096,65536,131072
setprop net.tcp.buffersize.wifi 4095,87380,110208,4096,16384,110208
setprop net.tcp.buffersize.umts 4094,131072,196608,4096,65536,131072
setprop net.tcp.buffersize.edge 4096,87380,110208,4096,16384,110208
setprop net.tcp.buffersize.gprs 4096,87380,110208,4096,16384,110208

class_start default

## Daemon processes to be run by init.
##
service console /system/bin/sh
console

# adbd is controlled by the persist.service.adb.enable system property
service adbd /sbin/adbd
disabled

# adbd on at boot in emulator
on property:ro.kernel.qemu=1
start adbd

on property:persist.service.adb.enable=1
start adbd

on property:persist.service.adb.enable=0
stop adbd

service servicemanager /system/bin/servicemanager
user system
critical
onrestart restart zygote
onrestart restart media

service vold /system/bin/vold
socket vold stream 0660 root mount

#service mountd /system/bin/mountd
# socket mountd stream 0660 root mount

service debuggerd /system/bin/debuggerd

service ril-daemon /system/bin/rild
socket rild stream 660 root radio
socket rild-debug stream 660 radio system
user root
group radio cache inet misc

service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
socket zygote stream 666
onrestart write /sys/android_power/request_state wake
onrestart write /sys/power/state on

service media /system/bin/mediaserver
user media
group system audio camera graphics inet net_bt net_bt_admin

service bootsound /system/bin/playmp3
user media
group audio
oneshot

service dbus /system/bin/dbus-daemon --system --nofork
socket dbus stream 666 bluetooth bluetooth
user bluetooth
group bluetooth net_bt_admin

service hcid /system/bin/hcid -s -n -f /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
disabled

service hfag /system/bin/sdptool add --channel=10 HFAG
user bluetooth
group bluetooth net_bt_admin
disabled
oneshot

service hsag /system/bin/sdptool add --channel=11 HSAG
user bluetooth
group bluetooth net_bt_admin
disabled
oneshot

service installd /system/bin/installd
socket installd stream 600 system system

service flash_recovery /system/bin/flash_image recovery /system/recovery.img
oneshot

#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
disabled
oneshot

#

# cat init.hero.rc
on early-init
device mtd@misc 0460 radio diag

on boot
# unmap left alt to avoid console switch
setkey 0x0 0x38 0x0
# device reset SEND+MENU+END
setkey 0x0 0xe7 0x706
setkey 0x0 0x8b 0x707

setkey 0x40 0xe7 0x706
setkey 0x40 0x8b 0x707

setkey 0x80 0xe7 0x706
setkey 0x80 0x8b 0x707

setkey 0xc0 0xe7 0x706
setkey 0xc0 0x8b 0x707
setkey 0xc0 0x6b 0x20c

mkdir /data/misc/wifi 0770 wifi wifi
mkdir /data/misc/wifi/sockets 0770 wifi wifi
mkdir /data/misc/dhcp 0770 dhcp dhcp
chown dhcp dhcp /data/misc/dhcp

#TODO: remove these two once we switch kernel to rfkill interface
chown bluetooth bluetooth /sys/module/board_hero/parameters/bluetooth_power_on
chmod 0660 /sys/module/board_hero/parameters/bluetooth_power_on

# 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
chown bluetooth bluetooth /sys/devices/platform/msm_serial_hs.0/serial_lock_cpu
chmod 0660 /sys/devices/platform/msm_serial_hs.0/serial_lock_cpu

on property:init.svc.wpa_supplicant=stopped
start dhcp-release

on property:init.svc.dhcp-release=stopped
stop dhcpcd

# compass/accelerometer daemon
service akm8973 /system/bin/akm8973
user compass
group compass misc input

service wlan_loader /system/bin/wlan_loader \
-f /system/etc/wifi/Fw1251r1c.bin -e /proc/calibration \
-i /system/etc/wifi/tiwlan.ini
disabled
oneshot

service wpa_supplicant /system/bin/wpa_supplicant \
-Dtiwlan0 -itiwlan0 -c/data/misc/wifi/wpa_supplicant.conf
user wifi
group wifi inet
socket wpa_tiwlan0 dgram 660 wifi wifi
disabled
oneshot

service dhcpcd /system/bin/dhcpcd -BKL -d tiwlan0
disabled
oneshot

service dhcp-release /system/bin/dhcpcd -k tiwlan0
disabled
oneshot

#TODO: Remove hciattach_legacy
service hciattach /system/bin/hciattach \
-n -s 115200 /dev/ttyHS0 texas 4000000 flow
user bluetooth
group bluetooth net_bt_admin
disabled

service hciattach_legacy /system/bin/hciattach \
-n -s 115200 /dev/ttyMSM0 texas 115200 flow
user bluetooth
group bluetooth net_bt_admin
disabled

# bugreport is triggered by the KEY_BACK and KEY_MENU keycodes
service bugreport /system/bin/bugreport -d -v -z -o /sdcard/bugreports/bugreport
disabled
oneshot
keycodes 158 139

# for USB internet sharing
service udhcpd /system/bin/udhcpd
disabled
oneshot

service netsharing_on /system/bin/netsharing net on
disabled
oneshot

service netsharing_off /system/bin/netsharing net off
disabled
oneshot

service zchgd /system/bin/zchgd
user root
group root graphics
oneshot
#

# cat init.goldfish.rc
on boot
setprop ARGH ARGH
setprop net.eth0.dns1 10.0.2.3
setprop net.gprs.local-ip 10.0.2.15
setprop ro.radio.use-ppp no
setprop ro.build.product generic
setprop ro.product.device generic

# fake some battery state
setprop status.battery.state Slow
setprop status.battery.level 5
setprop status.battery.level_raw 50
setprop status.battery.level_scale 9

# disable some daemons the emulator doesn't want
stop dund
stop akmd

setprop ro.setupwizard.mode EMULATOR

# enable Google-specific location features,
# like NetworkLocationProvider and LocationCollector
setprop ro.com.google.locationfeatures 1

# For the emulator, which bypasses Setup Wizard, you can specify
# account info for the device via these two properties. Google
# Login Service will insert these accounts into the database when
# it is created (ie, after a data wipe).
#
# setprop ro.config.hosted_account user...@hosteddomain.org:password
# setprop ro.config.google_account user...@gmail.com:password
#
# You MUST have a Google account on the device, and you MAY
# additionally have a hosted account. No other configuration is
# supported, and arbitrary breakage may result if you specify
# something else.

service goldfish-setup /system/etc/init.goldfish.sh
oneshot

service qemud /system/bin/qemud
socket qemud stream 666
oneshot

# -Q is a special logcat option that forces the
# program to check wether it runs on the emulator
# if it does, it redirects its output to the device
# named by the androidboot.console kernel option
# if not, is simply exit immediately

service goldfish-logcat /system/bin/logcat -Q
oneshot
#

That's all, didn't have time to look at them but hope it makes things clearer!

Cheers,
Magnus

Magnus Falk

unread,
Sep 4, 2009, 11:18:53 AM9/4/09
to 0xlab-discuss
Hmm, looks like there are few bluetooth-related services listed as
"disabled", or am I reading it wrong?

Cheers,
Magnus

Erin Yueh

unread,
Sep 5, 2009, 1:28:04 AM9/5/09
to 0xlab-...@googlegroups.com
Hi,

On Fri, Sep 4, 2009 at 23:18, Magnus Falk<magnu...@gmail.com> wrote:
>
[...]
>>

>> #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
>> disabled
>> oneshot
>
> Hmm, looks like there are few bluetooth-related services listed as
> "disabled", or am I reading it wrong?
>

It is disabled in the beginning, but system will start them later.
Here is a porting guide about Android init script.
http://www.netmite.com/android/mydroid/development/pdk/docs/bring_up.html

I guess something wrong in your bluez, so we cannot see hcid &
hciattach in the running processes. What files you upload to HERO?
'hidd','hciconfig','hcitool', or anything else? Before you uploaded
these files, have you used any other BT devices successfully?

mmh...we can manually power up bluetooh, not from Setting UI. Let's
try below steps:

1. Turn BT OFF in Setting UI

2. Pull high in BT power
# echo 1 > /sys/class/rfkill/rfkill0/state

3. Load BT firmware to hci stack
# hciattach -n -s 115200 /dev/ttyHS0 texas 4000000 flow
You would see the result like below,

Texas module LMP version : 0X3
Texas module LMP sub-version : 0X1126
internal version freeze: 38
software version: 2
chip: brf6300 (4)
Setting speed to 4000000
Texas speed changed to 4000000.
Loading firmware from /etc/firmware/brf6300.bin...
Firmware load successful.

4. Start HCI device
# hciconfig hci0 up

5. Start HCI daemon
# hcid -s -n -f /etc/bluez/hcid.conf

6. Check the running processes, can you see hcid and hciattach?
# ps

If you still cannot see them, you may download my bluez files from
here. Upload them to HERO, then repeat above steps... Good luck!

# wget http://androidobex.googlecode.com/files/hciattach
# adb push hciattach /system/bin

# wget http://androidobex.googlecode.com/files/hcid
# adb push hcid /system/bin

# wget http://androidobex.googlecode.com/files/libbluetooth.so
# adb push libbluetooth.so /system/lib

Magnus Falk

unread,
Sep 6, 2009, 9:32:56 PM9/6/09
to 0xlab-discuss
Hi Erin,

Thank you for sticking with me, I really appreciate this!

> I guess something wrong in your bluez, so we cannot see hcid &
> hciattach in the running processes. What files you upload to HERO?
> 'hidd','hciconfig','hcitool', or anything else? Before you uploaded
> these files, have you used any other BT devices successfully?

I'm pretty sure I uploaded all those files, but I'm not sure of
anything anymore... =P I haven't tried it with any other Bluetooth
hardware, so I'm not sure that it has ever worked...

I tried the commands out and here's what happened:

# echo 1 > /sys/class/rfkill/rfkill0/state
# hciattach -n -s 115200 /dev/ttyHS0 texas 4000000 flow
Texas module LMP version : 0X4
Texas module LMP sub-version : 0X15B5
internal version freeze: 53
software version: 3
chip: unknown (5)
[1] + Stopped (signal) hciattach -n -s 115200 /dev/ttyHS0 texas
4000000 flow
# hciconfig hci0
up
Can't get device info: No such
device
[1] Segmentation fault hciattach -n -s 115200 /dev/ttyHS0 texas
4000000 flow

Whoa, that can't be good I guess. Maybe I compiled for the wrong thing
here?

I tried with your files as well with the same result. So I guess they
switched the bluetooth chip or something and I need to compile bluez
specifically for that chip?

Cheers,
Magnus

Erin Yueh

unread,
Sep 6, 2009, 11:37:27 PM9/6/09
to 0xlab-...@googlegroups.com
Hi Magnus,

On Mon, Sep 7, 2009 at 09:32, Magnus Falk<magnu...@gmail.com> wrote:
>
> Hi Erin,
>
> Thank you for sticking with me, I really appreciate this!

You're welcome! I am glad that someone read my blog and I hope those
notes can help people.

>
[....]


>
> I tried with your files as well with the same result. So I guess they
> switched the bluetooth chip or something and I need to compile bluez
> specifically for that chip?
>

mmh.... I just google about Hero bluetooth and found this page. It
seems like this user had the same problem about BT functions. You
could take a look and check what HTC images you are using?
http://androidcommunity.com/forums/archive/index.php/t-23270.html

Magnus Falk

unread,
Sep 7, 2009, 7:50:33 PM9/7/09
to 0xlab-discuss
Hi Erin,

It seem like I have the very same software that they're talking about.
So I thought I'd go for the Cyanogen image, seems like it has
everything I want (i.e. bluetooth =P).

Problem is that I can't figure out how to install the damn thing... As
far as I can tell you're supposed to use the recovery image and the
Cyanogen image in tandem somehow?

Tips?

Cheers,
Magnus

Erin Yueh

unread,
Sep 8, 2009, 3:20:22 AM9/8/09
to 0xlab-...@googlegroups.com
Hi Magnus,

On Tue, Sep 8, 2009 at 07:50, Magnus Falk<magnu...@gmail.com> wrote:
>
[..]


>
> Problem is that I can't figure out how to install the damn thing... As
> far as I can tell you're supposed to use the recovery image and the
> Cyanogen image in tandem somehow?
>

mmh... here is an image chart and it has many types of Android images.
I also downloaded one and updated it in my Android Dev phone. It looks
great and BT function is working normally as well.

image chart: http://db.androidspin.com/android_build_information.asp

[ROM]TheOfficial TMO (US-CRC1/EU-CRC37) & ADP-CRC1 [9/5/09]- v1.7.1:
http://forum.xda-developers.com/showthread.php?t=538456

What i did?
I read post#4 carefully and did what they recommend. Pick one image
and then push it to /sdcard.
http://joomla.androidspin.com/downloads.php?dir=enomther/ROM/&file=TMO_OTA_CRC1_Rooted_FullFeatured_update_v1.7.1.zip

copied from the original post:

1) BACKUP ALL YOUR PHONE DATA AND SDCARD Contents to a computer,
external HD, or whatever, by whatever means you can. (Always better
Safe than ever sorry!)
2) If you are going to install the "TMO OTA CRC1 FullFeatured ROM"
READ THIS (if not, you can skip to step #3):

If you are coming from another Apps2SD ROM (if you don't know what
that means, goto step #3). In order to guarantee you won't have any
issues with the install you should remove all directories starting
with "app" and the dalvik-cache directory on your /system/sd
(ext2/ext3) partition. If you backed up your whole SDcard, this
shouldn't be a huge issue. - Yes you'll have to reinstall your apps.
You can try to skip this step, but if the install fails, rinse, wash,
repeat and don't skip this step.

(NOTE: I've see it successfully pull Apps2SD over from a cyanogen ROM
with no problems, but that's no guarantee!)

3) Download the desired base or full featured ROM from the original post.
4) Rename the downloaded file update.zip.
5) Copy the update.zip to your phone's SDcard. (DO NOT PLACE IT IN A FOLDER).
6) Power-Off your phone.
7) Press and Hold (Home+Power) buttons at the same time to boot into
recovery mode.
8) Perform a data wipe by pressing (Alt+w), may have to confirm by
pressing HOME (it will prompt).
9) Perform the update (install the ROM), by pressing (Alt+s).
10) When finished, reboot from recovery by pressing (Home+Back).
11) Once your phone has booted up, sign into your Google account (by
whatever means) through the setup/data-sync wizard.
12) Launch the "MarketApp" and accept the terms, download some app
you're familiar with by going to 'My Downloads' or search for one!

Magnus Falk

unread,
Sep 9, 2009, 10:03:23 PM9/9/09
to 0xlab-discuss
Hi again Erin,

*sigh* I've been trying different ROMs all night now and the only one
that will load is the MoDaCo ROM:
http://android.modaco.com/content/htc-hero-hero-modaco-com/292018/08-09-2-2-the-modaco-custom-rom-is-here-2-versions-based-on-the-new-update/

For all others the log (adb logcat) is silent during boot and it never
goes beyonde the "HERO" load screen.

The thing is that the MoDaCo ROM doesn't have any more bluetooth
support than the original Hero does. Doesn't have hciconfig for
instance. So I guess I'm more or less screwed for now...

There's a thing I don't understand about the AndroidSPIN database you
linked to though, how can I tell if a ROM will work with my phone? I
tried several that said they were build upon 1.5 Hero (JACHeroSki-
v1.8, JACMyTouchSkiv2.5.2 for instance) and a couple of others
(Cyanogen stable and TMO-OTA-EU-CRC37) but none of them would even
load. What should I look for?

Not so cheery,
Magnus

Erin Yueh

unread,
Sep 10, 2009, 2:16:53 AM9/10/09
to 0xlab-...@googlegroups.com
Hi Magnus,

On Thu, Sep 10, 2009 at 10:03, Magnus Falk <magnu...@gmail.com> wrote:
>
[...]

> There's a thing I don't understand about the AndroidSPIN database you
> linked to though, how can I tell if a ROM will work with my phone? I
> tried several that said they were build upon 1.5 Hero (JACHeroSki-
> v1.8, JACMyTouchSkiv2.5.2 for instance) and a couple of others
> (Cyanogen stable and TMO-OTA-EU-CRC37) but none of them would even
> load. What should I look for?

umm...that is too bad you cannot see any one of them running in your
HERO. When I read that AndroidSpin database, I will choose the most
downloaded one and has more check items enabled. Phone type column is
any HTC dream. Actually, Dream, Magic and Hero hardware are almost the
same. If it's workable in Dream(G1), it should be able to run in Hero.

mmh.... i have no idea why you cannot load those images. How about we
try cyanogen's solution again? I also tried it in my ADP and it is
workable.

(1) flash recovery-image
http://www.cyanogenmod.com/downloads/recovery-image

Download image (right-click, save as):
http://n0rp.chemlab.org/android/cm-recovery-1.4.img
MD5Sum: f5135a878c705215f4012786e4261cfe
To install image: copy it to your sdcard and run below command in Android:
#flash_image recovery /sdcard/cm-recovery-1.4.img

If you have problems with a “no space on device” error, try using
fastboot and erasing first:
#fastboot erase recovery
#fastboot flash recovery cm-recovery-1.4.img

(2) update a stable ROM
http://n0rp.chemlab.org/android/update-cm-4.0.4-signed.zip
# adb push update-cm-4.0.4-signed.zip /sdcard/update.zip
Press HOME + Power key, it would enter into Recovery mode
Follow the menu and select [ALT+S] apply sdcard:update.zip
then it would say Install from sdcard complete.
Press HOME+ Back key, reboot system now!

DONE!

Cheer up! I hope you can enjoy HERO phone and have fun with Android community.

Magnus Falk

unread,
Sep 10, 2009, 3:42:15 AM9/10/09
to 0xlab-...@googlegroups.com
Heh Erin, that process is more than familiar right now. That's what I did for most of last night, so I guess I did it correctly at least =P

It seems like the Hero is slightly different than all the others, enough so that stuff won't run properly at least... I ran into a problem when I tried installing a radio that wasn't for the Hero (the upgrade aborted in the recovery mode saying something like platform not == Dream) for instance. But the other ROMs installed happily, they just wouldn't load.

I'll give the Cyanogen another shot since I at least upgraded the radio since last time I tried it. The Cyanogen Recovery image makes it so easy that it's not much work involved in trying it.

Cheers,
Magnus

Magnus Falk

unread,
Sep 10, 2009, 6:08:51 PM9/10/09
to 0xlab-discuss
Okay, after a lot of searching I've concluded that noone has actually
gotten Bluetooth to work on the Hero yet (but that it's due out any
day now...). A shame really as I'm going traveling a month through
Asia day after tomorrow and was hoping to be able to blog using the
keyboard. Guess I'll have to do it the old-fashioned way... =P

Well, on the bright side I've thoroughly learned how to get through a
workday on three hours of sleep and how to install ROMs. It's really
great how hard it is to break anything when installing custom
software!

Cheers,
Magnus
Reply all
Reply to author
Forward
0 new messages