THERE IS NOW AN ANDROID APPLICATION THAT RUNS THESE COMMANDS FOR YOU: desire-adhoc
This is a short guide on how to connect your HTC desire phone to an ad-hoc wireless network. Currently the process is highly unautomated but easily scriptable – maybe at some point somebody will implement an easier solution.
Root your phone
In order to have full access to your phone’s OS you’ll have to ‘root’ it. Follow this guide.
Install additional software
Now all that’s missing is a little tool called iwconfig that will be used to set your network device’s communication parameters. Since it’s not included in the default installation, I got mine from the wifi-tether application (eg. download this package, unzip it and put the iwconfig binary on your phone using `adb push`).
Restart the network interface
Any modifications you do to your network device will be changed back by (AFAICT) wpa_supplicant, thus we will be doing things manually. First, disable the phone’s wifi using the normal GUI tools. Once you have done that, the wifi interface will be gone and the kernel module unloaded, so we need to reload it. Open a shell on your phone:
adb shell
and load the module:
insmod /system/lib/modules/bcm4329.ko
Now you have a nice, clean wifi interface that’s completely under your control!
Connect to the ad-hoc network
Finally, you can connect to your ad-hoc network. In my case I use static IP addresses:
iwconfig eth0 mode ad-hoc iwconfig eth0 essid mynetwork ifconfig eth0 192.168.0.150
That’s it.
Notes
- It seems the phone dislikes the idea of joining existing adhoc networks. If you see that iwconfig just doesn’t switch the interface to adhoc mode, try a different ESSID.
Is there any way to put the interface in monitor mode ?
Not as far as I can tell – “iwconfig eth0 mode monitor” fails.
How would I go about activating DHCP on this?
Android doesn’t have dhclient or similar as far as I can see.
I figured that one out myself, “netcfg eth0 dhcp”.
Now i’m having trouble with properly setting up DNS servers, ping and browsing to a IP adress works. Any help?
I feel like a spammer but it just started working on its own. Strange.
@Poodlemastah: good to hear
Pingback: PC als Hotspot - Android-Hilfe.de
Hey. Could someone please tell me, where I’ve to adb push the iwconfig? (path?) I’ve been trying for some time now but doesn’t matter where I put it, I always get the answer iwconfig: not found. I read that it’s possible to directly modify wpa_supplicant.conf, so that you can see adhoc-networks directly over the UI. But I couldn’t manage this neither…
Someone can help? Thanks
@baesae: the path doesn’t really matter, you can put it somewhere in /data and then call it using the full path (eg. /data/mypath/foo/iwconfig eth0 …). or you can figure out the system’s PATH (echo $PATH) and put it in one of those dirs.
great hint. thanks.
Hey. Could someone please tell me, where I’ve to adb push the iwconfig? (path?) I’ve been trying for some time now but doesn’t matter where I put it, I always get the answer iwconfig: not found. I read that it’s possible to directly modify wpa_supplicant.conf, so that you can see adhoc-networks directly over the UI. But I couldn’t manage this neither…Someone can help? Thanks
+1
Pingback: Anonymous
i can’t get the iwconfig to work:
1. if i push it to the system it says \read only ..\ (it’s normal)
2. i copyed it to the sdcard and seems the root has no right —-rwx— and doesn’t let me use it
please help
my bad , the owner has no rights
I copied the file using the adb push command. Cannot execute the binary because I keep getting the permission denied error. Any suggestions? Thanks
@stefan: which file? if you’re talking about iwconfig, try chmod +x /path/to/iwconfig. or you could just install the app from http://desire-adhoc.googlecode.com/
For everyone having trouble with dns-configuration: you can manually set the dns-server with e.g
setprop net.dns1 192.168.0.1
This guide and app seems don’t works with froyo based rom.
I have a rom based on official htc rom and don’t works for me…
Pingback: Internet Zugang per Notebook - Android-Hilfe.de
installed the .apk as per http://code.google.com/p/desire-adhoc/
Ad-hoc app keeps asking for superuser permission after I constantly accept the prompt. Once enabling wireless it keeps giving me an error. Even without running the Adhoc app… I uninstalled the app and my wireless works normally but still cant connect to my ad hoc wireless network off my windows XP PC.
Any ideas?
Pingback: Anonymous
Hi stefan,
great job with desire-adhoc. I’ve been able to connect to my laptop ad-hoc from my HTC desire with temporary root (Visionary+).
However, i can only ping (from phone to laptop and from laptop to phone), but i cannot connect from desire to my laptop’s apache on port 90. ¿Maybe a firewall issue?
Also, I’ve only been able to make it work if i manually assign ip addresses, but not using dhcp.
Finally, i’m wondering how could i use my laptops internet connection (wired) to access internet from my phone.
@tony: The app prompts for superuser permissions for each command that it runs. the first time you actuvate adhoc networking that results in ~5 prompts. If you don’t change your configuration, you should not get any further prompts the next time you activate it.
@Jorge: That sounds strange. Just for the record, you *do* have a DHCP server running on the laptop, right? As for using the laptop’s internet connection, that should just work once your phone’s network configuration is correct and your laptop has been configured to share its connection (you’ll probably have to configure NAT, eg. with iptables on Linux).