mmorciegov / android-wifi-tether

Automatically exported from code.google.com/p/android-wifi-tether
7 stars 3 forks source link

add adhoc-only ("client") mode #165

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I oftentimes need to attach my phone to my laptop (via ad-hoc wifi) for 
'inverse tethering'. I spent several hours in trying to get my laptop's 
wifi card into 'softAP' mode (thus just using the regular android wifi 
client to attach to this 'fake' access point) to no avail.

The only semi-working solution I found so far has been via simply 
commenting out most stuff from the tether shell script - everything but 
wlan.ko insertion (which seems key to all and any adhoccing) - and 
ifconfig. I got the adhoc part working - with static ip, but enough to let 
GMote shine. What's missing, besides a dhcp client, is the routing (a.k.a. 
default gateway) part. 

Seeing how there's *no* readymade solution whatsoever to achieve just this 
(connecting to a plain old adhoc peer that provides the interwebz) and that 
Wifi Tether is so amazingly stable and, well, just all-around awesome, and 
given that it would only be a matter of a slight variation in the script 
(perhaps with added route commands? Unfortunately I can't tell an apple 
from a cathedral in *nix...) and a nice button in the Android UI.......

...might it be a worthy enhancement? ;)

Original issue reported on code.google.com by marklo...@gmail.com on 3 Oct 2009 at 9:53

GoogleCodeExporter commented 9 years ago
Windows indeed only supports Client and Ad-hoc modes. You need to install the
proprietary wifi manager for your card to set up a real AP, which all major 
chips can
do. 
To make your phone support adhoc, use one of these:

Easy mode:
http://moss.csc.ncsu.edu/~mueller/rt/rt09/readings/projects/g3/
Download AdhocClient.zip, extract AdhocClient.apk out of it, install it on the 
phone.

Hard mode:
http://modmygphone.com/forums/showthread.php?t=22681
Plug and pray.

Original comment by zwzser...@gmail.com on 2 Nov 2009 at 7:13

GoogleCodeExporter commented 9 years ago
Well, thanks for the answer - which I just saw, sorry for the late reply.
I have spent more time I care to admit on the problem. No doubt all major chips 
support soft AP mode at the hardware level (trivial thing to do) - too bad 
there's NO 
driver support whatsoever (me speakz windozese); whatever was there got pulled 
away 
since 2005 or so. Just have a look at this:

http://209.85.229.132/search?q=cache:-rqo7DYG7voJ:www.wi-
fiplanet.com/columns/article.php/1026261+intel+3954abg+softap&cd=3&hl=en&ct=clnk
&gl=i
t&lr=lang_en

then see the date at the bottom and cry with me. As a matter of fact, if I 
didn't 
have better things to waste my time into, I'd see a worthy (at long last) 
m$/intel-
backed conspiracy in this - feel free to google on the matter.

At any rate, if somehow you do happen to know of some (Windows) driver that 
allows 
soft AP for plain ol' & unassuming Intel 3954abg, by all means please share.

AdhocClient doesn't work and needs some serious rewriting - the 'hard' way is 
the 
only one that ever worked for me - for two glorious days. Anyway, having to 
rewrite 
tiwlan.conf & wpasupplicant.conf then more or less randomly rebooting twice a 
day 
gets old fast.

So I decided to do it the sucker's way: I'm eagerly awaiting for a chance to 
grab an 
old unused AP from my friends/parents/whatever. Yay. I lose.

Original comment by marklo...@gmail.com on 8 Nov 2009 at 2:38

GoogleCodeExporter commented 9 years ago
Hope this helps someone out there.

I have a SmartQ V7, with Android 2.1 Update 1, Linux 5.5 Update and WinCE 3.0. 
But if you have an Andoroid tablet with 2.1, it may work for you too. I also 
have a rooted android telephone acting as an ad-hoc access point (tethered 3G).

I thought I might inform you that the on the SmartQ V7, Android 2.1 did not 
include the "pand" executable in the distribution to be able to connect to a 
bluetooth PAN. I managed to do this by having a debian or ubuntu installation 
also running on the android tablet device in a chroot environment, but the 
debian/ubuntu installation is a whole other ballgame.

After fumbling and tumbling with the device (I got pretty frustrated at the 
tablet and very much wanted to slam it on the floor), I was able to connect via 
wifi to my android phone which is running the google wifi ad-hoc tether.

If you would like to try this on your tablet (at your own risk, of course), 
this is pretty much what needs to be done.

First of all, if you haven't done so already, you need to root your device. I 
found a nice application at the android market that did this automatically for 
my tablet called "z4root". Download and install it from the market. Run the 
z4root program and either root the device permanently (I chose this option) or 
temporarily. I don't know what their definition of "temporarily" is, so it may 
"unroot" itself at a later time. To play it safe, after this procedure I shut 
down my tablet and then turned it back on. If you have a nearby wifi access 
point that you normally connect to and have it "remembered", proceed to have 
that one "forgotton" in your wifi settings and while in your wifi settings, you 
must "add a wifi networkt", providing your ad-hoc network's essid (case 
sensitive), the 13 character WEP code assigned on the ad-hoc access point and 
under the security clicker you must select "WEP" and then press "Save". Make 
sure your wifi is "on" and not connected to any network (access point). Press 
your back key until you return to your main desktop.

To connect using a usb data cable and adb, as the V7 only has one usb type A 
female (typical usb host connector), go into the tablet's menu and select 
"Settings", then select Usb Otg Setting and select and press the "OTG Device 
Mode" option on your tablet. Use your back key until you return to your main 
desktop. For this to work, your computer must have adb installed (I believe it 
works on computers with windows, mac os and linux platforms. Googling "android 
adb" or "your platform" and adb will assist you in this respect.

Once connected, open a command prompt, an xterminal or a shell window and type 
"adb devices" and should provide response with your device's identification.

If your device was detected, then proceed as below. My wifi adapter comes in as 
"eth0", you can replace it with your particular device if not the same.
# adb remount
# adb root
# adb shell iwconfig eth0 mode ad-hoc essid [your essid name only, don't 
include what is in the brackets] key s:xxxxxxxxxxxxx [your 13 character WEP 
code] ; ifconfig eth0 up.

After giving the last command above, you may have to wait up to about a minute, 
but if you are in luck, you should now see your wifi icon running on your top 
bar and the wifi tether application on your android phone should have informed 
you of a new connection. The first time or so, if your wifi icon does not 
appear, you may have to turn your wifi adapter off and then back on once or 
twice, but be patien, please, as it sometimes can take a while to complete, and 
also try running the above "adb" commands again. I hope it works for you too.

If and when you get your wifi icon, you can verify in "Settings", under Wifi, 
you should see that it is connected to your ad-hoc access point (the android 
telephone). You should then attempt to run your browser, check your e-mail or 
any other internet application to verify you have successfully connected to 
your tethered android telephone. Your speed will be limited to your telephone's 
data connection (EVDO, 3G, 4G, etc.). My 3G does pretty good on the tablet. I 
have been able to run browsers, the tablet's original browser as well as the 
both available versions of Opera, Yahoo Messenger/Mail, Google Mail, Market, 
pretty much everything on the device.

Good luck to you all, migua.
migua001@gmail.com

Original comment by migua...@gmail.com on 30 Nov 2010 at 6:22