1. 코드 수정
2. 페어링
3. 수정된 rfcommclient 실행.
4. 페어링 제거
# bluez-test-device remove xx:xx:xx:xx:xx:xx
1. 코드 수정
사용자가 없는데 PIN 코드를 입력할 수 없으므로.
bluez-simple-agent를 수정하자.
아래 import는 기본이시고
import os
root@raspberrypi:/home/pi# whereis bluez-simple-agent
bluez-simple-agent: /usr/bin/bluez-simple-agent /usr/bin/X11/bluez-simple-agent /usr/share/man/man1/bluez-simple-agent.1.gz
root@raspberrypi:/home/pi# vi /usr/bin/bluez-simple-agent
def RequestPinCode(self, device):
print "RequestPinCode (%s)" % (device)
return raw_input("Enter PIN Code: ")
def RequestPinCode(self, device):
pin_code = os.getenv('PIN_CODE', "unknown")
print pin_code
if(pin_code == "unknown"):
print "RequestPinCode (%s)" % (device)
return raw_input("Enter PIN Code: ")
else:
return pin_code
2. 페어링 - 우리 말로 짝짓기 -> 한자어로 교미 -> 영어로 i가e가 되는 six. -- ???
The pairing can be done by running the following command:
sudo bluez-simple-agent hci# xx:xx:xx:xx:xx:xx
The # is the number of your device (probably be 0 if you have only one bluetooth dongle connected) and xx:xx:xx:xx:xx:xx is the address of the serial Bluetooth module. After a few seconds, the program should ask you for the pin code of the Bluetooth module. By default, the pin for this module is 1234, and this password could be modified in AT mode.
'실전 임베디드' 카테고리의 다른 글
| 금속 탐지기 Metal Detector (0) | 2019.09.22 |
|---|---|
| mysql 간단하게 사용하기. 실전 임베디드 2016. 2. 13. 15:30 (0) | 2019.09.22 |
| raspberry pi bluetooth 실전 임베디드 2016. 2. 11. 15:17 (0) | 2019.09.22 |
| raspberry pi boot script /etc/init.d 실전 임베디드 2016. 2. 5. 16:29 (0) | 2019.09.22 |
| raspberry pi keyboard layout 실전 임베디드 2016. 2. 5. 14:52 (0) | 2019.09.22 |