[Hero, G2 Touch Q&A, Help & Troubleshooting] tbone7:
I have yet to be able to connect to the ad-hoc network with WPA1/2-security. But I am pretty sure it should work, wpa_supplicant.conf just needs to be configured correctly.

Right now I am connected with WEP-security. That will keep the noobs of my wifi-network, but it is not a satisfactory solution for security in the long run, as it _easily_ can be cracked. We should therefore really try to make this work with WPA2.

I combined information from different sources online; here is the approach I used to allow connections to ad-hoc wifi networks with HTC Hero:

We need to edit two system files within Android; /system/etc/wifi/tiwlan.ini and /data/misc/wifi/wpa_supplicant.conf (so our HTC Hero must be rooted). I prefer doing this with Android's debugging bridge (adb), to avoid fiddling with badly written terminal applications for the HTC Hero. Adb makes it possible to alter android system files from your command line on your computer. To use adb you need to install the drivers. Most Windows-users have these installed from when installing HTC Sync. I use Linux and had to install them by grabbing the Android SDK from their homepage (I can elaborate on this if necessary).

Open a terminal window (in windows the command line) and type:

adb pull /system/etc/wifi/tiwlan.ini .

This will copy the file from the HTC Hero to the computer. In Linux the file will be stored in the user's home directory. I am not sure where it will be stored in windows. Open the file in a text editor. Locate the text "WiFiAdhoc = 0" and change the 0 to 1. Then we will place to new lines right underneath it, to make it look like this:

WiFiAdhoc = 1
dot11DesiredSSID = insertyourssidhere
dot11DesiredBSSType = 0

Replace insertyourssidhere with the name/SSID of your ad-hoc network. Save and close the file. We are finished with it now.

In the terminal, type:

adb pull /data/misc/wifi/wpa_supplicant.conf .

Wpa_supplicant.conf is the tool we use to configure the network security. Open the file. I have my file configured like this:

ctrl_interface=tiwlan0
update_config=1

eapol_version=2
ap_scan=2
fast_reauth=1

network={
ssid="insertyourssidhere"
scan_ssid=0
mode=1
key_mgmt=NONE
group=WEP104
auth_alg=SHARED
wep_key0="insertyourownpassswordhere"
}

My ad-hoc wifi network is configured with the matched settings, although there the WEP is called WEP128. It might look somewhat different in Windows compared to Linux.

Ok, now that we have configured the files, we will transfer them back to the HTC Hero by executing the following commands (each line is a new command):

adb shell
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
exit
adb push tiwlan.ini /system/etc/wifi/tiwlan.ini
adb push wpa_supplicant.conf /data/misc/wifi/wpa_supplicant.conf
adb shell
mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system
exit

Turn on your laptop ad-hoc wifi network. Turn on wifi on your HTC Hero. You will see the ad-hoc network listed. Wait a minute for the HTC Hero to obtain the network address from the laptop. It should automatically connect to the network when wifi is enabled at both laptop and HTC Hero.

Please consider this a temporary solution; we should really strive to configure wpa_supplicant.conf with WPA2-security.

Disclaimer: Remember, I am not responsible for your actions :)