Raspberry Pi WiFi Direct

2018. 12. 26. 08:41Linux/Raspberry Pi

Raspberry Pi WiFi Direct 사용을 위한 설정 방법.

/etc/wpa_supplicant/wpa_supplicant.conf을 아래와 같이 수정한다.

ctrl_interface=DIR=/var/run/wpa_supplicant
update_config=1
ap_scan=1
device_name=RPi_3 

# Primary Device Type
# Used format: <categ>-<0UI>-<subcateg>
# 1-0050F204-1 (Computer / PC)
# 1-0050F204-1 (Computer / Server)
# 1-0050F204-1 (Storage / NAS)
# 1-0050F204-1 (Network Infrastructure / AP)
device_type=1-0050F204-1 

driver_param=use_p2p_group_interface=1
driver_param=p2p_device=1

# If you need to modify the group owner intent, 0-15, the higher
# number indicates preference to become the GO. You can also set
# this on p2p_connect commands.
p2p_go_intent=10 

# p2p_go_ht40 - Default mode for HT40 enable when operating as GO.
# This will take effect for p2p_group_add and p2p_connect. Note that
# regulatory constraints and driver capabilities are consulted anyway,
# so setting it to 1 can't do real harm
# By default: 0 (disabled)
p2p_go_ht40=1

수정 후 아래와 같이 console에 입력한다.
$sudo wpa_supplicant -B -dd -iwlan0 -Dnl80211 -c /etc/wpa_supplicant/wpa_supplicant.conf

선택된 Interface출력
$wpa_cli p2p_find
Slected interface 'p2p-dev-wlan0'
OK

Peer의 mac address를 출력.
$wpa_cli p2p_peers
Selected interface 'p2p-dev-wlan0'
aa:bb:cc:dd:ee:ff

PIN 인증을 통한 연결을 사용.
$wpa_cli p2p_connect [연결할 taget MAC address xx:xx:xx:xx:xx:xx] pin auth
PIN 번호가 생성 됨.
ex)
$wpa_cli p2p_connect aa:bb:cc:dd:ee:ff pin auth