Wifi Direct GO Negotiation

Arend van Spriel arend at broadcom.com
Tue May 20 03:32:28 EDT 2014


On 05/19/14 20:04, Andrea Chittano wrote:
> Hi, Vinit
> I would like that devices elect the GO automatically, according to their
> own resources.
> So that the most deserving device becames GO.
>
> As far as I know when WifiMonitor class is used to monitor
> wpa_supplicant status change and notify Android framework. How does
> wpa_supplicant send messages to Android framework?
>
> When wpa_supplicant receives a group owner negotiation request from a
> device it notifies Android framework sending a message to it. So, what
> happens is described by the following code:
>
> http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.3_r2.1/android/net/wifi/p2p/WifiP2pService.java?av=f
>
> at line 1082.
>
> Do you know what is the config object at line 1083 and what does it
> contain? Does it represent the local config object or which one received
> in Group Owner negotiation Request?

Given the fact that the config object is stored in 
android.net.wifi.p2p.WifiP2pService::mSavedPeerConfig in line 1088 
suggest it contains info received in GO negotiation request.

Regards,
Arend

> Thanks
>
>
> ------------------------------------------------------------------------
> Date: Mon, 19 May 2014 10:53:05 -0700
> Subject: Re: Wifi Direct GO Negotiation
> From: vinitd at google.com
> To: andrea.chittano at hotmail.it
> CC: dimitrysh at google.com; hostap at lists.shmoo.com; moon.linux at yahoo.com;
> arend at broadcom.com
>
> Sorry - I meant createGroup().
>
>
> On Mon, May 19, 2014 at 10:52 AM, Vinit Deshpande <vinitd at google.com
> <mailto:vinitd at google.com>> wrote:
>
>     Unfortunately, there is no API to set GO intent today. May I know
>     why you want to set it?
>
>     There are some alternatives that you may consider though - there is
>     a greateGroup() API which will allow you to create a group owner
>     locally. That may work if you know that local device needs to be
>     group owner.
>
>
>     On Mon, May 19, 2014 at 3:19 AM, Andrea Chittano
>     <andrea.chittano at hotmail.it <mailto:andrea.chittano at hotmail.it>> wrote:
>
>         Hi all,
>
>          > >The group owner intent should be
>          > > configured when a device is enabled for P2P as you can
>         never know when
>          > > another device will initiate a GO negotiation procedure.
>
>         this is the point.
>         I wish to set go_intent by means android command when a device
>         is enabled for P2P, as you said.
>         Is there a way to do that?
>
>          > Date: Fri, 16 May 2014 10:58:57 -0700
>
>          > Subject: Re: Wifi Direct GO Negotiation
>          > From: dimitrysh at google.com <mailto:dimitrysh at google.com>
>          > To: arend at broadcom.com <mailto:arend at broadcom.com>
>          > CC: andrea.chittano at hotmail.it
>         <mailto:andrea.chittano at hotmail.it>; hostap at lists.shmoo.com
>         <mailto:hostap at lists.shmoo.com>; moon.linux at yahoo.com
>         <mailto:moon.linux at yahoo.com>; vinitd at google.com
>         <mailto:vinitd at google.com>
>
>          >
>          > + Vinit
>          >
>          > On Fri, May 16, 2014 at 8:10 AM, Arend van Spriel
>         <arend at broadcom.com <mailto:arend at broadcom.com>> wrote:
>          > > + Dmitry
>          > >
>          > >
>          > > On 05/16/14 11:39, Andrea Chittano wrote:
>          > >>
>          > >> Hi Arend,
>          > >> first of all thank you for your time.
>          > >> I' m going to try to give you a summary of what I want to do.
>          > >>
>          > >> I want to develop an app which implements WiFi Direct
>         Protocol.
>          > >> In particular I need to be sure that it performs GO
>         Negotiation
>          > >> procedure correctly.
>          > >> According to what android guide says, if I want that a
>         device (D1)
>          > >> starts a connection with another device (D2),
>          > >> D1 has to call connect() method.
>          > >> This method admits as parameter an object called config.
>          > >> config contains 3 fields:
>          > >>
>          > >> * The device MAC address that uniquely identifies a Wi-Fi
>         p2p device
>          > >>
>          > >> to connect to (in my example it will be MAC of D2)
>          > >> * groupOwnerIntent of D1 (since it is starting the connection)
>          > >> * wps info of D1 (since it is starting the connection)
>          > >
>          > >
>          > > Yup. Going through the online pages I only see described
>         how to do it from
>          > > D1 perspective, but unclear what should be done in D2.
>         Maybe Dmitry can
>          > > elaborate on that. I get the impression that the whole GO
>         negotiation is
>          > > done between wpa_supplicants on D1 and D2. The group owner
>         intent should be
>          > > configured when a device is enabled for P2P as you can
>         never know when
>          > > another device will initiate a GO negotiation procedure.
>          >
>          > As far as I know in Android Wifi Direct negotiation is using
>         default go_intent=6
>          > (from 0..15 range), so it is not certain if D1 or D2 will be
>         GO. For
>          > Miracast API
>          > go_intent=0 is used, so phone it trying to be GC.
>          > My point is that connection initiator is not GO by default.
>          >
>          >
>          > >
>          > > Regards,
>          > > Arend
>          > >
>          > >> After that android will use WifiNative class to send the
>         command to
>          > >> wpa_supplicant.
>          > >> Now, wpa_supplicant takes charge of building the GO
>         negotiation request
>          > >> to send it to D2.
>          > >>
>          > >> Which is the behaviour of D2 after receiving D1 GO
>         negotiation request?
>          > >>
>          > >> In my app I've tried to instantiate a configobject
>         containing GO intent
>          > >>
>          > >> of D2, but D1 becames always GO, even if GO intent of D2
>         is greater than
>          > >> D1 one.
>          > >>
>          > >>
>          > >> Thanks
>          > >> Andrea
>          > >>
>          > >> > Date: Thu, 15 May 2014 21:27:28 +0200
>          > >> > From: arend at broadcom.com <mailto:arend at broadcom.com>
>          > >> > To: andrea.chittano at hotmail.it
>         <mailto:andrea.chittano at hotmail.it>
>          > >> > CC: moon.linux at yahoo.com <mailto:moon.linux at yahoo.com>;
>         hostap at lists.shmoo.com <mailto:hostap at lists.shmoo.com>
>          > >> > Subject: Re: Wifi Direct GO Negotiation
>          > >> >
>          > >> > On 05/15/14 18:25, Andrea Chittano wrote:
>          > >> > > Sorry guys for my inexperience, but this thing are
>         driving me mad.
>          > >> > >
>          > >> > > Tell me if i'm wrong.
>          > >> > > Does the function at line 525 of the following link
>          > >> > >
>          > >> > >
>          > >>
>          > >>
>         http://code.metager.de/source/xref/hostapd-wpa_supplicant/src/p2p/p2p_go_neg.c?r=0e0e1e564f3dd8d2a6b645d079b46eba0acc7f83
>          > >> > >
>          > >> > > that is
>          > >> > >
>          > >> > > *void* p2p_process_go_neg_req
>          > >>
>          > >>
>         <http://code.metager.de/source/s?defs=p2p_process_go_neg_req&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=p2p_process_go_neg_req&project=hostapd-wpa_supplicant>>(*struct*
>          > >> p2p_data
>          > >>
>          > >>
>         <http://code.metager.de/source/s?defs=p2p_data&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=p2p_data&project=hostapd-wpa_supplicant>>
>          > >> *p2p
>          > >>
>          > >>
>         <http://code.metager.de/source/s?defs=p2p&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=p2p&project=hostapd-wpa_supplicant>>,*const*
>          > >> u8
>          > >>
>         <http://code.metager.de/source/s?defs=u8&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=u8&project=hostapd-wpa_supplicant>>
>          > >> *sa
>          > >>
>         <http://code.metager.de/source/s?defs=sa&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=sa&project=hostapd-wpa_supplicant>>,
>          > >> > > *const* u8
>          > >>
>         <http://code.metager.de/source/s?defs=u8&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=u8&project=hostapd-wpa_supplicant>>
>          > >> *data
>          > >>
>          > >>
>         <http://code.metager.de/source/s?defs=data&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=data&project=hostapd-wpa_supplicant>>,size_t
>          > >>
>          > >>
>         <http://code.metager.de/source/s?defs=size_t&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=size_t&project=hostapd-wpa_supplicant>>
>          > >> len
>          > >>
>          > >>
>         <http://code.metager.de/source/s?defs=len&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=len&project=hostapd-wpa_supplicant>>,*int*
>          > >> rx_freq
>          > >>
>          > >>
>         <http://code.metager.de/source/s?defs=rx_freq&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=rx_freq&project=hostapd-wpa_supplicant>>)
>          > >> > >
>          > >> > >
>          > >> > > represent the processing (performed by Device2) of the
>         GO negotiation
>          > >> > > request that Device1 sent Device2?
>          > >> > >
>          > >> > > This function performs at line 687
>          > >> > >
>          > >> > > p2p_go_det
>          > >>
>          > >>
>         <http://code.metager.de/source/s?refs=p2p_go_det&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?refs=p2p_go_det&project=hostapd-wpa_supplicant>>(p2p
>          > >>
>          > >>
>         <http://code.metager.de/source/s?defs=p2p&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=p2p&project=hostapd-wpa_supplicant>>->go_intent
>          > >>
>          > >>
>         <http://code.metager.de/source/s?defs=go_intent&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=go_intent&project=hostapd-wpa_supplicant>>,
>          > >> *msg
>          > >>
>          > >>
>         <http://code.metager.de/source/s?defs=msg&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=msg&project=hostapd-wpa_supplicant>>.go_inten
>          > >>
>          > >>
>         <http://code.metager.de/source/s?defs=go_intent&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=go_intent&project=hostapd-wpa_supplicant>>t)
>          > >> > >
>          > >> > >
>          > >> > > which returns the highest GO intent between local GO
>         intent and
>          > >> received
>          > >> > > one.
>          > >> > > If I'm not wrong, according to what Arend told me
>         Device2 get local
>          > >> GO
>          > >> > > intent from wpa_supplicant configuration file. But
>         I've found only
>          > >> one
>          > >> > > way to set the local GO intent and it is here :
>          > >> > >
>          > >> > >
>          > >>
>         http://code.metager.de/source/xref/hostapd-wpa_supplicant/src/p2p/p2p.c
>          > >> > >
>          > >> > > at line 1387, into the function
>          > >> > >
>          > >> > > *int* p2p_connect
>          > >>
>          > >>
>         <http://code.metager.de/source/s?refs=p2p_connect&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?refs=p2p_connect&project=hostapd-wpa_supplicant>>(*struct*
>          > >> p2p_data
>          > >>
>          > >>
>         <http://code.metager.de/source/s?defs=p2p_data&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=p2p_data&project=hostapd-wpa_supplicant>>
>          > >> *p2p
>          > >>
>          > >>
>         <http://code.metager.de/source/s?refs=p2p&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?refs=p2p&project=hostapd-wpa_supplicant>>,*const*
>          > >> u8
>          > >>
>         <http://code.metager.de/source/s?defs=u8&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=u8&project=hostapd-wpa_supplicant>>
>          > >> *peer_addr
>          > >>
>          > >>
>         <http://code.metager.de/source/s?refs=peer_addr&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?refs=peer_addr&project=hostapd-wpa_supplicant>>,
>          > >> > > *enum* p2p_wps_method
>          > >>
>          > >>
>         <http://code.metager.de/source/s?defs=p2p_wps_method&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=p2p_wps_method&project=hostapd-wpa_supplicant>>
>          > >> wps_method
>          > >>
>          > >>
>         <http://code.metager.de/source/s?defs=wps_method&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=wps_method&project=hostapd-wpa_supplicant>>,
>          > >> > > *int* go_intent
>          > >>
>          > >>
>         <http://code.metager.de/source/s?defs=go_intent&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=go_intent&project=hostapd-wpa_supplicant>>,*const*
>          > >> u8
>          > >>
>         <http://code.metager.de/source/s?defs=u8&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=u8&project=hostapd-wpa_supplicant>>
>          > >> *own_interface_addr
>          > >>
>          > >>
>         <http://code.metager.de/source/s?defs=own_interface_addr&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=own_interface_addr&project=hostapd-wpa_supplicant>>,
>          > >> > > *unsigned* *int* force_freq
>          > >>
>          > >>
>         <http://code.metager.de/source/s?defs=force_freq&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=force_freq&project=hostapd-wpa_supplicant>>,*int*
>          > >> persistent_group
>          > >>
>          > >>
>         <http://code.metager.de/source/s?defs=persistent_group&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=persistent_group&project=hostapd-wpa_supplicant>>,
>          > >> > > *const* u8
>          > >>
>         <http://code.metager.de/source/s?defs=u8&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=u8&project=hostapd-wpa_supplicant>>
>          > >> *force_ssid
>          > >>
>          > >>
>         <http://code.metager.de/source/s?defs=force_ssid&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=force_ssid&project=hostapd-wpa_supplicant>>,size_t
>          > >>
>          > >>
>         <http://code.metager.de/source/s?defs=size_t&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=size_t&project=hostapd-wpa_supplicant>>
>          > >> force_ssid_len
>          > >>
>          > >>
>         <http://code.metager.de/source/s?defs=force_ssid_len&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=force_ssid_len&project=hostapd-wpa_supplicant>>,
>          > >> > > *int* pd_before_go_neg
>          > >>
>          > >>
>         <http://code.metager.de/source/xref/hostapd-wpa_supplicant/src/p2p/p2p.c#pd_before_go_neg>,*unsigned*
>          > >> *int* pref_freq
>          > >>
>          > >>
>         <http://code.metager.de/source/s?defs=pref_freq&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=pref_freq&project=hostapd-wpa_supplicant>>,u16
>          > >>
>         <http://code.metager.de/source/s?defs=u16&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=u16&project=hostapd-wpa_supplicant>>
>          > >> oob_pw_id
>          > >>
>          > >>
>         <http://code.metager.de/source/s?defs=oob_pw_id&project=hostapd-wpa_supplicant
>         <http://code.metager.de/source/s?defs=oob_pw_id&project=hostapd-wpa_supplicant>>)
>          > >> > >
>          > >> > >
>          > >> > >
>          > >> > >
>          > >> > >
>          > >> > > According to what specifications say, it is used to
>         start a GO
>          > >> negotiation.
>          > >> > > So my question is, how can I set the local GO intent
>         for Device2
>          > >> without
>          > >> > > using p2p_connect() function?
>          > >> > > I would make it by means of an android application.
>         Can I do this?
>          > >> >
>          > >> > Maybe it would help to give some high-level information
>         on what you are
>          > >> > trying to do. I am not familiar with Android solution,
>         but most likely
>          > >> > Android provides an API for applications that is handled
>         by their
>          > >> > framework/middleware to get it in wpa_supplicant (see [1]).
>          > >> >
>          > >> > Regards,
>          > >> > Arend
>          > >> >
>          > >> > [1]
>         http://developer.android.com/guide/topics/connectivity/wifip2p.html
>          > >> >
>          > >> > > Thanks for your help.
>          > >> > > Andrea
>          > >> > >
>          > >> > >
>          > >> > > > Date: Wed, 14 May 2014 10:21:56 -0700
>          > >> > > > From: moon.linux at yahoo.com <mailto:moon.linux at yahoo.com>
>          > >> > > > Subject: Re: Wifi Direct GO Negotiation
>          > >> > > > To: arend at broadcom.com <mailto:arend at broadcom.com>;
>         andrea.chittano at hotmail.it <mailto:andrea.chittano at hotmail.it>
>          > >> > > > CC: hostap at lists.shmoo.com
>         <mailto:hostap at lists.shmoo.com>
>          > >> > > >
>          > >> > > > Hi Arend,
>          > >> > > >
>          > >> > > > I agree with what you said regarding the AP.
>          > >> > > >
>          > >> > > > One more question: Any device with WPS capabilty can
>         join a P2P
>          > >> network.
>          > >> > > >
>          > >> > > > Thanks.
>          > >> > > > -Anand Moon
>          > >> > > >
>          > >> > > >
>          > >> > > >
>          > >> > > > On Wednesday, May 14, 2014 2:56 PM, Arend van Spriel
>          > >> > > <arend at broadcom.com <mailto:arend at broadcom.com>> wrote:
>          > >> > > > On 14-05-14 05:03, Anand Moon wrote:
>          > >> > > > > Hi All,
>          > >> > > > >
>          > >> > > > > I would like to add new question to this thread.
>          > >> > > > >
>          > >> > > > > If the AP has the capability to support p2p and
>         wps, how will
>          > >> > > > > these two devices communicate with the AP.
>          > >> > > > > Will this AP become P2P group owner (P2P Go) and
>         the other
>          > >> devices
>          > >> > > P2P Clients ?
>          > >> > > >
>          > >> > > > I am not sure whether this scenario makes sense. P2P
>         typically
>          > >> involves
>          > >> > > > two STAs. They may be connected to some AP, but if
>         both are
>          > >> connected to
>          > >> > > > the same AP there may be not so much need to setup a P2P
>          > >> connection.
>          > >> > > >
>          > >> > > > > I would like to know how to judge if the wireless
>         interface
>          > >> > > supports P2P
>          > >> > > > > is it with the "Supported interface modes" or
>         "Supported RX frame
>          > >> > > types" ?
>          > >> > > > >
>          > >> > > > > If the device support following p2p mode then how
>         do we need to
>          > >> > > configure them.
>          > >> > > > >
>          > >> > > > > Supported interface modes:
>          > >> > > > > * IBSS
>          > >> > > > > * managed
>          > >> > > > > * AP * AP/VLAN
>          > >> > > > > * monitor
>          > >> > > > > * mesh point
>          > >> > > > > * P2P-client
>          > >> > > > > * P2P-GO
>          > >> > > > >
>          > >> > > > > How do we configure these P2P modes for interface?
>          > >> > > > > Please share your thoughts.
>          > >> > > >
>          > >> > > > Just use nl80211 API, ie. NL80211_CMD_SET_INTERFACE.
>          > >> wpa_supplicant is
>          > >> > > > doing that in src/drivers/driver_nl80211.c
>          > >> > > >
>          > >> > > > Regards,
>          > >> > > > Arend
>          > >> > > >
>          > >> > > >
>          > >> > > > > -Anand Moon
>          > >> > > > >
>          > >> > > > >
>          > >> > > > > On Tuesday, May 13, 2014 6:31 PM, Arend van Spriel
>          > >> > > <arend at broadcom.com <mailto:arend at broadcom.com>> wrote:
>          > >> > > > > On 05/13/14 14:03, Andrea Chittano wrote:
>          > >> > > > >> Hi, my name is Andrea.
>          > >> > > > >> I'm working on WiFi Direct and I found a thread
>         about it.
>          > >> > > > >> I've some doubts about it.
>          > >> > > > >> Let's suppose we have 2 devices. Let's call D1
>         and D2.
>          > >> > > > >> Let's suppose D1 sends a request of connection to
>         D2 (D1
>          > >> doesn't known
>          > >> > > > >> D2 so no persistent connection there exist).
>          > >> > > > >> The first step that wpa_supplicant on D1 is to
>         send a GO
>          > >> negotiation
>          > >> > > > >> request containing, among all,GO intent (of D1).
>          > >> > > > >> I want to understand how wpa_supplicant on D2
>         acquires the GO
>          > >> > > intent of
>          > >> > > > >> D2 in order to compare it with whichone sent by D1.
>          > >> > > > >> Can someone explain me this?
>          > >> > > > >
>          > >> > > > > Both devices have their own go intent configuration in
>          > >> wpa_supplicant
>          > >> > > > > configuration file. D2 sends own go intent value
>         in the GO
>          > >> negotiation
>          > >> > > > > response. The device with the highest GO intent
>         will become GO.
>          > >> > > > >
>          > >> > > > > Regards,
>          > >> > > > > Arend
>          > >> > > > >
>          > >> > > > >> Thanks,
>          > >> > > > >> Andrea
>          > >> > > > >>
>          > >> > > > >>
>          > >> > > > >>
>          > >> > > > >> _______________________________________________
>          > >> > > > >> HostAP mailing list
>          > >> > > > >> HostAP at lists.shmoo.com
>         <mailto:HostAP at lists.shmoo.com>
>          > >> > > > >> http://lists.shmoo.com/mailman/listinfo/hostap
>          > >> > > > >
>          > >> > > > >
>          > >> > > > > _______________________________________________
>          > >> > > > > HostAP mailing list
>          > >> > > > > HostAP at lists.shmoo.com <mailto:HostAP at lists.shmoo.com>
>          > >> > > > > http://lists.shmoo.com/mailman/listinfo/hostap
>          > >> > > > >
>          > >> > > >
>          > >> >
>          > >
>          > >
>
>
>



More information about the HostAP mailing list