[SOLVED] How to connect to an Ad-Hoc (IBSS) network?

Maxxd01

Senior Member
Jul 19, 2008
795
19
0
I've been using for years a laptop with usb broadband device, and sharing it through an ad hoc network to mobile devices.

My last two Android Devices (HTC Magic and Samsung Galaxy Spica) never had problems connecting to that network - altough they always had custom roms and custom kernels, YoshiMod and SpicagenMod, both CyanogenMod based - (don't remember trying with stock roms).

Two days ago I bought a Nexus S, flashed the Air Kernel, and now I became confused that the ad hoc network didnt appear on the scanned networks (on the nexus) but it appears on the Wifi Analyser App (and still, on other two android phones)

So I installed Wifi Manager and I get the information "standard android does not support connecting to ibss (ad-hoc) networks".

So my question is: what the f***? Any workaround for this issue? Because, if it was possible to those two android phones I used, I suppose it's possible too for Nexus.

I read here a suggestion to use Connectify, but still the problem.

I have a stock 4.0.4 (with Air Kernel "wifi fix version").

Thanks in advance.

SOLUTION: This method. Shortly:

1. root is required - make sure you have your file system app (like Root Explorer) set to make files R/W so you can edit/rename/set permissions
2. turn off wifi
3. go into system/bin and rename wpa_supplicant to wpa_supplicant_backup
3. download the wpa_supplicant file found here
4. unzip it
5. move it to system/bin and paste it
7. set permissions to xxx, x, xxx (columns) - see more details in original thread
8. go back and start up wifi (no reboot needed)
9. click to connect

Credits to Lock-N-Load.

Use it at your own risk.
 
Last edited:

kotsyeno

New member
Jul 17, 2012
1
0
0
fantastic

I've been using for years a laptop with usb broadband device, and sharing it through an ad hoc network to mobile devices.

My last two Android Devices (HTC Magic and Samsung Galaxy Spica) never had problems connecting to that network - altough they always had custom roms and custom kernels, YoshiMod and SpicagenMod, both CyanogenMod based - (don't remember trying with stock roms).

Two days ago I bought a Nexus S, flashed the Air Kernel, and now I became confused that the ad hoc network didnt appear on the scanned networks (on the nexus) but it appears on the Wifi Analyser App (and still, on other two android phones)

So I installed Wifi Manager and I get the information "standard android does not support connecting to ibss (ad-hoc) networks".

So my question is: what the f***? Any workaround for this issue? Because, if it was possible to those two android phones I used, I suppose it's possible too for Nexus.

I read here a suggestion to use Connectify, but still the problem.

I have a stock 4.0.4 (with Air Kernel "wifi fix version").

Thanks in advance.

SOLUTION: This method. Shortly:

1. root is required - make sure you have your file system app (like Root Explorer) set to make files R/W so you can edit/rename/set permissions
2. turn off wifi
3. go into system/bin and rename wpa_supplicant to wpa_supplicant_backup
3. download the wpa_supplicant file found here
4. unzip it
5. move it to system/bin and paste it
7. set permissions to xxx, x, xxx (columns) - see more details in original thread
8. go back and start up wifi (no reboot needed)
9. click to connect

Credits to Lock-N-Load.

Use it at your own risk.

thank you very much...i have looked around and got a wpa file and it worked but i had to change between the original and this wpa if i wanted to connect to various wifi...
and your method worked but i changed the wpa_supplicant as wpa_supplicant was not working, and the permission i left it to be xxx xx xxx....
it is working perfectly... thank you for that wpa file....
 

HEXcube

Senior Member
Aug 18, 2012
118
48
58
hexcube.github.io
No need to modify wpa_supplicant

I changed data/misc/wifi/wpa_supplicant.conf instead of /system/bin/wpa_supplicant.
Step1:First i scanned my adhoc network using Wifi Manager. It shows adhoc networks. I ignored it's warning and tried to connect. It'll fail.No problem! We now have the adhoc network listed in wpa_supplicant.conf.
Note: you can skip this step if you know how to edit wpa_supplicant.conf manually or if your device already lists adhoc networks on scanning.
Step2: You'll need to root your device if you're doing this through your device itself. If you use adb you may not need to root your device.(I had root access by default through adb. So rooting the device wasn't necessary for me). If you're using pc(windows or linux), i recommend Android Commander. If you're doing this from device itself, use some Root Explorer and Terminal Emulator.
Pull and/or edit data/misc/wifi/wpa_supplicant.conf. Add the following line
ap_scan=2
Find line like
network={
ssid="your adhoc name"
bssid=*some value*
.
.
}
Delete bssid line.
Add/Change the following
scan_ssid=1
priority=50
mode=1
It'd be better if you delete all other network={} blocks.

Push back/save the modified file.
chown ownership back to system.wifi. Type the following in adb/Terminal Emulator
#chown system.wifi data/misc/wifi/wpa_supplicant.conf
Ok, done! Now you can turn on wifi and if the specified adhoc network is nearby, your device'll automatically connect to it. Don't scan for new networks. If you do, adhoc support will be lost and you'll have to start over again!
Advantage: Safer than modifying system/etc/wifi/wpa_supplicant binary. Saves you the trouble of compiling modified wpa_supplicant or finding a compiled one for your platform.
Drawback: This is just a temporary solution.You'll have to repeat this process for every new adhoc network as it doesn't enable adhoc forever. It is good for connecting to your home network or other known networks, but if you want to connect to any adhoc network you scan,then this is not your method. Because, wpa_supplicant.conf will be overwritten every time you scan a new network.
 
Last edited:

nariman1980

Member
Jan 28, 2011
14
0
21
Help

I followed the steps but its not working on my device xperia neo 4.0.4
any help
note :that I'm using my Nokia n8 for tethering through ezspot application
 

HEXcube

Senior Member
Aug 18, 2012
118
48
58
hexcube.github.io
Root Access Needed

I followed the steps but its not working on my device xperia neo 4.0.4
any help
note :that I'm using my Nokia n8 for tethering through ezspot application
is your Xperia rooted? Connect it to pc and open adb. If you get # as the prompt, you have root access from adb. If not type su on adb. Then you may get # prompt.
If you're having root access you could do the above steps and get it working.
 
  • Like
Reactions: nariman1980

nariman1980

Member
Jan 28, 2011
14
0
21
is your Xperia rooted? Connect it to pc and open adb. If you get # as the prompt, you have root access from adb. If not type su on adb. Then you may get # prompt.
If you're having root access you could do the above steps and get it working.
yes i have a rooted device .i followed the steps and copied wpa-supplicant and the result was that my wireless not working at all .
 

HEXcube

Senior Member
Aug 18, 2012
118
48
58
hexcube.github.io
Modify wpa_supplicant.conf

Note that the method mentioned by Maxxd01 is different from the one i suggest. In Maxxd01's method you'll need to change /system/bin/wpa_supplicant. You'll have to find one for your specific device and platform or compile from source. Your Xperia will need a wpa_supplicant binary compiled for it. If you can find it follow the first method.
For my method, edit /data/misc/wifi/wpa_supplicant.conf as i said in the previous post. It seems you didn't do the chown properly.
 

nariman1980

Member
Jan 28, 2011
14
0
21
I changed data/misc/wifi/wpa_supplicant.conf instead of /system/bin/wpa_supplicant.
Step1:First i scanned my adhoc network using Wifi Manager. It shows adhoc networks. I ignored it's warning and tried to connect. It'll fail.No problem! We now have the adhoc network listed in wpa_supplicant.conf.
Note: you can skip this step if you know how to edit wpa_supplicant.conf manually or if your device already lists adhoc networks on scanning.
Step2: You'll need to root your device if you're doing this through your device itself. If you use adb you may not need to root your device.(I had root access by default through adb. So rooting the device wasn't necessary for me). If you're using pc(windows or linux), i recommend Android Commander. If you're doing this from device itself, use some Root Explorer and Terminal Emulator.
Pull and/or edit data/misc/wifi/wpa_supplicant.conf. Add the following line
ap_scan=2
Find line like
network={
ssid="your adhoc name"
bssid=*some value*
.
.
}
Delete bssid line.
Add/Change the following
scan_ssid=1
priority=1
mode=1

Push back/save the modified file.
chown ownership back to system.wifi. Type the following in adb/Terminal Emulator
#chown system.wifi data/misc/wifi/wpa_supplicant.conf
Ok, done! Now you can turn on wifi and if the specified adhoc network is nearby, your device'll automatically connect to it. Don't scan for new networks. If you do, adhoc support will be lost and you'll have to start over again!
Advantage: Safer than modifying system/etc/wifi/wpa_supplicant binary. Saves you the trouble of compiling modified wpa_supplicant or finding a compiled one for your platform.
Drawback: This is just a temporary solution.You'll have to repeat this process for every new adhoc network as it doesn't enable adhoc forever. It is good for connecting to your home network or other known networks, but if you want to connect to any adhoc network you scan,then this is not your method. Because, wpa_supplicant.conf will be overwritten every time you scan a new network.
Thank you and I'm sorry cause i didn't read your previous reply .
As i understand that no need to copy wpa-supplicant anymore . And should edit the other wpa file .but i didn't understand what do you mean by adb emulater ? I'm new in Android and have no experience with it before so please don't feel boring from me if i ask any question .
I'm glad cause you're helping me thanks
 

nariman1980

Member
Jan 28, 2011
14
0
21
I did as you mentioned
and for the first time i see the Wifi name of my Nokia n8 in Wifi scan
note :when i was scanning for Wifi spot before ,my Wifi didn't show the name at all .
But now after the scanning shows the name of the Wifi spot ,it couldn't connect and this is an image from my device

then i go back to wpa-supplicant.conf and realized that all data which i add has gone and new data has been written
note :"nariman"is the new Wifi spot and the other one is neighbor's Wifi spot .

what should i do next ?
 

HEXcube

Senior Member
Aug 18, 2012
118
48
58
hexcube.github.io
Use this wpa_supplicant.conf

Content of modified wpa_supplicant.conf(changes in bold)

ctrl_interface=wlan0
update_config=1
device_type=0-00000000-0
ap_scan=2

network={
ssid="nariman"
scan_ssid=1
key_mgmt=NONE
group=WEP104 WEP40
auth_alg=OPEN SHARED
wep_key0="09674"
mode=1
priority=1

}

After pushing the modded wpa_supplicant.conf don,t forget to change ownership and group back to original ones by doing
chown system.wifi /data/misc/wifi/wpa_supplicant.conf
or else wifi'll show error.
remember, don't scan for networks after turning on wifi. Keep the adhoc network ready and turn on wifi. It'll automatically connect. I hope you didn't change the name and password of adhoc network.I've included modded wpa_supplicant.conf along with an explanation wpa_supplicant.conf(in case you were wondering what this stuff is all about).

---------- Post added at 12:27 AM ---------- Previous post was at 12:01 AM ----------

If you find it difficult try first with open adhoc. In which case your wpa_supplicant.conf would look like

ctrl_interface=wlan0
update_config=1
device_type=0-00000000-0
ap_scan=2

network={
ssid="your_adhoc_name"
scan_ssid=1
key_mgmt=NONE
mode=1
priority=1

}
 

Attachments

Last edited:
  • Like
Reactions: ppc.addon

nariman1980

Member
Jan 28, 2011
14
0
21
Hi and Thank you again
i follow the steps

then i turned my Wifi on and didn't scan ,the name of my adhoc was there but no connection done. Only "not in range"is written under it and i don't know what does it mean
i press on adhoc nariman and this image shows the result

i think there's something stuck but i don't know what it is and what to do
waiting your opinion to solve this problem
 

HEXcube

Senior Member
Aug 18, 2012
118
48
58
hexcube.github.io
I have Wifi manager ,does it help ?
Wifi Manager is of great use. It show/lists adhoc networks,but does'nt connect to it.It causes the name of adhic networks to appear in wpa_supplicant.conf-that's great help coz u don't have to manually edit wpa_supplicant.conf to add the network name. But you still have to add the lines which i mentioned in the previous post(the bold ones).
 

HEXcube

Senior Member
Aug 18, 2012
118
48
58
hexcube.github.io
wpa_supplicant_info?

wpa_supplicant_info? Where did you find that file? Don't your fone have wpa_supplicant.conf?You should edit wpa_supplicant.conf in /data/misc/wifi. If there's any change in the files your fone have please tell me.
Don't edit the file while wifi is on. Turn wifi off and edit.
And after pushing the modified file you should change the ownership back to original, not the permissions.
Do the following using adb or Terminal Emulator as su
#chown system.wifi /data/misc/wifi/wpa_supplicant.conf
after doing this check the properties of file and make sure ownership is system wifi and not root root.
 
Last edited:

nicolmeni

New member
Nov 25, 2012
2
0
0
Thanks!!!

I changed data/misc/wifi/wpa_supplicant.conf instead of /system/bin/wpa_supplicant.
Step1:First i scanned my adhoc network using Wifi Manager. It shows adhoc networks. I ignored it's warning and tried to connect. It'll fail.No problem! We now have the adhoc network listed in wpa_supplicant.conf.
Note: you can skip this step if you know how to edit wpa_supplicant.conf manually or if your device already lists adhoc networks on scanning.
Step2: You'll need to root your device if you're doing this through your device itself. If you use adb you may not need to root your device.(I had root access by default through adb. So rooting the device wasn't necessary for me). If you're using pc(windows or linux), i recommend Android Commander. If you're doing this from device itself, use some Root Explorer and Terminal Emulator.
Pull and/or edit data/misc/wifi/wpa_supplicant.conf. Add the following line
ap_scan=2
Find line like
network={
ssid="your adhoc name"
bssid=*some value*
.
.
}
Delete bssid line.
Add/Change the following
scan_ssid=1
priority=50
mode=1
It'd be better if you delete all other network={} blocks.

Push back/save the modified file.
chown ownership back to system.wifi. Type the following in adb/Terminal Emulator
#chown system.wifi data/misc/wifi/wpa_supplicant.conf
Ok, done! Now you can turn on wifi and if the specified adhoc network is nearby, your device'll automatically connect to it. Don't scan for new networks. If you do, adhoc support will be lost and you'll have to start over again!
Advantage: Safer than modifying system/etc/wifi/wpa_supplicant binary. Saves you the trouble of compiling modified wpa_supplicant or finding a compiled one for your platform.
Drawback: This is just a temporary solution.You'll have to repeat this process for every new adhoc network as it doesn't enable adhoc forever. It is good for connecting to your home network or other known networks, but if you want to connect to any adhoc network you scan,then this is not your method. Because, wpa_supplicant.conf will be overwritten every time you scan a new network.


Only want to say you THANKS THANKS THANKS!!! I have a china mobile Start W008+ and conect to my wifi adhoc perectly!!!! Thanks again!!!
 

entity99

New member
Jan 3, 2013
1
0
0
connectify ..the wpa_supplicant route...opps

well I did exactly what i read......and it returned alot of ehh
"settings not working android-ishhh" ...messages...everysingle time..so i just back tracked.....and fixed it..

still cant see the connectify hotspot...thanks anyway

Sent from galaxy ace GT5830:p