BlueZ arm linux 에서 의 사용
arm linux 버 전:2.6.17.8
bluez 사용 의 중점 은 바로 설정 문제 입 니 다.여 기 는 주로 rfcomm 의 사용 을 말 합 니 다.바로 블 루 투 스 아 날로 그 직렬 포트 의 사용 입 니 다.
#
# HCI daemon configuration file.
#
# HCId options
options {
# Automatically initialize new devices
autoinit yes;
# Security Manager mode
# none - Security manager disabled
# auto - Use local PIN for incoming connections
# user - Always ask user for a PIN
#
security user;
# Pairing mode
# none - Pairing disabled
# multi - Allow pairing with already paired devices
# once - Pair once and deny successive attempts
pairing multi;
# PIN helper
pin_helper /home/pin;
# D-Bus PIN helper
#dbus_pin_helper;
}
# Default settings for HCI devices
device {
# Local device name
# %d - device id
# %h - host name
name "Bluez (%d)";
# Local device class
class 0x3e0100;
# Default packet type
#pkt_type DH1,DM1,HV1;
# Inquiry and Page scan
iscan enable; pscan enable;
# Default link mode
# none - no specific policy
# accept - always accept incoming connections
# master - become master on incoming connections,
# deny role switch on outgoing connections
lm accept;
# Default link policy
# none - no specific policy
# rswitch - allow role switch
# hold - allow hold mode
# sniff - allow sniff mode
# park - allow park mode
lp rswitch,hold,sniff,park;
# Authentication and Encryption (Security Mode 3)
#auth enable;
#encrypt enable;
}
관건 적 인 수정 은:
security auto; ---> security user;//auto 극 불안정
pin_helper /usr/sbin/pin; --->pin_helper /home/pin;//스스로 수정 하기 편 할 뿐이다.
그 중/home/pin 은 간단 한 스 크 립 트 입 니 다.
#!/bin/sh
echo "PIN:0000"
비밀 번 호 를 수정 하려 면 PIN:뒷부분 을 수정 하 세 요.
1.초기 화 파일 불 러 오기:
hcid -f /etc/bluetooth/hcid.conf
2.SDP 설정:
sdpd
sdptool add SP
그 중에서 sdptool add SP 는 기본적으로 channel 1 을 사용 합 니 다.다른 구체 적 인 channel 을 설정 하면 sdptool add--channel=x SP,x 는 사용 하지 않 은 channel 번호 입 니 다.
추가 성공 여 부 는 sdptool browse local 에서 조회 할 수 있 습 니 다.
3.rfcomm 배경 감청 설정:
rfcomm listen /dev/rfcomm0 1&
만약 당신 이 이전에 채널 을 설정 했다 면 이곳 의 1 을 당신 의 채널 번호 로 바 꾸 세 요.
이상 은 자신 이 slave 를 하 는 경우 입 니 다.host 를 하면 상대방 의 서비스 와 channel 을 먼저 받 아야 합 니 다.초기 화 는 위의 첫 번 째 단계 이 고 두 번 째 단계 도 받 지 않 아 도 됩 니 다.세 번 째 부분 은 바 꿉 니 다.
sdptool browse XX:XX:XX:XX:XX
XX:XX:XX:XX:XX 는 slave 의 Mac 주소 입 니 다.그리고 구체 적 인 sever 와 channel 을 찾 아 연결 할 channel 번호 x 를 찾 아 연결 할 수 있 습 니 다.
rfcomm connect 0 XX:XX:XX:XX:XX 1&
그 중 1 은 channel 입 니 다.다른 임의의 채널 번호 로 바 꿀 수 있 습 니 다.그 중에서 앞의 0 은 rfcome 0 을 말 하 며/dev/rfcomm 0 으로 바 꿀 수도 있 습 니 다.
상기 두 가지 상황 중 어느 것 이 든 ok 을 연결 하면 rfcomm0 포트 를 조작 하여 정상 적 인 직렬 통신 을 할 수 있 습 니 다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
용감한 바로 가기 및 우분투 응용 프로그램안녕하세요 여러분, 이 기사에서는 모든 사이트에서 pwa를 생성하고 실행기 응용 프로그램으로 추가하는 방법을 설명하고 싶습니다. 일부 웹사이트는 PWA로 설치를 허용하지 않지만 유사한 애플리케이션을 원합니다. 1. ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.