virtual P2P interface creation.

cancel
Showing results for 
Search instead for 
Did you mean: 

virtual P2P interface creation.

5,831 Views
sandeshgowda
Contributor III

Hi,

I'm using atheros ath9k series Wifi-BT WiFi chip fr Wifi bringup. The respective driver support to create "waln0" interface and not virtual interface "p2p0" interface and when i enable Wifi from Android UI, it fails to communicate detect p2p0 interface.(i hard coded p2p_supplicant in wifi_ath.c file to enable WiFi feature).

I need p2p0 interface to bringup WiFi direct and WiFi display feature. so i try to create p2p0 interface from wifi_ath.c file using libnl API's like (nlmsg_alloc, nl_cb_alloc, nl_send_auto_complete). with libnl library APi's able to create p2p0 interface as below:

-----------------------------------------------------------------

wlan0DOWN                               0.0.0.0/0   0x00001002 00:0e:8e:42:e3:78
p2p0 DOWN                               0.0.0.0/0   0x00001002 00:0e:8e:42:e3:78

---------------------------------------------------------------------------

but fails to start p2p0 interface when i select WiFi option from UI and from logcat getting following errors .

------------------------------------------------------------

E/wpa_supplicant( 3201): nl80211: Register frame match - hexdump(len=2): 0a 07

E/wpa_supplicant( 3201): Could not set interface p2p0 flags (UP): Name not unique on network

E/wpa_supplicant( 3201): nl80211: Could not set interface 'p2p0' UP

E/wpa_supplicant( 3201): nl80211: Set mode ifindex 8 iftype 2 (STATION)

E/wpa_supplicant( 3201): nl80211: Unsubscribe mgmt frames handle 0x41a470e0 (mode change)

E/wpa_supplicant( 3201): p2p0: Failed to initialize driver interface

E/wpa_supplicant( 3201): Failed to add interface p2p0

E/wpa_supplicant( 3201): p2p0: Cancelling authentication timeout

I/wpa_supplicant( 3201): wpa_driver_set_ap_wps_p2p_ie: Entry

E/wpa_supplicant( 3201): wlan0: Removing interface wlan0

E/wpa_supplicant( 3201): wlan0: No keys have been configured - skip key clearing

E/wpa_supplicant( 3201): wlan0: State: DISCONNECTED -> DISCONNECTED

E/wpa_supplicant( 3201): wpa_driver_nl80211_set_operstate: operstate 0->0 (DORMANT)

E/wpa_supplicant( 3201): wlan0: No keys have been configured - skip key clearing

E/wpa_supplicant( 3201): wlan0: Cancelling authentication timeout

E/wpa_supplicant( 3201): nl80211: Set mode ifindex 7 iftype 2 (STATION)

E/wpa_supplicant( 3201): nl80211: Unsubscribe mgmt frames handle 0x41a37f28 (mode change)

I/wpa_supplicant( 3201): wlan0: CTRL-EVENT-TERMINATING

---------------------------------------------------------------------------------------

I even try to modify MAC address on basis of wlan0 mac address when i create p2p0 interface in wifi_ath.c and it fails to update:

---------------------------------------------------------------------------------------------------

    get_mac_addr(WLAN_INTERFACE, mac_addr); // function to get wlan0 mac address ex:00:0e:8e:42:e3:78
    update_p2p_mac_addr(mac_addr, new_addr);// Api to create p2p0 macc address fe:0e:8e:42:e3:78
    mac_addr_n2a(buf1, new_addr);
    ALOGE("get_mac_addr: ifname=%s, NEW MAC Address=%s",iface, buf1);

NLA_PUT_STRING(msg, NL80211_ATTR_IFNAME, iface);
NLA_PUT_U32(msg, NL80211_ATTR_IFTYPE, type);
NLA_PUT(msg, NL80211_ATTR_MAC, 6, new_addr);

--------------------------------------------------------------------------------------------------------------------------

But p2p0 mac address is not reflecting.

The following are the queries:

1. What are the ways to create p2p0 interface from userspace?

2. how i can modifiy mac address from userspace?

3. i'm finding difficulty in creating p2p0  virtual interface from ath9k kernel 3.0.35 version. Is there an patches availble?

Appreciate your help in advance regarding Wifi Direct bringup.

Thanks,

Sandesh D

Labels (5)
7 Replies

413 Views
YixingKong
Senior Contributor IV

Sandesh

This discussion is closed since no activity. If you still need help, please feel free to reply with an update to this discussion, or create another discussion.

Thanks,

Yixing

0 Kudos

413 Views
bagahsieh
Contributor I

I have the same problem in iMX6-DL and Android 4.2.2.

I want to enable Wifi Direct in BSP.

But there is the error message:

E/WifiHW  ( 2540): Unable to open connection to supplicant on "/data/misc/wifi/sockets/p2p0": No such file or directory

After enable wifi, I found there are only 2 nodes in the directory /data/misc/wifi/sockets/

wpa_ctrl_2041-10

wpa_ctrl_2041-11

There is not p2p0 in this directory.

0 Kudos

413 Views
mrleo
Contributor IV

I have the same problem in iMX6-DQ and Android 4.2.2.

I use broadcom ap6330 wifi module.

if you disabled p2p,sta will be ok.

But I want to support p2p function.


0 Kudos

413 Views
sandeshgowda
Contributor III

Now able to create p2p0 interface with modified mac address by modifying in driver add new interface.

wlan0UP                                 0.0.0.0/0   0x00001003 00:0e:8e:42:e3:78
p2p0 UP                                 0.0.0.0/0   0x00001003 10:0e:8e:42:e3:78

Now able to see wlan0 and p2p0 are sharing the same address and when i enable WiFi from android UI, scan WiFi access points and connect to one of the access points. but fail to configure p2p interface and it fails with following error.

E/WifiHW  ( 2540): Wi-Fi hardware/libhardware_legacy/wifi/wifi_ath.c,wifi_connect_on_socket_path,1095,path=/data/misc/wifi/sockets/p2p0

E/WifiHW  ( 2540): Unable to open connection to supplicant on "/data/misc/wifi/sockets/p2p0": No such file or directory

E/WifiP2pService( 2540): P2p socket connection failed

I cross check the p2p0 interface and able to find in /data/system/wpa_supplicant/wlan0 p2p0

in wifi_ath.c, if hardocde control interface path to //data/system/wpa_supplicant , able to enable and scan for the Wifi direct devices and fail to list all

E/WifiStateMachine( 2537): Error! unhandled message{ what=147477 when=-1ms obj=Device: DWD-300-14C6AF

0 Kudos

413 Views
ankurrahi1
Contributor II

Hi sandesh,

I am using Ralink wifi and facing the same issues, you were facing.

I created virtual p2p0 with -

     iw wlan0 interface add p2p0 type managed

and modified the MAC address with-

     ip link set dev p2p0 address <new address>

still it fails to connect.

my error log is same as your's.

can you help me in fixing it.

Thanks

Ankur

0 Kudos

413 Views
YixingKong
Senior Contributor IV

Sanddesh

Had your issue got resolved? If yes, we are going to close the discussion in 3 days. If you still need help, please feel free to reply with an update to this discussion.

Thanks,

Yixing

0 Kudos

413 Views
YixingKong
Senior Contributor IV

Sanddesh

We are sorry for getting back to you so late. Are you still stuck with the issue? If you have somehow resolved the issue, can we close the discussion? If you still need help, please feel free to reply with an update to this discussion.

Thanks,

Yixing

0 Kudos