Wifi direct on linux?

custom_board

#1

Hi all,
is wifi direct supports on linux/how to enable support for wifi-direct?

Regards,
Laxman


#2

Seeing your recent question, I assume you refer to 820c board.
Yes WiFi p2p is supported by the hw/driver/wpa_supplicant layers.

I suggest you to have a look at https://w1.fi/cgit/hostap/plain/wpa_supplicant/README-P2P.

To test this feature you can use the following procedure:

Stop any ongoing wpa_supplicant instance:
$ service wpa_supplicant stop

Create /etc/wpa_supplicant.conf file on device 1 with the following content:

ctrl_interface=/var/run/wpa_supplicant
device_name=My P2P Device 1
device_type=1-0050F204-1

Create /etc/wpa_supplicant.conf file on device 2 with the following content:

ctrl_interface=/var/run/wpa_supplicant
device_name=My P2P Device 2
device_type=1-0050F204-1

Start wpa_supplicant on each device:
$ wpa_supplicant -D nl80211 -i wlanX -c /etc/wpa_supplicant.conf &

On device 1, run wpa client tool and enable p2p listen mode:
$ wpa_cli
> p2p_listen

On device 2, run wpa client tool and run p2p find command:
$ wpa_cli
> p2p_find

On device 2, once device 1 is found run the connect command:
> p2p_connect MAC_ADDR_DEV1 pbc

On device 2, once received connect request, run the same command:
> p2p_connect MAC_ADDR_DEV2 pbc

You can now leave wpa_cli, you will see a new network p2p-wlanX-0 interface on each device.
You can configure this interface manually or use dhcp as well.

On device 1:
$ ifconfig p2p-wlan0-0 172.0.0.1

On device 2
$ ifconfig p2p-wlan0-0 172.0.0.2
$ ping 172.0.0.1
PING 172.0.0.1 (172.0.0.1) 56(84) bytes of data.
64 bytes from 172.0.0.1: icmp_seq=1 ttl=64 time=1115 ms

Your link is established.


#3

Hi loic,
when i try to connect devices using p2p_connect i’m getting the below error

Could not read interface p2p-wlp1s0-0 flags: No such device
nl80211: Driver does not support authentication/association or connect commands
nl80211: deinit ifname=p2p-wlp1s0-0 disabled_11b_rates=0
Could not read interface p2p-wlp1s0-0 flags: No such device
p2p-wlp1s0-0: Failed to initialize driver interface
P2P: Failed to create new wpa_supplicant interface

is this the problem with nl80211 and how control interface gets created in /var/run/wpa_supplicant?

Regards,
Laxman


#4

This is on ‘computer’ side, right ? In that case maybe you could try wext instead of nl80211.
on computer side: wpa_supplicant -D wext -i wlanX -c /etc/wpa_supplicant.conf &


#5

Hi Loic,
sorry for the delay.
now the connection is successfully established between my android phone and linux device.
but file transfering doesn’t happening from my android phone to linux device.How can it be done?

Regards,
Laxman


#6

File transfer is not specific to P2P, once your link is established, a protocol (on top of IP) needs to be used for this (FTP, HTTP, Custom…). So this is really dependent on the Android P2P application you are running.