Page MenuHomeFreeBSD

Allow Bluetooth HCI raw sockets to send ACL/SCO data
Needs RevisionPublic

Authored by val_packett.cool on Jul 16 2020, 5:35 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 5, 1:13 PM
Unknown Object (File)
Feb 11 2025, 10:56 PM
Unknown Object (File)
Jan 24 2025, 5:13 PM
Unknown Object (File)
Dec 7 2024, 1:54 AM
Unknown Object (File)
Nov 26 2024, 1:31 PM
Unknown Object (File)
Oct 31 2024, 10:00 AM
Unknown Object (File)
Oct 29 2024, 3:05 AM
Unknown Object (File)
Oct 29 2024, 12:01 AM

Details

Reviewers
takawata
emax
Group Reviewers
Contributor Reviews (src)
Summary

Bugzilla: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=248015

Basically what it says. I needed this for some BLE experiments. Seems to work fine. The kernel ACL handling's debug output spams dmesg with "Connection does not exist" stuff, but the packets are copied to the raw hook before these checks, so the raw HCI application can safely ignore the kernel's ACL handling.

Disclaimer: I don't know what I'm doing :D if there's a different way to allow this, feel free to implement that.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

emax requested changes to this revision.Jul 16 2020, 6:48 PM
emax added a subscriber: emax.

the idea was to not mess with internal connection state tracking. l2cap module tracks connection state as well. raw sockets primary use case is hcidump. can you please explain why using l2cap socket is not good enough?

This revision now requires changes to proceed.Jul 16 2020, 6:48 PM
In D25690#568607, @emax wrote:

can you please explain why using l2cap socket is not good enough?

Right now I needed to generate packets manually for debugging, to find out what the kernel was doing wrong: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=248024

But more generally, some real userspace BLE libraries do speak raw HCI, e.g.:
https://github.com/noble/noble/blob/c4cd18a7a429bb832f6c4ca793be3faf9af884e9/lib/hci-socket/hci.js#L405

(and that one only works via libusb on FreeBSD right now due to these limitations, while on Linux it does use a raw HCI socket by default)

HCI is pretty attractive for userspace developers, as the applications do not have to worry about OS differences in state tracking, can reuse the code for embedded, etc.