Jump to content


Photo

How to connect to Ad-hoc network (android 2.2)


  • Please log in to reply
71 replies to this topic

#1 Zoppatorslk

Zoppatorslk

    Member

  • Jr. Member
  • PipPip
  • 27 posts

Posted 20 May 2011 - 02:09 PM

Don't know if this is already posted, but here it goes.

For this to work you need to have a rooted device and you need write access to the file:
/system/etc/wifi/wpa_supplicant.conf

This is how it should look, note that i in this example don't use any WEP encryption


ctrl_interface=DIR=/data/system/wpa_supplicant GROUP=wifi
update_config=1
ap_scan=2

network={
ssid="Ad-hoc ssid here"
scan_ssid=1
key_mgmt=NONE
mode=1
priority=1
}
network={
ssid="Your Accesspoint ssid here"
psk="your wpa key here"
key_mgmt=WPA-PSK
priority=2
}


I use this to tether to my iphone 4.
If i turn off the tethering on the phone i need to turn the wifi off and on again for the tab to find my accesspoint again.

If you want to use WEP try to add this wep_key0="insert your key here" in the network section of the ad-hoc network.

Hopefully this will help someone out.

Edited by Zoppatorslk, 20 May 2011 - 02:10 PM.

  • bithalver likes this

#2 keijames

keijames

    Advanced Member

  • Jr. Member
  • PipPipPip
  • 57 posts
  • LocationHong Kong

Posted 20 May 2011 - 10:06 PM

Did you try on 2.3 Rom ?

Sent from my LT15i using Tapatalk
APAD IMX515 freescale A8 - gingerbread 2.3.3 stock ROM.
Hipad M7+ 16GB - gingerbread 2.3.1 0531 ROM rooted.

#3 Zoppatorslk

Zoppatorslk

    Member

  • Jr. Member
  • PipPip
  • 27 posts

Posted 21 May 2011 - 06:14 AM

No i have not. Dont got any microsd card so i cant flash. I think its also a good idea to set the network you use most to priority 1.

#4 Yutani

Yutani

    Advanced Member

  • Jr. Member
  • PipPipPip
  • 35 posts
  • LocationSweden

Posted 21 May 2011 - 04:08 PM

When I try to edit wpa_supplicant.conf using ES File Explorer I just get the message; "Error occurred when getting file content: wpa_supplicant.conf".
My device is rooted, and I have enabled write-access for "/system" in ES.
Any ideas?


Edit: I got it to work! I created a txt-file called "wpa_supplicant" on my computer, and pasted what Zoppatorslk wrote into it (changing the SSID, etc.).
I then changed ".txt" to ".conf" and transfered the file to my tablet, replacing the old wpa_supplicant.conf with the new one.

Thank you so very much for sharing this, Zoppatorslk! :D I've been looking for a way to tether my tablet to my iPhone for quite some time!

Edited by Yutani, 21 May 2011 - 04:29 PM.


#5 Zoppatorslk

Zoppatorslk

    Member

  • Jr. Member
  • PipPip
  • 27 posts

Posted 21 May 2011 - 04:15 PM

yes, try this:
stop wlan, copy the file somewhere else (and make a backup just in case), edit the file and copy it and overwrite the file in /system/etc/


Sent from my MID_Serails using Tapatalk

#6 Zoppatorslk

Zoppatorslk

    Member

  • Jr. Member
  • PipPip
  • 27 posts

Posted 28 May 2011 - 06:47 AM

Now confirmed working on 2.3

At work now and writing this teathered with my iPhone 4

ad-hoc network must have prio 1 it seems.

Also god to run chmod 666 on the file

Sent from my MID_Serials using Tapatalk

#7 yellobello

yellobello

    Member

  • Jr. Member
  • PipPip
  • 29 posts

Posted 29 May 2011 - 03:01 AM

FYI: I had the exact same problem with tehering. However, since a couple of releases, MyWi supports Infrastructure mode networks on iPhone 4 if you are on iOS >4.3 . I was on 4.2.1 and didn't notice, but an update to the latest fir
mware and keeping MyWi fresh let me open up an infrastructure network.

#8 anplugged

anplugged

    Newbie

  • Jr. Member
  • Pip
  • 5 posts

Posted 02 June 2011 - 02:25 AM

guys... i'm a bit noob... can u guys please help me.. I'm trying to do as guided by Zoppatorslk but still failed.. what the cmd/script should actually be...? my ad-hoc ssid is "N8-00" , my ssid accesspoint is "celcom3g" , and I'm using wep key... So, what actually the script should be like..?

Edited by anplugged, 02 June 2011 - 04:48 AM.


#9 Zoppatorslk

Zoppatorslk

    Member

  • Jr. Member
  • PipPip
  • 27 posts

Posted 03 June 2011 - 02:43 AM

Try to disable wep. If you get it working then you can try out the wep stuff. If your key is in hex, then dont use any " , if key is in ascii use " . I havent botherd with wep, but i think the implataion is limited.

It also seem to be abit harder to get it working good on gingerbread

#10 Aimevous

Aimevous

    Advanced Member

  • Jr. Member
  • PipPipPip
  • 67 posts

Posted 09 June 2011 - 01:50 PM

I think this is very useful. Can the mods sticky this? Took me some time to find back this thread...
Thanks Zoppatorslk for sharing!

#11 Alb3rt

Alb3rt

    Advanced Member

  • Jr. Member
  • PipPipPip
  • 80 posts

Posted 10 June 2011 - 04:14 PM

guys... i'm a bit noob... can u guys please help me.. I'm trying to do as guided by Zoppatorslk but still failed.. what the cmd/script should actually be...? my ad-hoc ssid is "N8-00" , my ssid accesspoint is "celcom3g" , and I'm using wep key... So, what actually the script should be like..?



The key with this is to make sure the priority is set with 1 as your ad-hoc network that your phone advertises.

Do not use WEP to begin with.

Set your other networks with priorities in order of preference for connecting.

remember the ap_scan=2 on the 3rd line of the config file.

Works a treat for me although MyWi for iPhone never shows any Active #User even though I am definately working fine.

Great job for posting this!

#12 Alb3rt

Alb3rt

    Advanced Member

  • Jr. Member
  • PipPipPip
  • 80 posts

Posted 11 June 2011 - 11:47 AM

The ap_scan=2 part vanished after connecting to my home infra wifi.

The chmod is probably useful to stop it reverting and also wep as I use it on another network I setup to test doesn't work with iPhone MyWi for me.

Sent from my MID_Serials using Tapatalk

#13 LegendSoUL

LegendSoUL

    Member

  • Jr. Member
  • PipPip
  • 29 posts

Posted 11 June 2011 - 02:20 PM

Sorry for my silly question, but what is the difference between "ad-hoc ssid" and "accesspoint ssid"?
Edit: this stuff is what I need to connect to my pc's internet connection, right? Do I need an extra device for this or just wifi ad-hoc connection?

I created an ad-hoc connection on my pc with ssid: vdroid, password: 12345678 and I tried the following but it didnt work:
ctrl_interface=DIR=/data/system/wpa_supplicant GROUP=wifi
update_config=1
ap_scan=2

network={
ssid="vdroid"
scan_ssid=1
key_mgmt=NONE
mode=1
priority=1
}
network={
ssid="vdroid"
psk="12345678"
key_mgmt=WPA-PSK
priority=2
}

Edit2: and I realised that my wifi pci doesnt let me choose WPA-PSK, I can only create a password for WPA-NONE.

Edit3: then finally tried only this with an adhoc without pass:
ctrl_interface=DIR=/data/system/wpa_supplicant GROUP=wifi
update_config=1
ap_scan=2

network={
ssid="vdroid"
scan_ssid=1
key_mgmt=NONE
mode=1
priority=1
}

and now pc and tablet try to connect to ad-hoc network but after few seconds both fails(pc first connects and then fails in 5 sec)...

Edit4: I saw that both my pc and tablet can't get any ip adress, so I tried to enter IPs manually(like 192.168.0.2 - 255.255.255.0 etc.) Still couldnt make it work!

Edit5: BTW I'm using WinXP on my laptop, and 2.3 Gingerbread on my tablet pc.
Wifi Analyzer can recognise the ad-hoc network as well. but no connection yet!

Edit6: After long hours of trying everything possible, I was able to connect to my ad-hoc network using Wifi Tether App(http://code.google.c...id-wifi-tether/). This app finally could give some IPs to my tablet and laptop, so I established an ad-hoc connection. However, I still can't get the internet connection from the laptop.

Edit7: Can anyone try it on 2.3 Gingerbread and let me know if they can connect internet through their PCs? I wonder if I have something wrong with my lan and internet sharing settings on my laptop.

Edited by LegendSoUL, 12 June 2011 - 05:51 PM.


#14 nbo

nbo

    Member

  • Jr. Member
  • PipPip
  • 13 posts

Posted 16 June 2011 - 03:08 AM

Hello Guys,

I've tried to make a Ad hoc connection between my laptop (with a Wifi card that doesn't support WPA in ad-hoc mode) and HeroTab C8 (installed C8lean V 0.7) as explained in this post (editing wpa_supplicant.conf file).

  • editing wpa_supplicant.conf
  • I've configured my laptop ad hoc (with no password key since it doesn't support WPA)
  • switch on the wifi in the tablet

the problem I've faced is that the tablet doesn't see the ad hoc network (I can only see in the list some AP of my neighbors).
Also in the tablet I've tried to add a network (same name then the ad hoc in the laptop) but it's listed out of range.

Can some one tell me what I'm doing wrong and explain to me the procedure with more details.
Thanks in advance for your help and support.

Edited by nbo, 16 June 2011 - 03:10 AM.


#15 LegendSoUL

LegendSoUL

    Member

  • Jr. Member
  • PipPip
  • 29 posts

Posted 16 June 2011 - 04:40 AM

@nbo, as I proved in my previous post, it's not possible to connect adhoc networks with 2.3 fw roms(unfortunately). That 's why I had to start using an older version of C8lean. I advise you to do the same. wpa supplicant surely willl work on 2.2 fw.

Edited by LegendSoUL, 16 June 2011 - 04:42 AM.


#16 fbelleri

fbelleri

    Advanced Member

  • Jr. Member
  • PipPipPip
  • 88 posts
  • LocationITA

Posted 16 June 2011 - 07:45 AM

Regardless the Android version, for several months, I simply use two separate files:
1. Normal networks
2. Special connection (adhoc) to my phone (Nokia5800 + JoikuSpot).

To me it is convenient, because the two kind of networks can not coexist (with the official software wpa_supplicant bin file) and then if you touch something in the network settings your file wpa_supplicant.conf is automatically changed by the system, and no longer works in AdHoc mode.

In etc/wif/ I have these files: wpa_supplicant.conf [in use], wpa_supplicant.conf.ADHOC and wpa_supplicant.conf.NORMAL.

So, what I have to do when I want switch from NORMAL to ADHOC network?
1 Disable the wifi network in settings.
2 With RootExplorer,
2.1 go to folder /etc/wifi/
2.2 long press on file wpa_supplicant.conf, when menu pop up, delete this file.
2.3 long press on file wpa_supplicant.conf.adhoc, when menu pop up, copy and paste.
2.4 long press on file "wpa_supplicant.conf.adhoc - Copy" and rename it to wpa_supplicant.conf
2.9 Start Joiku on your phone and wait 5 seconds (If not already started)
3 Enable the wifi network in settings.
4 After 2 seconds, the tablet should connect to the adhoc ap of the phone.
5 DO NOT use scan for netwoks in settings because it will auto modify your wpa..conf file erasing 'ap_scan=2' line.

What I have to do when I want change the network from ADHOC to NORMAL?
1 Disable the wifi network in settings
2 With RootExplorer,
2.1 go to folder /etc/wifi/
2.2 long press on file wpa_supplicant.conf, when menu pop up, delete this file.
2.3 long press on file wpa_supplicant.conf.normal, when menu pop up, copy and paste.
2.4 long press on file "wpa_supplicant.conf.normal - Copy" and rename it to wpa_supplicant.conf
3 Enable the wifi network in settings.
4 After 1/2 seconds, the tablet should connect to the ap of wifi network..

It works on Android 2.1, 2.2, 2.3 (I have used this way with my old A81E and with this HerotabC8, and it should works with every other tablets/phones that doesn't have wpa_supplicant [bin file] modded).

Geetings.
  • bithalver likes this


#17 nbo

nbo

    Member

  • Jr. Member
  • PipPip
  • 13 posts

Posted 16 June 2011 - 11:14 AM

Hello,

thank you very much for the clear explanation and details you shared with us.

I still have a doubt, you are talking about connection of the Android tablet to a phone (in your case Nokia 5800), and as I mentioned in my message I would like to connect to a Laptop, do you think that it work the same way?

also do you use any kind of key (WEP or WPA) or you are using an unsecured Ad-hoc connection?
Could you please copy and paste a copy of your wpa_supplicant.conf.ADHOC file that I can get it as a sample.

thanks

Regardless the Android version, for several months, I simply use two separate files:
1. Normal networks
2. Special connection (adhoc) to my phone (Nokia5800 + JoikuSpot).

To me it is convenient, because the two kind of networks can not coexist (with the official software wpa_supplicant bin file) and then if you touch something in the network settings your file wpa_supplicant.conf is automatically changed by the system, and no longer works in AdHoc mode.

In etc/wif/ I have these files: wpa_supplicant.conf [in use], wpa_supplicant.conf.ADHOC and wpa_supplicant.conf.NORMAL.

So, what I have to do when I want switch from NORMAL to ADHOC network?
1 Disable the wifi network in settings.
2 With RootExplorer,
2.1 go to folder /etc/wifi/
2.2 long press on file wpa_supplicant.conf, when menu pop up, delete this file.
2.3 long press on file wpa_supplicant.conf.adhoc, when menu pop up, copy and paste.
2.4 long press on file "wpa_supplicant.conf.adhoc - Copy" and rename it to wpa_supplicant.conf
2.9 Start Joiku on your phone and wait 5 seconds (If not already started)
3 Enable the wifi network in settings.
4 After 2 seconds, the tablet should connect to the adhoc ap of the phone.
5 DO NOT use scan for netwoks in settings because it will auto modify your wpa..conf file erasing 'ap_scan=2' line.

What I have to do when I want change the network from ADHOC to NORMAL?
1 Disable the wifi network in settings
2 With RootExplorer,
2.1 go to folder /etc/wifi/
2.2 long press on file wpa_supplicant.conf, when menu pop up, delete this file.
2.3 long press on file wpa_supplicant.conf.normal, when menu pop up, copy and paste.
2.4 long press on file "wpa_supplicant.conf.normal - Copy" and rename it to wpa_supplicant.conf
3 Enable the wifi network in settings.
4 After 1/2 seconds, the tablet should connect to the ap of wifi network..

It works on Android 2.1, 2.2, 2.3 (I have used this way with my old A81E and with this HerotabC8, and it should works with every other tablets/phones that doesn't have wpa_supplicant [bin file] modded).

Geetings.



#18 fbelleri

fbelleri

    Advanced Member

  • Jr. Member
  • PipPipPip
  • 88 posts
  • LocationITA

Posted 16 June 2011 - 03:44 PM

The file for adhoc mode is always the same; there are only 2 row that are really important:

ap_scan=2 search for all kind of access point
mode=1 this is an adhoc connection


************
ctrl_interface=DIR=/data/system/wpa_supplicant GROUP=wifi
update_config=1
ap_scan=2

network={
ssid="JoikuSpot_1"
scan_ssid=1
key_mgmt=NONE
wep_key0=1234567890
priority=1
mode=1
}
*********
In this file there is the wep encription enabled (key_mgmt=NONE == NO WPA; wep_key0... == WEP), with the 10 digit key without commas, because my phone tethering software can support only wep encription.

It should work also with your notebook, if you have enabled mixed mode of notebook's wifi card (working as an access point). Do you can test if it is working correctly?

Try "Virtual Access Point" software on your notebook.
Try changing the transmission channel in 11 on the notebook ... and never scan for networks on the tablet.
Try without encription, deleting the row wep_key0...

Edited by fbelleri, 17 June 2011 - 12:28 AM.

  • bithalver likes this


#19 androiddaw

androiddaw

    Newbie

  • Jr. Member
  • Pip
  • 5 posts

Posted 21 June 2011 - 08:48 AM

When I try to edit wpa_supplicant.conf using ES File Explorer I just get the message; "Error occurred when getting file content: wpa_supplicant.conf".
My device is rooted, and I have enabled write-access for "/system" in ES.
Any ideas?


Edit: I got it to work! I created a txt-file called "wpa_supplicant" on my computer, and pasted what Zoppatorslk wrote into it (changing the SSID, etc.).
I then changed ".txt" to ".conf" and transfered the file to my tablet, replacing the old wpa_supplicant.conf with the new one.

Thank you so very much for sharing this, Zoppatorslk! :D I've been looking for a way to tether my tablet to my iPhone for quite some time!


Hi Yutani/Zoppatorslk,

I have tried using your technic but somehow i still cannot connect/tether my tablet to my iphone4(4.3.3/not jailbreak) any ideas? I also use ES File Explorer and rooted the device/file ...is it possible can you please share the file wpa_supplicant.conf or post it ? just to make sure I'm doing it right... Thank you for sharing this information, i've been looking this information .

#20 krs

krs

    Newbie

  • Jr. Member
  • Pip
  • 3 posts

Posted 25 June 2011 - 05:10 AM

I hope some one can kindly help me out with my problem.

I want to connect to a 3g wifi hotspot called a Huawei E585 MiFi on the 3 network in the UK.

I'm running the latest 607 firmware.

The tablet see the device when I scan for networks and I enter the correct password but then I cannot connect. It maybe I need to enter more settings but I don't know what settings.

Thanks in advance.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users