hcitool is a Linux command line tool for managing and debugging Bluetooth devices. It can be used to scan surrounding Bluetooth devices, connect to Bluetooth devices to send commands and data packets, etc.
hcitool is a Linux command line tool that is usually pre-installed in most Linux distributions. If hcitool is not installed in your system, you can use the following command to install it (debian series release example)
sudo apt-get install bluez
Precautions:
To use ble related commands, you need to escalate your privileges, such as: lescan
hcitool [options] <command> [command parameters]
dev displays local devices
inq queries remote devices
scan scans remote devices
name Get name from remote device
info Get information from remote device
spinq starts a periodic query
epinq exit periodic query
cmd Submit arbitrary HCI commands
con shows active connections
cc creates a connection to a remote device
dc Disconnect from remote device
sr switch central/peripheral role
cpt changes connection packet type
rssi show connection rssi
lq displays link quality
tpl displays transmit power level
afh display afh channel map
lp settings/show link policy settings
lst sets/displays link monitoring timeout
auth request authentication
enc sets connection encryption
key changes the connection link key
clkoff reads clock offset
clock reads local or remote clock
lescan starts LE scan
leinfo Get LE remote information
lealadd Add device to LE accept list
dealrm Remove device from LE accept list
lealsz LE accept list read size
lealclr Clear LE acceptance list
Scan for surrounding Bluetooth devices
hcitool scan
Connect to Bluetooth device via mac address
hcitool cc <MAC address>
Display current Bluetooth adapter information
hcitooldev
Find the Bluetooth name by mac address
hcitool name <MAC address>
Display current Bluetooth active connection information
hcitool con
优先推荐相关内容,同时保留你的阅读轨迹和收藏入口。