[RFC] nl80211: allow Android P2P functionality

YanBo dreamfly281
Wed May 15 23:15:04 PDT 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
netcfg
rev_rmnet1 DOWN                                   0.0.0.0/0
0x00001002 06:6f:90:91:74:2c
rev_rmnet0 DOWN                                   0.0.0.0/0
0x00001002 ee:09:79:c8:eb:74
rev_rmnet4 DOWN                                   0.0.0.0/0
0x00001002 3a:72:90:1b:0e:41
rev_rmnet2 DOWN                                   0.0.0.0/0
0x00001002 16:9f:63:dc:09:7d
rev_rmnet3 DOWN                                   0.0.0.0/0
0x00001002 0e:81:f8:26:f7:75
rev_rmnet7 DOWN                                   0.0.0.0/0
0x00001002 36:e7:05:a0:83:8f
rev_rmnet5 DOWN                                   0.0.0.0/0
0x00001002 5a:2c:72:56:ee:a4
rev_rmnet6 DOWN                                   0.0.0.0/0
0x00001002 16:30:8e:1f:49:14
rev_rmnet8 DOWN                                   0.0.0.0/0
0x00001002 5a:06:63:6d:94:03
rmnet1   DOWN                                   0.0.0.0/0   0x00000000
00:00:00:00:00:00
rmnet0   DOWN                                   0.0.0.0/0   0x00000000
00:00:00:00:00:00
rmnet4   DOWN                                   0.0.0.0/0   0x00000000
00:00:00:00:00:00
rmnet2   DOWN                                   0.0.0.0/0   0x00000000
00:00:00:00:00:00
rmnet3   DOWN                                   0.0.0.0/0   0x00000000
00:00:00:00:00:00
rmnet7   DOWN                                   0.0.0.0/0   0x00000000
00:00:00:00:00:00
rmnet5   DOWN                                   0.0.0.0/0   0x00000000
00:00:00:00:00:00
rmnet6   DOWN                                   0.0.0.0/0   0x00000000
00:00:00:00:00:00
rmnet_smux0 DOWN                                   0.0.0.0/0
0x00001002 e2:77:c4:a3:14:fe
p2p0     DOWN                                   0.0.0.0/0   0x00001002
00:0a:62:27:26:4d
sit0     DOWN                                   0.0.0.0/0   0x00000080
00:00:00:00:00:00
lo       UP                                   127.0.0.1/8   0x00000049
00:00:00:00:00:00
wlan0    DOWN                                   0.0.0.0/0   0x00001002
00:0a:62:27:26:4c
dummy0   DOWN                                   0.0.0.0/0   0x00000082
7e:e5:72:29:c8:39


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): Ignoring event PLATFORM_EVENT_ERROR in EMB_DATA_CALL_IDLE
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

#ifdef CPTCFG_CFG80211_ANDROID_P2P_HACK
        if (otype == NL80211_IFTYPE_P2P_DEVICE) {
                if (ntype == NL80211_IFTYPE_P2P_DEVICE)
                        return 0;
                return -EINVAL;
        }
#endif

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?

Thanks
BR /Yanbo



More information about the Hostap mailing list