FORUMS
Remove All Ads from XDA

[IMPROVED FIX] ADHOC Mode with scripts to switch between ADHOC and Infrastructure

155 posts
Thanks Meter: 42
 
By johnopsec, Senior Member on 14th December 2010, 10:35 AM
Post Reply Email Thread
This -> adhoc-switcher.zip <- archive includes the modified wpa_supplicant file that supports ADHOC mode, along with scripts to switch back and forth between the ADHOC mode wpa_supplicant and the stock (Infrastructure only) wpa_supplicant on your NC.

The included file adhoc-switcher.sh is will do all of the work for you.

From the included README file:

Unzip the archive adhoc-switcher.zip into the same directory as your adb binary.

Execute ./adhoc-switcher.sh in your adb binary directory.

# md5sum adhoc-switcher.zip
e682e1578df1a253f1e4c42fd89f37d5 adhoc-switcher.zip


When you run adhoc-switcher.sh, you will see the following output telling you what it is doing:

Code:
$ ./adhoc-switcher.sh 

(1) Remounting /system as read-write...

(2) Making backup of original wpa_supplicant at:
/system/bin/wpa_supplicant.original...

(3) Making local backup of /system/bin/wpa_supplicant.original...

2070 KB/s (226036 bytes in 0.106s)

(4) Pushing up new files to /system/bin/...

wpa_supplicant.adhoc: 1662 KB/s (226028 bytes in 0.132s)
wpa_supplicant.infrastructure: 1711 KB/s (226036 bytes in 0.128s)
ap: 6 KB/s (271 bytes in 0.042s)
adhoc: 6 KB/s (253 bytes in 0.040s)

(5) Setting permissions on new files in /system/bin/...

(6) Setting Wifi mode to Infrastructure (ap)...

(7) Remounting /system as read-only...

All done!
To switch between Access Point (AP) [Infrastructure] mode and ADHOC mode,
execute the following commands on your NC:

# su
# ap

To switch to Access Point [Infrastructure] mode, execute the following
commands on your NC:

# su
# adhoc

You should turn off wifi before executing these commands.



Hope you find this useful.

John - your friendly neighborhood e-thug.
The Following 11 Users Say Thank You to johnopsec For This Useful Post: [ View ] Gift johnopsec Ad-Free
 
 
14th December 2010, 03:37 PM |#2  
Member
Thanks Meter: 0
 
More
Thank you. Will give this a try.
Any chance of anyone creating a toggle widget that can toggle between both with a simple tap.

Sent from my SGH-T959 using XDA App
14th December 2010, 03:40 PM |#3  
Member
Thanks Meter: 4
 
More
Very nice John. Good quick fix for the adhoc switching. Appreciate the effort.

Sent from the totally awesome Rooted Nook Color
14th December 2010, 03:54 PM |#4  
OP Senior Member
Thanks Meter: 42
 
More
Quote:
Originally Posted by rxr

Thank you. Will give this a try.
Any chance of anyone creating a toggle widget that can toggle between both with a simple tap.

Sent from my SGH-T959 using XDA App

I'd love to do that but, my netbook just isn't up to the task of running a full-on android dev environment. Over Christmas, I'll try to remember to bring the "big" laptop back with me.

If someone else beats me to it, that would be great too.
14th December 2010, 04:20 PM |#5  
likearaptor's Avatar
Senior Member
Thanks Meter: 157
 
More
Maybe we could get the SoftKeys app to allow a new button to appear to toggle the wifi setting?
14th December 2010, 04:49 PM |#6  
Member
Thanks Meter: 9
 
More
Quote:
Originally Posted by johnopsec

This -> Attachment 464007 <- archive includes the modified wpa_supplicant file that supports ADHOC mode, along with scripts to switch back and forth between the ADHOC mode wpa_supplicant and the stock (Infrastructure only) wpa_supplicant on your NC.

Hey there, Mr. eThug. Thanks for the update. But I didn't it was necessary. After installing the original fixed wpa_supplicant, I can connect to adhoc and infrastructure networks. Or is there something else I'm missing?
14th December 2010, 04:55 PM |#7  
OP Senior Member
Thanks Meter: 42
 
More
Quote:
Originally Posted by edison

Hey there, Mr. eThug. Thanks for the update. But I didn't it was necessary. After installing the original fixed wpa_supplicant, I can connect to adhoc and infrastructure networks. Or is there something else I'm missing?

The ADHOC capable wpa_supplicant has a bug that requires you restart wifi any time the NC sleeps. The original does not. Since my personal use is with standard Infrastructure (AP) connections primarily and ADHOC only on occasion, I decided that it would be handy to be able to switch between them easily.
14th December 2010, 08:32 PM |#8  
KitF's Avatar
Senior Member
Thanks Meter: 79
 
Donate to Me
More
You have a typo in the script, line 28 I think, should be "adb shell" and you have "db" shell.

Messes with permissions.
14th December 2010, 09:03 PM |#9  
OP Senior Member
Thanks Meter: 42
 
More
Quote:
Originally Posted by KitF

You have a typo in the script, line 28 I think, should be "adb shell" and you have "db" shell.

Messes with permissions.

I just verified from my local copy and also downloaded the archive I uploaded to the site. They're identical and in every instance, it is "./adb shell" just as it should be.

Any possibility you opened adhoc-switcher.sh in an editor and accidently deleted a character? Other than that, the MD5SUM of the original archive is:

# md5sum adhoc-switcher.zip
e682e1578df1a253f1e4c42fd89f37d5 adhoc-switcher.zip

Make sure that the MD5SUM matches for what you downloaded.
14th December 2010, 09:31 PM |#10  
KitF's Avatar
Senior Member
Thanks Meter: 79
 
Donate to Me
More
Oh that's right, I must have messed it up somehow converting it into a windows Batch file.

Any way we can get some sort of GUI app or a widget toggle for this? Seems like it would be handy for when I need to tether to my phone when there's no wifi around.
14th December 2010, 10:25 PM |#11  
OP Senior Member
Thanks Meter: 42
 
More
Quote:
Originally Posted by KitF

Oh that's right, I must have messed it up somehow converting it into a windows Batch file.

Any way we can get some sort of GUI app or a widget toggle for this? Seems like it would be handy for when I need to tether to my phone when there's no wifi around.

Cool. Glad we tracked that down!

I'd love a widget or app to switch between them. Two things though... This is a temporary "fix" for an issue. Once they get the bugs worked out of wpa_supplicant so it can support Infrastructure and ADHOC and not have the sleep issue, we won't need to switch back and forth between them. Second: I don't have a full-blown android dev platform to do an app or widget myself so, someone else would need to do it.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes