Help with Bluetooth LE stack
- Reply: Gergely Czuczy : "Re: Help with Bluetooth LE stack"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 08 Feb 2024 19:09:53 UTC
Hello, I would like to ask for a bit of help. I'm absolutely not familiar with bluetooth, and one of my components for my project is a bluetooth LE device[1], and I'm having some troubles with the BT stack. Initially I've based my code on the FreeBSD-BLE[2] examples, and my stack worked. However, there was a power outage and the device restarted, and this example stuff is still getting data, but my stack is not anymore. What so far I have (and used to work but doesn't anymore) is at [3]. I've tried reading through the manuals and docs, but it's absolutely blurry. Like NG_HCI(4) tells me to do 3 things during HCI init (Read_BD_ADDR, Read_Local_Supported_Features, Read_Buffer_Size) but doesn't exactly tells me how. I'm using the bluetooth(4), and it's told the bt_* calls return -1 on error, but how do I get the actual error is nowhere explained. Especially for things like NGM_HCI_NODE_GET_BDADDR, I don't know what the output data structure to bt_devreq looks like, and how to get any error codes out, the call like I do is not touching the output buffer. Also, what I couldn't get done using the example code in [2] is to make this work from userspace, even the example only returns data as root. I'm on FreeBSD 14.0-STABLE arm64 if it matters. Could I please get some help on how to work with the BTLE stack properly? Best regards, Gergely [1] https://kvurd.com/blog/tilt-hydrometer-ibeacon-data-format/ [2] https://github.com/takawata/FreeBSD-BLE/tree/master/le_enable [3] https://github.com/gczuczy/aegir/blob/fermd/controllers/fermd/Bluetooth.cc