1# BTstack Port for FreeBSD Systems 2 3## Overview 4This port assumes that FreeBSD provides an ng_hci netgraph node for a connected Bluetooth Controller. 5In most cases, these are Bluetooth USB dongles or built-in Bluetooth Controller connected via USB. 6 7For Bluetooth Controllers connected via UART, the POSX-H4 port might be a better option als 8 9## Implementation details 10In FreeBSD 13.2, the hci node is connected to a l2cap node and a btsock_hci_raw node. In order to take control, this 11port create a custom netgraph ng_socket node and connect to the 'acl' and 'raw' hooks of the hci node. The OS Bluetooth 12functionality will be interrupted. 13 14## Compilation 15 16BTstack's FeeeBSD port does not have additional dependencies. To compile the cmake project with Make 17 18 mkdir build 19 cd build 20 cmake .. 21 make 22 23or using Ninja: 24 25 mkdir build 26 cd build 27 cmake -G Ninja .. 28 ninja 29 30## Running the examples 31 32As the port needs to reconfigure the Bluetooth netgraph node, it needs to run with root privileges. 33It tries to connect to 'ubt0hci' by default. If your Bluetooth Controller is different, you can select it with '-u node' 34On start, BTstack prints the path to the packet log and prints the information on the detected Buetooth Controller. 35 36 $ sudo gatt_counter 37 Packet Log: /tmp/hci_dump.pklg 38 BTstack counter 0001 39 BTstack up and running on 00:1A:7D:DA:71:13. 40 41## ToDO 42- drop privileges after startup 43- auto-detect ng_hci node 44- support for profiles that require SCO: HFP & HSP 45