您的位置:首页 > 产品设计 > UI/UE

How to use bluetooth tools --- hciattach hciconfig hcitool sdptool rfcomm

2011-06-28 17:43 736 查看
create connection to bt device


1. HCI UART driver initialization,
Attach the tty device

hciattach /dev/ttyS1 any
38400
flow

2. Open and initialize HCI device

hciconfig
hci0 up

3. Get/Set local name

hciconfig
hci0 name [name]

hciconfig hci0 name TEST --- set the
name as "TEST"

4. Display local devices

hcitool dev

5. Scan for remote devices

hcitool scan

6. Create connection to remote
device

hcitool cc

create
connection to bt
spp


1. browse the spp sevice

# sdptool browse

bdaddr

2. bind to a rfcomm device

# rfcomm bind /dev/rfcomm0
bdaddr

3. create a connection

# hcitool cc bdaddr

4. open minicom

Serial Device : /dev/rfcomm0

Bps/Par/Bits : 115200 8N1

Hardware Flow Control : No

Software Flow Control : No

# minicom -s rfc0

hcitool


Usage:

hcitool [options] <command> [command parameters]

Options:

--help Display help

-i dev HCI device

Commands:

dev Display local devices

inq Inquire remote devices

scan Scan for remote devices

name Get name from remote device

info Get information from remote device

spinq Start periodic inquiry

epinq Exit periodic inquiry

cmd Submit arbitrary HCI commands

con Display active connections

cc Create connection to remote device

dc Disconnect from remote device

sr Switch master/slave role

cpt Change connection packet type

rssi Display connection RSSI

lq Display link quality

tpl Display transmit power level

afh Display AFH channel map

lp Set/display link policy settings

lst Set/display link supervision timeout

auth Request authentication

enc Set connection encryption

key Change connection link key

clkoff Read clock offset

clock Read local or remote clock

sdptool



sdptool - SDP tool v4.60

Usage:

sdptool [options] <command> [command parameters]

Options:

-h Display help

-i Specify source interface

Commands:

search Search for a service

browse Browse all available services

records Request all records

add Add local service

del Delete local service

get Get local service

setattr Set/Add attribute to a SDP record

setseq Set/Add attribute sequence to a SDP record

Services:

DID SP DUN LAN FAX OPUSH FTP PRINT HS HSAG HF HFAG SAP PBAP NAP

GN PANU HCRP HID KEYB WIIMOTE CIP CTP A2SRC A2SNK AVRCT AVRTG

UDIUE UDITE SEMCHLA SR1 SYNCML SYNCMLSERV ACTIVESYNC HOTSYNC

PALMOS NOKID PCSUITE NFTP NSYNCML NGAGE APPLE ISYNC

rfcomm

RFCOMM configuration utility ver 4.60

Usage:

rfcomm [options] <command> <dev>

Options:

-i [hciX|bdaddr] Local HCI device or BD Address

-h, --help Display help

-r, --raw Switch TTY into raw mode

-A, --auth Enable authentication

-E, --encrypt Enable encryption

-S, --secure Secure connection

-M, --master Become the master of a piconet

-f, --config [file] Specify alternate config file

-a Show all devices (default)

Commands:

bind <dev> <bdaddr> [channel] Bind device

release <dev> Release device

show <dev> Show device

connect <dev> <bdaddr> [channel] Connect device

listen <dev> [channel [cmd]] Listen

watch <dev> [channel [cmd]] Watch
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: