WiFi ad hoc interface

35 views
Skip to first unread message

Anders Nilsson Plymoth

unread,
Apr 28, 2009, 12:24:59 PM4/28/09
to android-platform
Hi,

Maybe platform is the right forum for this.

I wonder what the development and release plans are for an interface
that allows you to configure an ad hoc connection. You can already do
this on ADP by changing the wifi configuration and reload using
wlan_loader. However, this is not something a normal user can do.

What are current status of the plans for this?
If I wanted to add this feature to framework myself, what would be the
best release/tag to use? Any pointers to the location of the WiFi UI
interface files would be appreciated.

Thanks,
Anders

Jason Parekh

unread,
Apr 29, 2009, 1:09:27 PM4/29/09
to android-...@googlegroups.com
Hi Anders,

Last I heard, ad-hoc is not being worked on.

If you're interested in adding it in, there are a couple layers you'll
need to touch:

- Java Wi-Fi framework: WifiService.java that lives in
http://android.git.kernel.org/?p=platform/frameworks/base.git;a=tree;f=services/java/com/android/server;h=a4d1f2dcdf7eb4504436860257be63e2374a1690;hb=HEAD
- Wi-Fi settings (the UI):
http://android.git.kernel.org/?p=platform/packages/apps/Settings.git;a=tree;f=src/com/android/settings/wifi;h=deaf0389d46024aacddb8a52c10df8493e1c2151;hb=HEAD

I believe the lower layers (wpa_supplicant and the driver) should work
without much modification (if any).

I would start at wpa_supplicant:
- turn wifi off
- add an ad-hoc network to wpa_supplicant.conf (lives at
/data/misc/wifi/wpa_supplicant.conf on your device)
- turn wifi on
(the turning wifi off before and on afterwards is important)

If this goes well, it's a matter of punching through ad-hoc support in
the java framework and in wifi settings, which shouldn't be too
difficult.

Hope this helps,
jason

drew...@gmail.com

unread,
Apr 30, 2009, 1:47:32 PM4/30/09
to android-platform
Hi,

I have submitted a patch to master branch that will enable support of
Wifi Adhoc support through the wpa_supplicant.conf.
You can find it at:

https://review.source.android.com/9714

comments & suggestions welcome.

- Drew

On Apr 29, 1:09 pm, Jason Parekh <jasonpar...@gmail.com> wrote:
> Hi Anders,
>
> Last I heard, ad-hoc is not being worked on.
>
> If you're interested in adding it in, there are a couple layers you'll
> need to touch:
>
> - Java Wi-Fi framework:  WifiService.java that lives inhttp://android.git.kernel.org/?p=platform/frameworks/base.git;a=tree;...
> - Wi-Fi settings (the UI):http://android.git.kernel.org/?p=platform/packages/apps/Settings.git;...
>
> I believe the lower layers (wpa_supplicant and the driver) should work
> without much modification (if any).
>
> I would start at wpa_supplicant:
> - turn wifi off
> - add an ad-hoc network to wpa_supplicant.conf (lives at
> /data/misc/wifi/wpa_supplicant.conf on your device)
> - turn wifi on
> (the turning wifi off before and on afterwards is important)
>
> If this goes well, it's a matter of punching through ad-hoc support in
> the java framework and in wifi settings, which shouldn't be too
> difficult.
>
> Hope this helps,
> jason
>
> On Tue, Apr 28, 2009 at 12:24 PM, Anders Nilsson Plymoth
>

Anders Nilsson Plymoth

unread,
Apr 30, 2009, 1:59:08 PM4/30/09
to android-...@googlegroups.com
Hi,

Great!!. I will have a look at it.
Does this code also support the user to configure their own IP address and mask? Often DHCP is unavailable for two local devices, so setting a static IP is sometimes preferable.

Thanks,
Anders

Nick Pelly

unread,
Apr 30, 2009, 2:08:09 PM4/30/09
to android-...@googlegroups.com
How do you avoid collisions with static IP? Zeroconf might be a more
reliable option to configure IP addresses for adhoc mode. Or a
lightweight DHCP server.

Nick

drew...@gmail.com

unread,
Apr 30, 2009, 3:11:41 PM4/30/09
to android-platform
The patch only allows you to set up the parameters necessary for
creating/associating with an Adhoc network. It does not change any
logic around DHCP or static IP addresses. You can use static IP
addresses by setting the Static IP parameter and IP address, Gateway,
Mask, and everything else either programmatically in an application or
through the Settings Application (WifiSettings->Advanced screen). If
you want to use DHCP for addresses, you will need to run a DHCP
server. If you don't the connection will fail after association.

Also, another note, when being the initiator of the Adhoc network, the
device will not show itself as connected until another device becomes
associated with it so that it can run DHCP or static IP
configuration. Only then will a NetworkConnected event be broadcast.

- Drew


On Apr 30, 2:08 pm, Nick Pelly <npe...@google.com> wrote:
> How do you avoid collisions with static IP? Zeroconf might be a more
> reliable option to configure IP addresses for adhoc mode. Or a
> lightweight DHCP server.
>
> Nick
>
> On Thu, Apr 30, 2009 at 10:59 AM, Anders Nilsson Plymoth
>
> <lanils...@gmail.com> wrote:
> > Hi,
>
> > Great!!. I will have a look at it.
> > Does this code also support the user to configure their own IP address and
> > mask? Often DHCP is unavailable for two local devices, so setting a static
> > IP is sometimes preferable.
>
> > Thanks,
> > Anders
>
> > On Thu, Apr 30, 2009 at 7:47 PM, drew...@gmail.com <drew.jac...@gmail.com>

Anders Nilsson Plymoth

unread,
May 12, 2009, 12:46:45 PM5/12/09
to android-...@googlegroups.com
Hi,

Thanks Drew!
Is there any plans for applying the patch into the main development tree, so that this functionality can be included in future OTAs?

I receive inquires from users and developers all the time, who want to see this functionality in Android. There is a BIG demand for it.

Thanks,
Anders

drew...@gmail.com

unread,
May 15, 2009, 2:33:09 PM5/15/09
to android-platform
Unfortunately, I don't have control over what gets placed into the
main development tree. Someone at google would have to answer that
question.

If you get a chance to apply the patch to your own branch, please let
me know how it works for you. I am interested in receiving feedback
from anyone that uses it so that I can refine and enhance it's
usability.

- Drew

On May 12, 12:46 pm, Anders Nilsson Plymoth <lanils...@gmail.com>
wrote:
> Hi,
>
> Thanks Drew!
> Is there any plans for applying the patch into the main development tree, so
> that this functionality can be included in future OTAs?
>
> I receive inquires from users and developers all the time, who want to see
> this functionality in Android. There is a BIG demand for it.
>
> Thanks,
> Anders
>
> On Thu, Apr 30, 2009 at 12:11 PM, drew...@gmail.com
> <drew.jac...@gmail.com>wrote:

Leo

unread,
May 17, 2009, 11:18:43 PM5/17/09
to android-platform
Hi,

There are two questions.
1/ If the Android phone just creates an ad-hoc network (sending out
the beacon) but no other ad-hoc stations connected to it, what is the
current Wi-Fi status? Is it connected or not?

2/ Then when other ad-hoc stations connectes to the Android phone, are
there any events sent out through the wpa_supplicant to the Android Wi-
Fi framework or Application?

Best regards,
Leo

On May 16, 2:33 am, "drew...@gmail.com" <drew.jac...@gmail.com> wrote:
> Unfortunately, I don't have control over what gets placed into the
> main development tree.  Someone at google would have to answer that
> question.
>
> If you get a chance to apply the patch to your own branch, please let
> me know how it works for you.  I am interested in receiving feedback
> from anyone that uses it so that I can refine and enhance it's
> usability.
>
> - Drew
>
> On May 12, 12:46 pm, Anders Nilsson Plymoth <lanils...@gmail.com>
> wrote:
>
>
>
> > Hi,
>
> > Thanks Drew!
> > Is there any plans for applying the patch into the main development tree, so
> > that this functionality can be included in future OTAs?
>
> > I receive inquires from users and developers all the time, who want to see
> > this functionality inAndroid. There is a BIG demand for it.
> > > > >> > Last I heard,ad-hocis not being worked on.
>
> > > > >> > If you're interested in adding it in, there are a couple layers
> > > you'll
> > > > >> > need to touch:
>
> > > > >> > - Java Wi-Fi framework:  WifiService.java that lives
> > > > >> > inhttp://
> > >android.git.kernel.org/?p=platform/frameworks/base.git;a=tree;...
> > > > >> > - Wi-Fi settings (the
> > > > >> > UI):
> > >http://android.git.kernel.org/?p=platform/packages/apps/Settings.git;...
>
> > > > >> > I believe the lower layers (wpa_supplicant and the driver) should
> > > work
> > > > >> > without much modification (if any).
>
> > > > >> > I would start at wpa_supplicant:
> > > > >> > - turn wifi off
> > > > >> > - add anad-hocnetwork to wpa_supplicant.conf (lives at
> > > > >> > /data/misc/wifi/wpa_supplicant.conf on your device)
> > > > >> > - turn wifi on
> > > > >> > (the turning wifi off before and on afterwards is important)
>
> > > > >> > If this goes well, it's a matter of punching throughad-hocsupport
> > > in
> > > > >> > the java framework and in wifi settings, which shouldn't be too
> > > > >> > difficult.
>
> > > > >> > Hope this helps,
> > > > >> > jason
>
> > > > >> > On Tue, Apr 28, 2009 at 12:24 PM, Anders Nilsson Plymoth
>
> > > > >> > <lanils...@gmail.com> wrote:
> > > > >> > > Hi,
>
> > > > >> > > Maybe platform is the right forum for this.
>
> > > > >> > > I wonder what the development and release plans are for an
> > > interface
> > > > >> > > that allows you to configure anadhocconnection. You can already
> > > do
> > > > >> > > this on ADP by changing the wifi configuration and reload using
> > > > >> > > wlan_loader. However, this is not something a normal user can do.
>
> > > > >> > > What are current status of the plans for this?
> > > > >> > > If I wanted to add this feature to framework myself, what would be
> > > the
> > > > >> > > best release/tag to use? Any pointers to the location of the WiFi
> > > UI
> > > > >> > > interface files would be appreciated.
>
> > > > >> > > Thanks,
> > > > >> > > Anders- Hide quoted text -
>
> - Show quoted text -

drew...@gmail.com

unread,
May 18, 2009, 1:22:34 PM5/18/09
to android-platform
1) In the scenario where the phone is acting as beacon but no one else
is connected, the network status is not connected. The supplicant
state however will be set to associating.

2) When another ad-hoc station connects to the phone for the first
time, a network connected event will fire. All subsequent connections
to the network will not generate events.

- Drew

Anders Nilsson Plymoth

unread,
May 18, 2009, 1:52:37 PM5/18/09
to android-...@googlegroups.com
Hi,

I agree this is the most appropriate solution for exposing the state of the station to the user. However, being connected in an ad hoc network is not the same think as being connected in an infrastructure network. In ad hoc mode, two nodes can communicate when they have configured a common BSSID, while in infrastructure mode a station associates itself to an AP.
Drew's solution handles this nicely, as nodes can be considered connected when they can communicate.

I am curious as to how people on this list that is interested in using this?
I am very interested, and I know that many developers are very interested as well, and have many applications that are waiting for the ad hoc mode to be exposed.

If anyone is interested in meeting to discuss this during Google IO, please let me know. I would love to meet other people to see how they want to use this functionality.

Thanks,
Anders
Reply all
Reply to author
Forward
0 new messages