Template:WIFI DIRECT: Difference between revisions
(Created page with "Wi-Fi Direct is a standard that enables devices to connect with each other without the need for a wireless access point or network infrastructure. It allows two devices to cre...") |
No edit summary |
||
Line 1: | Line 1: | ||
Wi-Fi Direct is a standard that enables devices to connect with each other without the need for a wireless access point or network infrastructure. It allows two devices to create a direct, peer-to-peer connection using a Wi-Fi protocol for data transfer, media sharing, or other types of communication. | '''Wi-Fi Direct''' is a standard that enables devices to connect with each other without the need for a wireless access point or network infrastructure. It allows two devices to create a direct, peer-to-peer connection using a Wi-Fi protocol for data transfer, media sharing, or other types of communication. | ||
Variscite SOMs with the Murata LBES5PL2xx (NXP IW61x) modules support WiFi Direct. You may verify your SOM supports WiFi Direct by checking for the wfd0 interface: | '''Variscite SOMs''' with the '''Murata LBES5PL2xx (NXP IW61x)''' modules support WiFi Direct. You may verify your SOM supports WiFi Direct by checking for the wfd0 interface: | ||
<pre> | |||
# ifconfig wfd0 | # ifconfig wfd0 | ||
wfd0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 | wfd0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 | ||
Line 11: | Line 12: | ||
TX packets 0 bytes 0 (0.0 B) | TX packets 0 bytes 0 (0.0 B) | ||
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 | TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 | ||
</pre> | |||
The following process describes how to connect two Variscite SOMs (Device A and Device B) using WiFi Direct: | The following process describes how to connect two Variscite SOMs (Device A and Device B) using WiFi Direct: | ||
<pre> | |||
Device A (WiFi Direct) <================> Device B (WiFi Direct) | Device A (WiFi Direct) <================> Device B (WiFi Direct) | ||
</pre> | |||
Device A Configuration: | '''Device A Configuration:''' | ||
Stop and disable NetworkManager and wpa_supplicant systemd services: | Stop and disable NetworkManager and wpa_supplicant systemd services: | ||
<pre> | |||
# systemctl stop NetworkManager; systemctl disable NetworkManager | # systemctl stop NetworkManager; systemctl disable NetworkManager | ||
# systemctl stop wpa_supplicant; systemctl stop wpa_supplicant | # systemctl stop wpa_supplicant; systemctl stop wpa_supplicant | ||
</pre> | |||
Create a configuration file for device A, e.g., '''/etc/wpa_supplicant/wfd0_A.conf''', with the following content: | |||
<pre> | |||
ctrl_interface=/var/run/wpa_supplicant # Control interface directory | ctrl_interface=/var/run/wpa_supplicant # Control interface directory | ||
driver_param=use_p2p_group_interface=1 # Enable dedicated P2P group interface | driver_param=use_p2p_group_interface=1 # Enable dedicated P2P group interface | ||
Line 35: | Line 39: | ||
p2p_oper_reg_class=81 # Regulatory class for operating channel | p2p_oper_reg_class=81 # Regulatory class for operating channel | ||
p2p_oper_channel=11 # Operating channel number as group owner | p2p_oper_channel=11 # Operating channel number as group owner | ||
</pre> | |||
Start wpa_supplicant on device A for the wfd0 interface: | Start wpa_supplicant on device A for the wfd0 interface: | ||
<pre> | |||
wpa_supplicant -i wfd0 -c /etc/wpa_supplicant/wfd0_A.conf -D nl80211,wext -B | wpa_supplicant -i wfd0 -c /etc/wpa_supplicant/wfd0_A.conf -D nl80211,wext -B | ||
</pre> | |||
Device B Configuration: | '''Device B Configuration:''' | ||
Stop and disable NetworkManager and wpa_supplicant systemd services: | Stop and disable NetworkManager and wpa_supplicant systemd services: | ||
<pre> | |||
# systemctl stop NetworkManager; systemctl disable NetworkManager | # systemctl stop NetworkManager; systemctl disable NetworkManager | ||
# systemctl stop wpa_supplicant; systemctl stop wpa_supplicant | # systemctl stop wpa_supplicant; systemctl stop wpa_supplicant | ||
</pre> | |||
Create a configuration file for device B, e.g., '''/etc/wpa_supplicant/wfd0_B.conf''', with similar content but different device name: | |||
<pre> | |||
ctrl_interface=/var/run/wpa_supplicant # Control interface directory | ctrl_interface=/var/run/wpa_supplicant # Control interface directory | ||
driver_param=use_p2p_group_interface=1 # Enable dedicated P2P group interface | driver_param=use_p2p_group_interface=1 # Enable dedicated P2P group interface | ||
Line 59: | Line 66: | ||
p2p_oper_reg_class=81 # Regulatory class for operating channel | p2p_oper_reg_class=81 # Regulatory class for operating channel | ||
p2p_oper_channel=11 # Operating channel number as group owner | p2p_oper_channel=11 # Operating channel number as group owner | ||
</pre> | |||
Start wpa_supplicant on device B for the wfd0 interface: | Start wpa_supplicant on device B for the wfd0 interface: | ||
<pre> | |||
# wpa_supplicant -i wfd0 -c /etc/wpa_supplicant/wfd0_B.conf -D nl80211,wext -B | # wpa_supplicant -i wfd0 -c /etc/wpa_supplicant/wfd0_B.conf -D nl80211,wext -B | ||
</pre> | |||
Connecting the Devices: | '''Connecting the Devices:''' | ||
Find peers from device A: | Find peers from device A: | ||
<pre> | |||
# wpa_cli -i wfd0 p2p_find | # wpa_cli -i wfd0 p2p_find | ||
</pre> | |||
From device B, do the same to find peers: | From device B, do the same to find peers: | ||
<pre> | |||
# wpa_cli -i wfd0 p2p_find | # wpa_cli -i wfd0 p2p_find | ||
</pre> | |||
After a few moments, list the peers from device A to find the device B's P2P Device Address: | After a few moments, list the peers from device A to find the device B's P2P Device Address: | ||
# wpa_cli -i wfd0 p2p_peers | <pre> | ||
# wpa_cli -i wfd0 p2p_peers | |||
</pre> | |||
Connect to device B from device A using the P2P Device Address you found (replace XX:XX:XX:XX:XX:XX with the actual address): | Connect to device B from device A using the P2P Device Address you found (replace XX:XX:XX:XX:XX:XX with the actual address): | ||
<pre> | |||
# wpa_cli -i wfd0 p2p_connect XX:XX:XX:XX:XX:XX pbc go_intent=0 | # wpa_cli -i wfd0 p2p_connect XX:XX:XX:XX:XX:XX pbc go_intent=0 | ||
</pre> | |||
Verify Connection on Device B: Run a similar p2p_connect command with PBC (Push Button Connect) on Device B, like: | Verify Connection on Device B: Run a similar p2p_connect command with PBC (Push Button Connect) on Device B, like: | ||
<pre> | |||
# wpa_cli -i wfd0 p2p_connect <Device_A_MAC_Address> pbc | # wpa_cli -i wfd0 p2p_connect <Device_A_MAC_Address> pbc | ||
</pre> | |||
Verify the Connection on Both Devices, look for '''wpa_state=COMPLETED''' in the output.: | |||
<pre> | |||
# wpa_cli -i wfd0 status | # wpa_cli -i wfd0 status | ||
</pre> | |||
Assign IP Addresses (use ifconfig to determine the dynamically-created P2P interface like p2p-wfd0-1 and p2p-wfd0-0: | Assign IP Addresses (use ifconfig to determine the dynamically-created P2P interface like p2p-wfd0-1 and p2p-wfd0-0: | ||
<pre> | |||
# ifconfig p2p-wfd0-1 192.168.10.1 (On Device A) | # ifconfig p2p-wfd0-1 192.168.10.1 (On Device A) | ||
# ifconfig p2p-wfd0-0 192.168.10.2 (On Device B) | # ifconfig p2p-wfd0-0 192.168.10.2 (On Device B) | ||
</pre> | |||
Try pinging: | Try pinging: | ||
<pre> | |||
# ping 192.168.10.2 # From Device A | # ping 192.168.10.2 # From Device A | ||
# ping 192.168.10.1 # From Device B | # ping 192.168.10.1 # From Device B | ||
</pre> |
Revision as of 22:30, 14 August 2023
Wi-Fi Direct is a standard that enables devices to connect with each other without the need for a wireless access point or network infrastructure. It allows two devices to create a direct, peer-to-peer connection using a Wi-Fi protocol for data transfer, media sharing, or other types of communication.
Variscite SOMs with the Murata LBES5PL2xx (NXP IW61x) modules support WiFi Direct. You may verify your SOM supports WiFi Direct by checking for the wfd0 interface:
# ifconfig wfd0 wfd0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 192.168.9.2 netmask 255.255.255.0 broadcast 192.168.9.255 ether a2:cd:f3:78:23:82 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
The following process describes how to connect two Variscite SOMs (Device A and Device B) using WiFi Direct:
Device A (WiFi Direct) <================> Device B (WiFi Direct)
Device A Configuration:
Stop and disable NetworkManager and wpa_supplicant systemd services:
# systemctl stop NetworkManager; systemctl disable NetworkManager # systemctl stop wpa_supplicant; systemctl stop wpa_supplicant
Create a configuration file for device A, e.g., /etc/wpa_supplicant/wfd0_A.conf, with the following content:
ctrl_interface=/var/run/wpa_supplicant # Control interface directory driver_param=use_p2p_group_interface=1 # Enable dedicated P2P group interface update_config=1 # Allow configuration updates device_name=Device_A # Set device name device_type=1-0050F204-1 # Define device type (e.g., computer) p2p_go_intent=1 # Set group owner intent (0-15) p2p_listen_reg_class=81 # Regulatory class for listen channel p2p_listen_channel=11 # Listen channel number for discovery p2p_oper_reg_class=81 # Regulatory class for operating channel p2p_oper_channel=11 # Operating channel number as group owner
Start wpa_supplicant on device A for the wfd0 interface:
wpa_supplicant -i wfd0 -c /etc/wpa_supplicant/wfd0_A.conf -D nl80211,wext -B
Device B Configuration:
Stop and disable NetworkManager and wpa_supplicant systemd services:
# systemctl stop NetworkManager; systemctl disable NetworkManager # systemctl stop wpa_supplicant; systemctl stop wpa_supplicant
Create a configuration file for device B, e.g., /etc/wpa_supplicant/wfd0_B.conf, with similar content but different device name:
ctrl_interface=/var/run/wpa_supplicant # Control interface directory driver_param=use_p2p_group_interface=1 # Enable dedicated P2P group interface update_config=1 # Allow configuration updates device_name=Device_B # Set device name device_type=1-0050F204-1 # Define device type (e.g., computer) p2p_go_intent=9 # Set group owner intent (0-15) p2p_listen_reg_class=81 # Regulatory class for listen channel p2p_listen_channel=11 # Listen channel number for discovery p2p_oper_reg_class=81 # Regulatory class for operating channel p2p_oper_channel=11 # Operating channel number as group owner
Start wpa_supplicant on device B for the wfd0 interface:
# wpa_supplicant -i wfd0 -c /etc/wpa_supplicant/wfd0_B.conf -D nl80211,wext -B
Connecting the Devices:
Find peers from device A:
# wpa_cli -i wfd0 p2p_find
From device B, do the same to find peers:
# wpa_cli -i wfd0 p2p_find
After a few moments, list the peers from device A to find the device B's P2P Device Address:
# wpa_cli -i wfd0 p2p_peers
Connect to device B from device A using the P2P Device Address you found (replace XX:XX:XX:XX:XX:XX with the actual address):
# wpa_cli -i wfd0 p2p_connect XX:XX:XX:XX:XX:XX pbc go_intent=0
Verify Connection on Device B: Run a similar p2p_connect command with PBC (Push Button Connect) on Device B, like:
# wpa_cli -i wfd0 p2p_connect <Device_A_MAC_Address> pbc
Verify the Connection on Both Devices, look for wpa_state=COMPLETED in the output.:
# wpa_cli -i wfd0 status
Assign IP Addresses (use ifconfig to determine the dynamically-created P2P interface like p2p-wfd0-1 and p2p-wfd0-0:
# ifconfig p2p-wfd0-1 192.168.10.1 (On Device A) # ifconfig p2p-wfd0-0 192.168.10.2 (On Device B)
Try pinging:
# ping 192.168.10.2 # From Device A # ping 192.168.10.1 # From Device B