embeded/raspberry pi2020. 5. 9. 22:53

라즈베리 파이 2B / debian 10.3 이미지 사용

buffalo WLI-UC-GNM 802.11n 어댑터 사용

 

 

무선랜 스캔

$ iwlist wlan0 scan

 

무선랜 설정 (무선랜 이름이 iptime 일 경우)

$ sudo iwconfig wlan0 essid "iptime"

 

WPA_PSK 키 설정 (iptime 공유기의 무선랜 암호가 password일 경우)

(단, root 계정으로 하지 않으면 wpa_passphrase 실행 결과를 복사해서 sudo로 conf 파일에 넣어야 함)

wpa_passphrase "iptime" password > /etc/wpa_supplicant/wpa_supplicant.conf

 

무선랜 접속

아래의 명령어가 실행중인 동안에만 유지가 된다.

sudo wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf

 

[링크 : https://lhjin.tistory.com/entry/리눅스에서-무선랜WiFi-사용방법]

[링크 : http://webterror.net/?p=783]

 

 

그럼 이제 이걸.. 기본 데몬으로 가능한 방법을 찾으면 되려나?

 

+

wpa_supllicant.conf 파일에 내용이 존재하면 자동으로 그걸 이용해서 접속하도록 되어있다.

reboot 이후 정상적으로 접속되는 것을 확인함

 

[링크 : https://weworkweplay.com/play/automatically-connect-a-raspberry-pi-to-a-wifi-network/]

'embeded > raspberry pi' 카테고리의 다른 글

라즈베리 파이 무선공유기 만들기(비밀번호 없이)  (0) 2020.05.13
dhcpcd 설정  (0) 2020.05.13
라즈베리 파이 wifi AP로 설정하기  (0) 2020.05.09
GND가 문제였군..  (0) 2020.05.05
라즈베리 + L298N 실패..  (0) 2020.04.30
Posted by 구차니
embeded/raspberry pi2020. 5. 9. 21:37

hostapd만 설치하고 open system 으로 설정하니

ip 주소를 받아오지 못해서 핸드폰에서 정상적으로 접속하지 못한다.

dnsmasq를 꼭 깔아야 하려나? dhcpcd만 깔면되려나..

 

----

 

hostapd / dnsmasq 두개가 debian 계열 패키지로 제공되는 녀석인 듯

드론 처럼 wifi AP로만 쓰고 외부로 접속을 공유해주는 '무선공유기'를 만들게 아니라면

dnsmasq는 쓸데 없을 것 같긴한데..

dnsmasq에 dhcpcd 가 포함이 되는거라면 hostapd / dhcpcd 두개를 설치하는 것이 내가 원하는 방향이 될 듯 하다.

 

$ sudo apt install hostapd

[링크 : https://thepi.io/how-to-use-your-raspberry-pi-as-a-wireless-access-point/]

[링크 : https://airpage.org/xe/project_data/24937]

[링크 : https://fishpoint.tistory.com/2159]

 

+

$ systemctl status hostapd
● hostapd.service
   Loaded: masked (Reason: Unit hostapd.service is masked.)
   Active: failed (Result: exit-code) since Sat 2020-05-09 23:02:20 KST; 11min ago

 5월 09 23:02:20 raspberrypi systemd[1]: hostapd.service: Service RestartSec=100ms expired, scheduling restart.
 5월 09 23:02:20 raspberrypi systemd[1]: hostapd.service: Failed to schedule restart job: Unit hostapd.service is masked.
 5월 09 23:02:20 raspberrypi systemd[1]: hostapd.service: Failed with result 'exit-code'.

 

구동이 안되네?

$ sudo service hostapd restart
Failed to restart hostapd.service: Unit hostapd.service is masked.

 

masked는 첨 보는데.. 찾아보니 unmask 라는걸로 풀어주고 하면 문제가 없다.

$ sudo systemctl unmask hostapd
$ sudo systemctl enable hostapd
$ sudo systemctl start hostapd

 

아무튼.. 데몬을 실행하니 아래와 같이 아이피 하나 잡혀주긴 한다.

$ ifconfig wlan0
wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 4c:e6:76:90:50:d5  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

$ ifconfig wlan0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 169.254.71.187  netmask 255.255.0.0  broadcast 169.254.255.255
        inet6 fe80::a73b:b28c:e97:7810  prefixlen 64  scopeid 0x20<link>
        ether 4c:e6:76:90:50:d5  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 30  bytes 5854 (5.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

핸드폰에서 확인하니 NETWORK 라는 무선 AP가 생겨났지만

PASSWORD라고 암호를 설정해준 것이 문제인지 인증 과정에서 넘어가질 못한다.

[링크 : https://www.diymaker.net/143]

 

+

wpa=0

auth_algs=1

위와 같이 하면 open system authentication으로 암호없이 접속은 가능해진다.

auth_algs=0 으로 하면 "no authentication algorithms allowed" 에러가 뜨며 데몬이 정상적으로 구동되지 않는다.

 

##### WPA/IEEE 802.11i configuration ##########################################

# Enable WPA. Setting this variable configures the AP to require WPA (either
# WPA-PSK or WPA-RADIUS/EAP based on other configuration). For WPA-PSK, either
# wpa_psk or wpa_passphrase must be set and wpa_key_mgmt must include WPA-PSK.
# Instead of wpa_psk / wpa_passphrase, wpa_psk_radius might suffice.
# For WPA-RADIUS/EAP, ieee8021x must be set (but without dynamic WEP keys),
# RADIUS authentication server must be configured, and WPA-EAP must be included
# in wpa_key_mgmt.
# This field is a bit field that can be used to enable WPA (IEEE 802.11i/D3.0)
# and/or WPA2 (full IEEE 802.11i/RSN):
# bit0 = WPA
# bit1 = IEEE 802.11i/RSN (WPA2) (dot11RSNAEnabled)
# Note that WPA3 is also configured with bit1 since it uses RSN just like WPA2.
# In other words, for WPA3, wpa=2 is used the configuration (and
# wpa_key_mgmt=SAE for WPA3-Personal instead of wpa_key_mgmt=WPA-PSK).
#wpa=2

# IEEE 802.11 specifies two authentication algorithms. hostapd can be
# configured to allow both of these or only one. Open system authentication
# should be used with IEEE 802.1X.
# Bit fields of allowed authentication algorithms:
# bit 0 = Open System Authentication
# bit 1 = Shared Key Authentication (requires WEP)
auth_algs=3

[링크 : https://w1.fi/cgit/hostap/plain/hostapd/hostapd.conf]

 

+ 2020.05.13

wpa=0 이 아니라 wpa 를 아예 설정하지 않으면 암호 없는 네트워크로 설정된다.

 

[링크 : http://nitlab.inf.uth.gr/mazi-guides/accessPoint.html]

'embeded > raspberry pi' 카테고리의 다른 글

dhcpcd 설정  (0) 2020.05.13
라즈베리 파이 iwlist, iwconfig 로 무선접속하기  (0) 2020.05.09
GND가 문제였군..  (0) 2020.05.05
라즈베리 + L298N 실패..  (0) 2020.04.30
라즈베리 파이 pinout 유틸리티  (0) 2020.04.30
Posted by 구차니
Programming/android2020. 5. 9. 13:23

조이스틱 같은 앱을 만드려면 두 개 이상의 터치에 대한 드래그를 처리해야 가능하겠군..

 

[링크 : https://developer.android.com/training/gestures/multi]

[링크 : https://bitsoul.tistory.com/169]

Posted by 구차니
Programming/android2020. 5. 9. 13:16

조이스틱 처럼 만들어 봐야 하나

아니면 버튼으로 해봐야 하려나? (버튼 다운/ 업 으로 구분?)

 

[링크 : https://wickies.tistory.com/103]

[링크 : https://code.tutsplus.com/ko/tutorials/android-from-scratch-using-rest-apis--cms-27117]

 

롱 클릭 이라는 것도 있네 몇초이려나?

[링크 : https://bitsoul.tistory.com/13]

Posted by 구차니