Template:WIFI DIRECT: Difference between revisions

From Variscite Wiki
No edit summary
No edit summary
Line 4: Line 4:


<pre>
<pre>
# ifconfig wfd0
# ifconfig wfd0
wfd0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
wfd0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether f6:b2:ba:f8:49:59  txqueuelen 1000  (Ethernet)
        ether f6:b2:ba:f8:49:59  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        RX errors 0  dropped 0  overruns 0  frame 0
        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>
</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:

Revision as of 22:51, 14 August 2023

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. Verify if your SOM supports WiFi Direct by checking for the wfd0 interface:

# 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

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