Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
interfaces:bluetooth [2023/12/06 02:21] – [Development] darroninterfaces:bluetooth [2023/12/15 07:45] (current) – [USB] darron
Line 1: Line 1:
 ====Bluetooth==== ====Bluetooth====
  
-Various Bluetooth device setup in Linux on RPi and similar devices.+See [[tools:bluetooth]] for Linux Bluetooth services and development.
  
 There are two standards in use known as BT classic and BT low energy. There are two standards in use known as BT classic and BT low energy.
  
-Anything other than BLE is considered obsolete now.+Anything other than BLE is considered to be legacy now.
  
 ^HCI / LMP^Version^ ^HCI / LMP^Version^
-|0| 1.0b| +|0|     1.0b| 
-|1| 1.1| +|1|     1.1| 
-|2| 1.2| +|2|     1.2| 
-|3| 2.0+EDR| +|3|     2.0+EDR| 
-|4| 2.1+EDR| +|4|     2.1+EDR| 
-|5| 3.0+HS| +|5|     3.0+HS| 
-|6| 4.0| +|6|     4.0| 
-|7| 4.1| +|7|     4.1| 
-|8| 4.2| +|8|     4.2| 
-|9| 5.0| +|9|     5.0| 
-|10| 5.1| +|10|    5.1| 
-|11| 5.2| +|11|    5.2| 
-|12| 5.3|+|12|    5.3|
  
 BT 3.0+HS utilises WiFi. BT 4.0 onward is BLE, anything prior is BDR/EDR. BT 3.0+HS utilises WiFi. BT 4.0 onward is BLE, anything prior is BDR/EDR.
  
-===Hardware=== +===RPi===
- +
-==RPi==+
  
 The Raspberry Pi3/4 have built in BT BLE 5.0 but it can be awkward to setup The Raspberry Pi3/4 have built in BT BLE 5.0 but it can be awkward to setup
Line 39: Line 37:
 </code> </code>
  
-Alternatively, Kernel attachment requires the following entry in /boot/config.txt +Alternatively, the kernel can attach with the following entry in /boot/config.txt 
-on both the Pi3 and Pi4.+on both the Pi3 and Pi4 (reboot to take effect).
  
 <code> <code>
Line 115: Line 113:
 </code> </code>
  
-==USB==+===USB===
  
-Here is a list of obsolete BT USB adapters all of which are either BT 2.0 or 1.2.+Here is a list of legacy BT USB adapters all of which are either BT 2.0 or 1.2.
  
  
 __BARROT__ __BARROT__
  
-BT 2.0 CSR clones which are very cheap from pound stores.+CSR clones which are very cheap and found in pound stores. 
 + 
 +BT 2.0
  
 <code> <code>
Line 157: Line 157:
 __Silicon Wave__ __Silicon Wave__
  
-A very old BT 1.2 interface+A very old USB adapter. 
 + 
 +BT 1.2
  
 <code> <code>
Line 218: Line 220:
 </code> </code>
  
-BT 2.0 + EDR+BT 2.0
  
 <code> <code>
Line 245: Line 247:
         Manufacturer: Broadcom Corporation (15)         Manufacturer: Broadcom Corporation (15)
 </code> </code>
-===Services=== 
  
-==DBUS== 
- 
-I normally disable dbus with systemd and here is how to enable this service with `runit' if preferred. 
- 
-<code> 
-#!/bin/bash 
-sleep 1 
- 
-#LOG 
-exec 2>&1 
-ulimit -aH 
- 
-#RUN 
-export TZ="UTC" 
-rm -Rf /var/run/dbus 
-mkdir -p /var/run/dbus 
-exec dbus-daemon --syslog --syslog-only --nofork --config-file=/usr/share/dbus-1/system.conf 
-</code> 
- 
-==BLUETOOTHD== 
- 
-Install bluez and various tools if not already installed 
- 
-<code> 
-apt install bluez bluez-tools bluez-test-tools bluez-hcidump 
-</code> 
- 
-I prefer to run Bluetoothd from `runit' 
- 
-This run file can work but it  should wait until dbus is ready before starting. 
- 
-See the wait method of runit to detect /var/run/dbus/pid. 
- 
-<code> 
-#!/bin/bash 
-sleep 5 
- 
-#LOG 
-exec 2>&1 
-ulimit -aH 
- 
-#RUN 
-export TZ="UTC" 
-exec /usr/sbin/bluetoothd -n 
-</code> 
- 
-===Development=== 
- 
-==Headers== 
- 
-Install dev headers for the current installation of bluez 
- 
-<code> 
-apt install libbluetooth-dev 
-</code> 
- 
-==Source== 
-Access source code for documentation of how to use bluez 
- 
-<code> 
-git clone https://github.com/bluez/bluez 
-</code> 
- 
-bluez source code demonstrates how to access BT devices via dbus in the src directory or the API in the attrib and tools directories. 
- 
-==Build== 
- 
-Build the source to create tools 
- 
-<code> 
-sudo apt-get install glib2.0-dev libdbus-1-dev libical-dev python3-docutils 
-./bootstrap 
-./configure --prefix=/opt/bt --enable-experimental --enable-deprecated 
-</code> 
- 
-Test BLE device 
- 
-<code> 
-./tools/btgatt-client -d 00:80:E1:22:F9:7C 
-Connecting to device... Done 
-[GATT client]# Service Added - UUID: 00001801-0000-1000-8000-00805f9b34fb start: 0x0001 end: 0x0004 
-[GATT client]# Service Added - UUID: 00001800-0000-1000-8000-00805f9b34fb start: 0x0005 end: 0x000b 
-[GATT client]# Service Added - UUID: 0000fe40-cc7a-482a-984a-7f2ed5b3e58f start: 0x000c end: 0x0011 
-[GATT client]# GATT discovery procedures complete 
-[GATT client]# 
-service - start: 0x0001, end: 0x0004, type: primary, uuid: 00001801-0000-1000-8000-00805f9b34fb 
-          charac - start: 0x0002, value: 0x0003, props: 0x20, ext_props: 0x0000, uuid: 00002a05-0000-1000-8000-00805f9b34fb 
-                  descr - handle: 0x0004, uuid: 00002902-0000-1000-8000-00805f9b34fb 
- 
-service - start: 0x0005, end: 0x000b, type: primary, uuid: 00001800-0000-1000-8000-00805f9b34fb 
-          charac - start: 0x0006, value: 0x0007, props: 0x0a, ext_props: 0x0000, uuid: 00002a00-0000-1000-8000-00805f9b34fb 
-          charac - start: 0x0008, value: 0x0009, props: 0x02, ext_props: 0x0000, uuid: 00002a01-0000-1000-8000-00805f9b34fb 
-          charac - start: 0x000a, value: 0x000b, props: 0x02, ext_props: 0x0000, uuid: 00002a04-0000-1000-8000-00805f9b34fb 
- 
-service - start: 0x000c, end: 0x0011, type: primary, uuid: 0000fe40-cc7a-482a-984a-7f2ed5b3e58f 
-          charac - start: 0x000d, value: 0x000e, props: 0x06, ext_props: 0x0000, uuid: 0000fe41-8e22-4541-9d4c-21edae82ed19 
-          charac - start: 0x000f, value: 0x0010, props: 0x10, ext_props: 0x0000, uuid: 0000fe42-8e22-4541-9d4c-21edae82ed19 
-                  descr - handle: 0x0011, uuid: 00002902-0000-1000-8000-00805f9b34fb 
- 
-[GATT client]# ^C 
- 
-Shutting down... 
-</code>