Template:WIFI DIRECT: Difference between revisions

From Variscite Wiki
(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
 
(6 intermediate revisions by the same user not shown)
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.
<includeonly>
'''Wi-Fi Direct''' is a standard that allows devices to connect with each other without a wireless access point or network infrastructure. It facilitates a direct, peer-to-peer connection between two devices using Wi-Fi for data transfer, media sharing, and other communication types.


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. Verify if 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


<pre>
# ifconfig wfd0
wfd0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether f6:b2:ba:f8:49:59  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
</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:


Device A (WiFi Direct)  <================>  Device B (WiFi Direct)
<pre>
 
Device A (WiFi Direct)  <================>  Device B (WiFi Direct)
Device A Configuration:
</pre>
'''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:


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:


  wpa_supplicant -i wfd0 -c /etc/wpa_supplicant/wfd0_A.conf -D nl80211,wext -B
<pre>
 
  # wpa_supplicant -i wfd0 -c /etc/wpa_supplicant/wfd0_A.conf -D nl80211,wext -B
Device B Configuration:
</pre>
'''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:


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.:


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>
</includeonly>

Latest revision as of 22:52, 14 August 2023