yashsingh1/xdaforums huggingface dataset:
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] addisu:
Working WIFI for Android on Kaiser

I am VERY pleased to tell you that I got wifi working. I was able to connect to a WPA secured network and access the web and the android market. I changed the SDIO_SyncWrite and SDIO_SyncRead functions to use write_direct and read_direct respectively instead of the sdio_memcpy_fromio. This fixed the freezing/blocking issue.

Here are the steps:

1. Extract your eeprom calibration file as described in my previous post on this thread and put it in /sdcard

2. Extract wlan.ko and wlan_loader from the attachment to /sdcard

3. Run the following commands

$ cd /sdcard
$ insmod wlan.ko
$ ./wlan_loader -f /system/etc/wifi/Fw1251r1c.bin -e /sdcard/calibration -i /system/etc/wifi/tiwlan.ini

$ start wpa_supplicant
$ start dhcpd
$ setprop wifi.interface tiwlan0

4. Go to Settings->Wireless controls -> Wifi Settings and start Wi-Fi

5. Hopefully you should see some wifi access points and connect to them.

BTW: I believe I am using system-nk-2009-07-24.img but I don't know the initrd date (Should be before 2009-07-28).

I hope it works for everyone.

Thanks,

Addisu

Edit: Forgot the insmod. Also, if you are doing this from your phone you will have to do "su" first.

Edit: Attached non-debug version of wlan.ko (should have better performance)
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] Newbie16:
YAY!

Well Done :)

I'll test it asap

Can we have the source so it can be compiled and properly modprobed? a complete system.img woudl be awesome :)
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] Zack84a:
After the second command, I get:

socket: Address family not supported by protocol
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] addisu:
Oops, I forgot the insmod part. The post has been edited.

This is the script I use for loading everything.

#!/bin/sh
MOD_PATH="/lib/modules/$(uname -r)"
echo "Checking for $MOD_PATH"
if [ ! -d $MOD_PATH ]; then
mkdir -p $MOD_PATH
fi

stop wpa_supplicant
stop dhcpd
rmmod wlan
insmod /sdcard/wlan.ko
/sdcard/wlan_loader -f /sdcard/Fw1251r1c.bin -i /sdcard/tiwlan.ini -e /sdcard/calibration

start wpa_supplicant
start dhcpd
setprop wifi.interface tiwlan0
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] Newbie16:
Why no source code?
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] jcarrz1:
addisu! awesome work. this is fantastic. unfortunately the above was your "previous post" and it doesn't say much about the eeeprom calibration file... I am a long-time linux user and the proud owner of a g1 :) could you help me out?

Nevermind, I found it; it was this instead.

Also, did you read about the bounty? $145? sounds like you deserve it... but they did say to provide them with a rom that can be flashed onto any kaiser... I assume you're working on that now :)
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] Pandemic187:
Doesn't wi-fi work by default on the G1? And by the way, I think he was referring to this post dealing with eemprom calibration.
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] jcarrz1:
Thanks, I got it. btw, the bounty link was here: http://xdaforums.com/showthread.php?t=534472

mebbe I'll add a little.

The dump instructions are abundantly clear (from here ) except the MSM_NAND first step... is that a command line configuration or something in android?
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] addisu:
I followed the same instruction except the where they extract the eeprom image. the MSM_NAND is a kernel configuration which you have change and compile. The instructions to get the kernel and compile it are here.
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] jcarrz1:
Thanks for the quick reply. hopefully I'll be the first one after you to try this out.

Edit: do those instructions right there make the zImage with this MSM_NAND kernel config? or do I have to do something special?
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] vilord:
addisu, did you disable wakelocks in your tiwlan_loader? if not we'll need you to post the wakelock kernel changes to LTG :)
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] toasty_:
Hey addisu great work,

I will try it right now. So lets see if its working on my Kaiser...

EDIT: the start script for wlan can maybe be placed in the 'init-Script' in the initrd - would be usefull for easy handling
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] Newbie16:
Can we have the whole source in a zip file?
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] addisu:
Here is the source for the whole ti directory

http://drop.io/wifikaiser

vilord, I have tried running wlan_loader with both wake locks enabled and disabled(commented out) and they both work "fine". When enabled, wlan_loader tries to open /sys/power/wake_lock and fails but continues to load the wifi. Do we not have wake_locks? or is there a different way of acquiring and releasing them?
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] Newbie16:
Thanks! I've just had an interesting idea. Could you add some code so that setprop wifi.macaddress ... is used to provide the mac address? because default.txt is already used to define variables for the data connection. So with a case function loading generic eeprom images without mac addresses for the kaiser, polairs and others we could get working wifi with the minimum of extra work. I don't think people would mind having a few extra kb of files

Also i've found that build.prop at the root of the system.img can be used to define the wifi interface by adding (or uncommenting):

wifi.interface = tiwlan0

So that takes care of that.

What do you think?
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] addisu:
I don't quite follow the reason for setting wifi.macadress. I think the eeprom calibration not only has the mac address but it is different for every phone because it has some sort of map/table. If NAND options are enabled in the kernel its easy to extract the eeprom image. You can do the following (takes about 5mins)

cat /dev/mtd/mtd0ro | dd of=/sdcard/calibration bs=1 count=752 skip=38797376

I have made(modified my existing one) a new system.img file with the wifi.interface = tiwlan0 as you suggested and a new initrd with changes to init.rc. There is also a kernel built with NAND options enabled so anyone can extract their eeprom (you can just use it once to extract eeprom and revert to any other kernel). With these files, once I had my eeprom, I didn't need to do anything on the command line.

Here is the link http://drop.io/wifikaiser

Good Luck :)
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] tembares:
Okay, great... and now for noobies ;)

What do I have to do to test WIFI?

I run the non-hero version with the latest initrd with rootfs and zImage.

This is really cool :D
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] enatefox:
addisu, really cool you got wifi working but would you mind explaining a little bit:

I'm assuming that this is critical to wifi working, is there any way to modify that on a final build (like Hero or ION)?

What did you do with the calibration? I have been able to access it after having insmod'ing wlan.ko. What was the point of extracting it?

And your zip file doesn't include the fw1251r1c.bin file-- did you take yours from WinMo, the G1 or elsewhere?

Thanks
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] Newbie16:
I can confirm that wifi works with the posted system.img and corresponding files

Thank you very much :)

I'm streaming frequence 3 over wifi to see how long the battery will last.

Here is my calibration file, i've set the wifi mac address to the standard start and then the date

http://drop.io/calibrationfiles
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] jmonseur:
Thank you very much for your hard work

Well guys I've got only one thing to say: thank you and nice job!

I have been following the Android port on kaiser with my nooby eyes since the very beginning and I must say that wifi was the one thing that was needed.

As it was written before, is there a step-by-step explanation for we noobs to be able to test wifi on our androids and eventually post feedback?
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] toasty_:
I can confirm it too. It works in my self-made system.img.

Great... :D, now I can use android as everyday-system

Maybe a 'wlan.app' like the 'Modem.app' would be great for people who don't want to type all this stuff. But at the moment my enable-script does a good job
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] jcarrz1:
Newbie16, you beat me to it :)

Can anyone help me out with the compiling the kernel with msm_nand support? Thanks.

or is the zImage addisu posted good enough?
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] momo254:
EDIT: I'm assuming there are more steps than just downloading the files as posted @ http://drop.io/wifikaiser and putting them on the sd card correct?
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] enatefox:
$ ./wlan_loader -f /system/etc/wifi/Fw1251r1c.bin -e /sdcard/calibration -i /system/etc/wifi/tiwlan.ini

Does the calibration file have to be done on each device or is it "generic" disregarding MAC address?
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] toasty_:
you have to type...

make menuconfig

and then you choose:

Device Drivers --> Memory Technology Device (MTD) support (check this with *)

then you change to Memory Technology Device (MTD) support

there I choose

FTL (Flash Translation Layer)

NFTL (NAND Flash Translation Layer) support

INFTL (Inverse NAND Flash Translation Layer) support

(don't know if all these are needed)

then go to "Self-contained MTD device drivers" and choose:

MTD using block device

MSM NAND Device Support (NEW)

make zImage

I hope, I didn't forget anything...
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] addisu:
I believe the calibration file is specific to each phone so it needs to be extracted until someone figures out how to get it on /proc/calibration
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] toasty_:
yes it is because it includes the MAC of your Wlan-adapter.

So you have to extract the eeprom ('calibration') from the full ROM:

so you have to dump the whole thing from /dev/mtd/mtd0ro (Kerrnel needed with MSM_NAND an MTD support)

cat /dev/mtd/mtd0ro > /sdcard/mtdump.img

from this you can extract the eeprom (Offset 0x2500040 752Byte):

Maybe you can test my eeprom but you have to insert your MAC in this file (but I don't know if this works) Calibration

I removed my MAC, so you have to insert yours in reverse order at Offset 1C (where the FF's are) - but I don't know if it works
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] addisu:
Are you telling me that you have /proc/calibration on your phone. What kind of phone do you have? I still get nothing when I do cat /proc/calibration after insmoding wlan.ko

The fw1251r1c.bin file was already in the system.img. It would be the same file from winmo.
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] enatefox:
EDIT: sorry, didn't read that you replied above:

Yes, always had /proc/calibration but had to have loaded wlan.ko. It's a Kais160 ATT Tilt. I should say that "cat /proc/calibration" returns nothing but it doesn't say "no such file or directory" so that might dash your hopes on the rocks.

I'm trying to do your method to extract mine but got a broken pipe error. Using the resulting file or /proc/calibration yields the same:

===IPC_DeviceIoControl('tiwlan0', cmd=2242612 (SET), data=0x40009008 (0x2f0), size=203175, sizeRet = 0x0(ffffffff))
===== send_ioctl: socket=11, cmd=35312, &req=0xbee0ca6c
===== send_ioctl: req={name='tiwlan0', sub_cmd=2242612, size=203175 (max=4), data=0x40009008
Printing memory dump:
TI_CU:0xbee0ca6c: 74 69 77 6c 61 6e 30 00 00 00 00 00 00 00 00 00
TI_CU:0xbee0ca7c: 34 38 22 00 02 00 00 00 a7 19 03 00 08 90 00 40
===== send_ioctl: res=0, sizeRet=0x0 (ffffffff)
===IPC_DeviceIoControl('tiwlan0', cmd=2242588 (SET), data=0xbee0cacc (0x1), size=4, sizeRet = 0x0(ffffffff))
===== send_ioctl: socket=11, cmd=35312, &req=0xbee0ca6c
===== send_ioctl: req={name='tiwlan0', sub_cmd=2242588, size=4 (max=4), data=0x1
Printing memory dump:
TI_CU:0xbee0ca6c: 74 69 77 6c 61 6e 30 00 00 00 00 00 00 00 00 00
TI_CU:0xbee0ca7c: 1c 38 22 00 02 00 00 00 04 00 00 00 01 00 00 00
** IPC_DeviceIoControl() return -1

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

Here's what I've gathered with ION build beforehand when trying to instantiate wifi with Vilord. Hope this is useful:

The commands:

su
logcat -f /sdcard/debuglog.txt &
insmod /system/lib/modules/wlan.ko
start wlan_loader
start wpa_supplicant
start dhcpcd
fg
D-pad center + c

Results: here

(I don't want to bomb the page with a lot of code)

tiwlan_loader/tiwlan_loader.c has the part where it fails to call IPC_DeviceIoControl() with my comments in bold:

/* Need to wait till driver will be created in sdio_probe() */
do {
print_debug("Configuring adapter\n");
rc = IPC_DeviceIoControl(adapter_name, TIWLN_SET_INIT_INFO, init_info, req_size, NULL, 0,
[B]/* Log prints: %d = 0 */[/B]
print_debug("Adapter configuration rc = %d\n", rc);
if( rc != 0 ) {
if( count > 4 ) {break;}
count++;
sleep(1);
}
} while( rc != 0 );

/* Send configMge start command as the cli is started */
if( rc == 0 ) {
print_debug("Starting configMge\n");
[B][B]/* Here's where it fails with -1 */[/B][/B]
rc = IPC_DeviceIoControl(adapter_name, TIWLN_DRIVER_STATUS_SET, &tmpData, sizeof(tiUINT32), NULL, 0, NULL);
[B]/* Log prints: %d = -1 */[/B]
print_debug("ConfigMge start rc = %d\n", rc);
}
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] jcarrz1:
Thanks toasty! I'll try this out soon.
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] bravekid20:
Wifi on Android

Hello Everyone,

I am proud of the people to achieve this goal. However I'm a noob at these things. Can someone explain to how to set up the wifi thing on my phone. Do I use the files from dopo.io site thingy. I need step by step instructions on how to install and run the wifi and everything. Also if it involves entering codes how do I do that? Please let me know.

Thank You
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] bally3:
getrom (put the following in getrom)

Code:

#!/bin/sh

cat /dev/mtd/mtd0ro | dd of=/sdcard/calibration bs=1 count=752 skip=38797376

ls

Hi, sorry, not understanding this step, can anyone explain it please? do we type this into a shell or create a file named getrom and add it to the file?

Thanks
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] enatefox:
Create the file then run it in the shell. It's to save you from having to type it in on the device.

I'm getting a broken pipe error towards the end, can't get further. I'm using the build posted on the site so I assume I don't need to rebuild it with anything fancy in the kernel right?

Trying to load anyways or with /proc/calibration is giving me the same result addisu had here but I couldn't find a resolution.
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] toasty_:
You have to type this in a shell but a script is better. 'cat' creates an output from the device mtd0ro meanwhile 'dd' creates a dump from this output. 'dd' skips the first 38797376 Byte and writes the following 752 Bytes in the file calibration, that is saved to sdcard.
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] Newbie16:
I've updated the first post and i've tested the method, it should work fine now

Try it with the method i've used, could the broken pipe be caused by catting such a large file?
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] enatefox:
Ok, with the getrom script on the first post it did work. I think having it done it 2 stages (cat then dd) fixed it. On to wifi-ing
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] Newbie16:
WAIT! 160MB is enough, just run the second dd command and it will produce a calibration file

Mine did that with the single command where the info was piped to dd, but it worked fine with the separate cat and dd commands.
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] enatefox:
I think I accidently was cat'ing the /dev/fail partition. I got it, rebooted and am happy to say I am on wifi. Worked out of the box through the standard settings.

Now... can somebody tell me how to recompile Hero so that I can get wifi working on it?
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] Newbie16:
You should just be able to take the hero rom, and edit the contents, copy over the tiwlan.ini, the firmware, wlan_loader, wlan.ko. Then use the kernel and possibly the initrd provided by addisu.

Herolite has an amazing boot screen, love the little droid peeking out and saying hi :)
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] enatefox:
I'm using the build I linked to. For me, as fast as ION with full SenseUI.

Can you be a lil' more specific? The structure of the build is quite different and I've had no luck customizing initrd.gz (hope that's not needed...) successfully. Are the kernel tweaks/recompilations just to obtain the calibration file I now have? I can mod a system.img but that's about all I've been good at. Copying files is not hard but when I tried the first time, the phone crashed at bootup.
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] Newbie16:
They were mainly to get the calibration file, but also to get a wlan.ko that has been compiled specifically for the kernel.
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] toasty_:
could somebody save the wlan settings - WLAN-KEY? Android said: unable to save the network (if I try to create a new). I'm using a selfmade system.img. I thought data would be saved in wpa_supplicant.conf, that is stored in '/data/misc/wifi/wpa_supplicant.conf'.

but this file isn't updated...
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] enatefox:
The image posted on the first page does save them but you need to leave and reenter the screen to see it once you save it (doesn't refresh automatically). Must be your build if I had to guess.

Okay, I have Hero ready except for the initrd.gz file. Can someone PM me or help me edit it?
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] addisu:
The only change I made to initrd is in the init.rc file. Change the wlan_loader to use /sdcard/calibration instead of /proc/calibration.

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

Btw, the /proc/calibration file has always been there but had nothing in it. It should have some binary data when you open it with cat.
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] enatefox:
Thanks, I noticed the ~ suffix but didn't know if anything was done. You're right about having nothing in the calibration file although it existed. Making changes now and hopefully that will take care of Hero. I am saving the build so I will share once it's tested.

Thanks everyone involved for getting it work
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] enatefox:
... yet another double post
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] pmcnano:
Mh, can you upload the getrom file, it just...doesnt do anything when i make it, i just copy pasted all the code adn saved the file, but when i try to run the "script" or binary file it just doesnt happena nything!
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] Newbie16:
here it is:

http://drop.io/calibrationfiles

Please note that it will take time for the shell to finish what it is doing
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] pmcnano:
ok wait..soi have

/sdcard # ./getrom

......

nvm..it finished. I think it should be pointed out in the first post..that it may take 5 minutes to complete de process, maybe adding some "echo" entries to the script would help.

edit: working =) just fine!

Thanks this is f%$%"$%"·$ great !...

edit2:

well, although its connectd, its pretty slow I dont know why!
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] enatefox:
... whoops. I'm getting an 'unable to save network.' can someone help?
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] Newbie16:
Its saved in data.img so have you tried renaming that and using a fresh one?
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] enatefox:
I should mention, I got everything working for wifi on Hero but can not save the AP info. Getting "unable to scan for networks" and "unable to save network." I went through data.img and gave wpa_supplicant.conf world-writable permissions just in case but no. Fresh data.img used just once to populate it with files. I hard-coded the AP into it and still not working. Wifi will enable however.

I'm going to take the build you posted and compare permissions but does anyone have any hints as to what to look for?
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] battikh:
hmmmm, i'm following the steps from the 1st page (downloaded the files provided by addisu, renamed them as needed and copied them to the sdcard) but when i try to run getrom i get this error:

"Invalid argument1: can't create /sdcard/romdump.img"

i'm root, and i tried to do a "touch /sdcard/romdump.img", the file gets created, so it's not a permission or write error...

the following is the content of my getrom file:

i removed the #!/bin/sh as when it is there, it doesn't run at all and i get "sh: ./getrom: not found"

any idea what i could be missing?
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] enatefox:
battikh, this:

#!/bin/sh
cat /dev/mtd/mtd0ro > /sdcard/romdump.img
dd if=/sdcard/romdump.img of=/sdcard/calibration bs=1 count=752 skip=38797376
ls /sdcard/

then:

su
cd /sdcard
./getrom

if for some horrible reason I can't think of you can try to:

cat /dev/mtd/mtd0ro | tee /sdcard/romdump.img
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] ajclai08:
su

cd /sdcard

./getrom.txt

use the .txt extension if it can't find the getrom file. This worked for me.
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] natalic:
It might just be me

It worked but it then stopped working...So I assume there is still bugs in the driver. But PLEEEASSE do what you can, I'm ready to ditch WM just because I feel better using Android...When will Android 2 dev start?
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] Pandemic187:
Everything that can be done is being done. Be patient!
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] ibanezbass:
how do you put > with the phone?
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] natalic:
Please don't take what I said as some impatient fanboy. I am a coder/developer myself. I have been coding in C++ for around 4-5 years now. I was just being enthusiastic. I do appreciate everything being done and wish I could help in some way.

Thanks for everything:)

I have created an archive with everything that is needed for this:

http://rapidshare.com/files/263887324/Android_7_27_2009_Kaiser.zip

I have a disclaimer and read me in it (disclaimer has the proper thank yous). If anyone finds something they wish changed in it, let me know.
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] loserskater:
Have you tried tapping the screen when the keyboard's closed? it should bring up the onscreen keyboard.
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] andydd:
I had the same error. I had created the file under windows, so the line breaks were wrong. Open the script in vi on the phone and remove the control signs at the end of the lines.
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] toasty_:
I still got the same error, so I pulled the /data/misc/wifi/wpa_supplicant.conf and inserted my own entry at the end of the file. After that I pushed it on the phone. You don't know what than happened, suddenly I could also save my own Networks...
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] archongtv:
or try this

cat /dev/mtd/mtd0ro | dd of=/sdcard/calibration bs=1 count=752 skip=38797376

You get vertical pipe with Fn + left soft key (that between keyboard and screen when kaiser is open)
[Tilt, TyTN II, MDA Vario III Windows Mobile ROM De] archongtv:
Does anybody know why android doesn't support wpa2 enterprise? And when I'm using wpa2 personal at home I get connected but I've got pings > 2000ms and Internet is not working (On winmo it works).