[HD2 Android NAND Development] MrT69:
I hope all this is just a little bit interesting for some developers because I can't do any further investigations on ANDROID because my device is broken. At the moment it's on the way and I hope I will get a change of my broken HD2. I have summarized some more or less insteresting facts and I hope someone of you will think about all this informations and can work with them.

First at all: I'm not a developer but I have done some search on ANDROID and logged and logged and logged it again. All this is just a collection of facts and results of compare log files.

When you disassemble some Files within Android, you will see that something will not work because it can't. Let me start with the init.rc what is missing or might be wrong:

1. MISSING FOR BLUETOOTH:

# create mountpoints
mkdir /mnt_data/download 0777 root system

2. WRONG?

chmod 0666 /dev/ttyHS1
chown root radio /proc/cmdline
chmod 666 /proc/cmdline

There is no ttyHS1 device within the ANDROID. Can't find it.

3. NOT SURE

rfkill is seems not working. Recommendation on the website:

http://www.gitorious.org/openaos-te...5f360fec4c21c1e06d145a5fe?diffmode=sidebyside

chmod 0666 /sys/devices/platform/wifi_bt/bt_enable 0
write /sys/devices/platform/wifi_bt/bt_enable 1

but based on ANDROID Developer FAQ it should be:

chmod 0666 /sys/modules/board_[platform]/parameters/bluetooth_power_on
write /sys/modules/board_[platform]/parameters/bluetooth_power_on 1

and this MUST also done after the change:

on property:persist.service.bluetoothd.enable=0
write /sys/modules/board_htcleo/parameters/bluetooth_power_on 0

...depend of the settings it also could be:

write /sys/devices/platform/wifi_bt/bt_enable 0
on property:persist.service.bluetoothd.enable=1
write /sys/modules/board_htcleo/parameters/bluetooth_power_on 1

...depend of the settings it also could be:

write /sys/devices/platform/wifi_bt/bt_enable 1

Also interesting is

the command write

which is used a lot of times by the init.rc. I don't know where this command is located. But if you open a SHELL on Android and try to "write" something you will see that this command is not available. Can someone explain how this will work when this command is not available????

4. WRONG!

chmod 666 /dev/uinput
chmod 666 /etc/bluez/audio.conf
chmod 666 /etc/bluez/hcid.conf
chmod 666 /etc/bluez/input.conf

On the one hand this path is not existing and on the second hand the hcid.conf is also not existing. If you take a look only within /etc you will see that /etc/bluetooth is only existing.

5. BT INITIALIZATION

service hciattach /system/bin/brcm_patchram_plus --enable_hci –enable_lpm --baudrate 3000000 --patchram /etc/firmware/bcm4329.hcd /dev/ttyHS0
user bluetooth
group bluetooth net_bt_admin
disabled

This is also not working at all. If you try to run this command via the shell nothing will happens. And if you need to load the firmware into the device you need also setup this device by nvram.txt which you can see within the bluetooth.c file. The nvram.txt is important to get a valid MAC Address from the hardware. If you take a look into the source code of the BCM4329 you will see additional informations about this.

The second problem is the value of 3000000. This is to small. If you want to work with head set than a value of 4000000 is minimum required. From my point of view this initialization should be:

service hciattach /system/bin/logwrapper /system/bin/hciattach -s 57600 /dev/ttyHS0 any 4000000 flow

The value 57600 is the minimum value for initialize bluetooth and it could be that this value will downsize the standby drain. Not sure, just an idea.

Why? Lets take a look into the main.conf or hcid.conf:

# What value should be assumed for the adapter Powered property when
# SetProperty(Powered, ...) hasn't been called yet. Defaults to true
InitiallyPowered = true
# Remember the previously stored Powered state when initializing adapters
RememberPowered = true

This was the reason why I think the initialization speed "...-s 57000 /dev..." should be lowerd down which might also solve the battery drain issue. Again, not sure - just an idea.

Btw, if you open the ADB shell and try hciconfig, hciattach or hcitools non of this are working because there is no Bluetooth Adapter even if you have BT enabled. This tools are requried for BT analyse, test and command options. You can call each of the files within the Shell but whatever you try to do you it will fail because BT is not enabled. Try to run rfkill which could initiate a reset on the BT device. If you try to rfkill ttyHS0 which is the BT adapter on HD2 device this will not work. From my point of view all this problems are not only related to the kernel.

6. TAKE A LOOK INTO THE init.htcleo.rc

# Make sure we startup btld before hcid
# Set target address to emulator host loopback IF
# Limit baudrate to 460800 to ensure reliable uart operation
service btld /system/bin/logwrapper /system/bin/btld -hwtun 10.0.2.2 -hb 460800 3000000 -lpm 1
# service btld /system/bin/logwrapper /system/bin/btld -lpm 1 -hb 3000000

Not sure what will run first. The init.rc or the init.htcleo.rc. If the init.rc will run first this could be also a problem. Btw, the first value is 460800. From my point of view this is too much for initialization.

7. WiFi INITIALIZATION

Just an example but if you do a Google search for "BCM4329 nvram.txt" you will get more than 3 links. Let me show here an example:

http://android-wifi-tether.googlecode.com/svn-history/r465/trunk/res/raw/tether_edify

Search for Value 4329 and you will see SAMSUNG Device bla, bla – don't know from top of my head:

!file_exists("/sdcard/android.tether/bcm4329.bin") && ( module_loaded("dhd") || log(insmod("/lib/modules/dhd.ko", "firmware_path=/system/etc/wifi/bcm4329_mfg.bin nvram_path=/system/etc/wifi/nvram_mfg.txt"), "Loading dhd.ko module<br>(bcm4329_mfg.bin from /system/etc/wifi/)"); );

Hmm... That was the reason why I grabbed the SAMSUNG i9000 from a friend of me and double checked the device. If you take a look into the /etc/wifi you will see the nvram.txt. I'm not sure how this will be loaded into the device but the i9000 has the same BCM4329 Chipset.

Now let us take a look into the wifi.c for QUALCOMM devices which is also valid for the HD2:

http://gitorious.org/linux-on-qualc...f8dffe668c0448/libhardware_legacy/wifi/wifi.c

Line 61: Take a look. Nothing of this is existing on the HD2
Line 71: there is no wlan.ko on the HD2

But now, where the hell the MAC Address is stored for the WIFI Adapter? Just take a look at this location:

sys/module/board_htcleo/parameters/bdaddress

or use this:

/system/sysroot/module/board_htcleo/parameters/bdaddress

If you check this file you will see there your current MAC Address of the WIFI device. The stupid MAC for the BT device seems not stored on the device. And this is the point where I guess to need the fu***ing nvram.txt.

I have done a search for some BCM files and found something interesting which is attached as "Broadcom Files.7z." There are some (!) more or less firmware files within (?) and also the famous nvram.txt

For additional informations about WiFi and more just open the wifi_suplicant within the /system/bin directory with a simple text editor and browse down to the end. There you will see also a lot of interesting settings for the WiFi environment.

8. W.t.F. IS THIS STUPID NVRAM.TXT?

Download attached Broadcom.7z and check the txt file within. If you open the file you will see the nearly same content as within the

/etc/calibration

file.

But this file you can ignore on your HD2 device. Delete it, rename it – do whatever you want and you will see no changes on the device. The more interesting thing is within

/sys/calibration

Huhhhh...! The same file but less values. But where does it come from??? Currently I don't know.

It seems that the nvram.txt is as same as like a BIOS for the device. The BCM4329 is a BT AND WiFi Chip within one CHIP. It might be wrong but I guess this is the easy explanation for this.

And because of this the thing can't work. First it needs to load the BIOS (nvram.txt) and then it needs the OS for it (BCM4329 Firmware).