Site Tools


linux:raspberry:bluetooth:bluetooth

root@raspberrypi:~# apt-get install bluetooth bluez blueman
root@raspberrypi:~# lsusb 
Bus 001 Device 005: ID 0a5c:2101 Broadcom Corp. BCM2045 Bluetooth
Bus 001 Device 004: ID 046a:c090 Cherry GmbH 
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@raspberrypi:~# echo "0a5c 2101" > /sys/bus/usb/drivers/b
brcmfmac/ btusb/    
root@raspberrypi:~# echo "0a5c 2101" > /sys/bus/usb/drivers/btusb/
1-1.4:1.0/ bind       new_id     uevent     
1-1.4:1.1/ module/    remove_id  unbind     
root@raspberrypi:~# echo "0a5c 2101" > /sys/bus/usb/drivers/btusb/new_id 
root@raspberrypi:~# modprobe -v btusb
root@raspberrypi:~# vi /etc/modules
root@raspberrypi:~# vi /etc/default/bluetooth 
root@raspberrypi:~# invoke-rc.d bluetooth restart 

root@raspberrypi:~# hcitool dev
Devices:
	hci1	00:02:72:0B:5D:C9
	hci0	B8:27:EB:A2:54:67
root@raspberrypi:~# hciconfig 
hci1:	Type: Primary  Bus: USB
	BD Address: 00:02:72:0B:5D:C9  ACL MTU: 1017:8  SCO MTU: 64:8
	UP RUNNING PSCAN 
	RX bytes:5425 acl:23 sco:0 events:191 errors:0
	TX bytes:2803 acl:21 sco:0 commands:96 errors:0

hci0:	Type: Primary  Bus: UART
	BD Address: B8:27:EB:A2:54:67  ACL MTU: 1021:8  SCO MTU: 64:1
	UP RUNNING 
	RX bytes:1581 acl:0 sco:0 events:105 errors:0
	TX bytes:6249 acl:0 sco:0 commands:105 errors:0
root@raspberrypi:~# hcitool --help
hcitool - HCI Tool ver 5.50
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
	lescan	Start LE scan
	leinfo	Get LE remote information
	lewladd	Add device to LE White List
	lewlrm	Remove device from LE White List
	lewlsz	Read size of LE White List
	lewlclr	Clear LE White List
	lerladd	Add device to LE Resolving List
	lerlrm	Remove device from LE Resolving List
	lerlclr	Clear LE Resolving List
	lerlsz	Read size of LE Resolving List
	lerlon	Enable LE Address Resolution
	lerloff	Disable LE Address Resolution
	lecc	Create a LE Connection
	ledc	Disconnect a LE Connection
	lecup	LE Connection Update

For more information on the usage of each command use:
	hcitool <command> --help
root@raspberrypi:~# hcitool scan
Scanning ...
	AC:07:5F:3C:76:CD	Kryptikk
root@raspberrypi:~# gatttool -I -b AC:07:5F:3C:76:CD
[AC:07:5F:3C:76:CD][LE]> connect
Attempting to connect to AC:07:5F:3C:76:CD
Error: connect: Operation not supported (95)
[AC:07:5F:3C:76:CD][LE]> help
help                                           Show this help
exit                                           Exit interactive mode
quit                                           Exit interactive mode
connect         [address [address type]]       Connect to a remote device
disconnect                                     Disconnect from a remote device
primary         [UUID]                         Primary Service Discovery
included        [start hnd [end hnd]]          Find Included Services
characteristics [start hnd [end hnd [UUID]]]   Characteristics Discovery
char-desc       [start hnd] [end hnd]          Characteristics Descriptor Discovery
char-read-hnd   <handle>                       Characteristics Value/Descriptor Read by handle
char-read-uuid  <UUID> [start hnd] [end hnd]   Characteristics Value/Descriptor Read by UUID
char-write-req  <handle> <new value>           Characteristic Value Write (Write Request)
char-write-cmd  <handle> <new value>           Characteristic Value Write (No response)
sec-level       [low | medium | high]          Set security level. Default: low
mtu             <value>                        Exchange MTU for GATT/ATT
[AC:07:5F:3C:76:CD][LE]> primary
Command Failed: Disconnected
[AC:07:5F:3C:76:CD][LE]> quit
root@raspberrypi:~# 

linux/raspberry/bluetooth/bluetooth.txt · Last modified: 2020/01/15 14:10 by lunetikk