[RFC] nl80211: allow Android P2P functionality

YanBo dreamfly281 at gmail.com
Thu May 16 02:15:04 EDT 2013

On Sat, May 11, 2013 at 3:20 AM, YanBo <dreamfly281 at gmail.com> wrote:
> On Sat, May 11, 2013 at 3:07 AM, Johannes Berg
> <johannes at sipsolutions.net> wrote:
>>> Thanks for reply, Johannes, we are testing are under development
>>> driver https://github.com/KrasnikovEugene/wcn36xx
>>> So, that means we need register a P2P0 device (even it is Null
>>> function and do nothing) via the new MAC80211 P2P API?
>> No, it means that you need to handle NL80211_IFTYPE_P2P_DEVICE in your
>> add_interface properly, etc. You may need to support offloaded
>> remain-on-channel depending on your hw design.
>> johannes
> OK, let me try it firstly and send feedback when it works, BTW, the iw
> I used is version 3.7-vht. Do the userspace nl80211 lib or iw tools
> need be upgrade to enable the P2P function? Thanks.
> BR /Yanbo

Hi Johill

After I created  the p2p0 device by manual via "iw wlan0 interface add
 p2p0 type __p2pdev"
Seems device is created success

root at android:/data/misc/wifi # netcfg
rev_rmnet1 DOWN                         
0x00001002 06:6f:90:91:74:2c
rev_rmnet0 DOWN                         
0x00001002 ee:09:79:c8:eb:74
rev_rmnet4 DOWN                         
0x00001002 3a:72:90:1b:0e:41
rev_rmnet2 DOWN                         
0x00001002 16:9f:63:dc:09:7d
rev_rmnet3 DOWN                         
0x00001002 0e:81:f8:26:f7:75
rev_rmnet7 DOWN                         
0x00001002 36:e7:05:a0:83:8f
rev_rmnet5 DOWN                         
0x00001002 5a:2c:72:56:ee:a4
rev_rmnet6 DOWN                         
0x00001002 16:30:8e:1f:49:14
rev_rmnet8 DOWN                         
0x00001002 5a:06:63:6d:94:03
rmnet1   DOWN                            0x00000000
rmnet0   DOWN                            0x00000000
rmnet4   DOWN                            0x00000000
rmnet2   DOWN                            0x00000000
rmnet3   DOWN                            0x00000000
rmnet7   DOWN                            0x00000000
rmnet5   DOWN                            0x00000000
rmnet6   DOWN                            0x00000000
rmnet_smux0 DOWN                         
0x00001002 e2:77:c4:a3:14:fe
p2p0     DOWN                            0x00001002
sit0     DOWN                            0x00000080
lo       UP                            0x00000049
wlan0    DOWN                            0x00001002
dummy0   DOWN                            0x00000082

But from the wpa_supplicant log, it show below error

D/wpa_supplicant( 2431): nl80211: RFKILL status not available
D/wpa_supplicant( 2431): nl80211: Set mode ifindex 23 iftype 2 (STATION)
D/wpa_supplicant( 2431): nl80211: Failed to set interface 23 to mode
2: -22 (Invalid argument)
D/wpa_supplicant( 2431): nl80211: Try mode change after setting interface down
D/BT_DUN  (  885): Moved to state(EMB_DATA_CALL_IDLE)
D/wpa_supplicant( 2431): nl80211: Set mode ifindex 23 iftype 2 (STATION)
D/wpa_supplicant( 2431): nl80211: Failed to set interface 23 to mode
2: -22 (Invalid argument)

And the reason the the wpa_supplicant get the "failed to set
interface" is because the code run into  nl80211.c

        if (otype == NL80211_IFTYPE_P2P_DEVICE) {
                if (ntype == NL80211_IFTYPE_P2P_DEVICE)
                        return 0;
                return -EINVAL;

It will return -EINVAL cause the upper layer try to create station on
a P2P device, that make me a bit confuse, why the upper layer set the
station mode to a p2p0 device which should be p2p mode?
and there is another wlan0 device which intend to be  station mode
already existed.

BTW the wlan0 will always keep in DOWN status after the p2p0 device
UP, and it will show
root at android:/data/misc/wifi # netcfg wlan0 up
netcfg wlan0 up
action 'up' failed (Device or resource busy)

Seems the p2p0 and wlan0 can not be UP at the same time?  I though
there are both virtual interface and can work in different mode at the
same time. anything I miss?

BR /Yanbo

More information about the HostAP mailing list