On Mon, Aug 24, 2020 at 12:34 PM Gregory Nutt <spudan...@gmail.com> wrote:
>
> Some of the things you have speculated about would be contrary to these
> principles.  The basic wireless rules are:
>
> 1. Network sockets are used to communicate with complex wireless
> networks (like bluetooth)
>
> 2. Character drivers should be avoided
>
> 3. Network interfaces must/should be compatible with corresponding Linux
> interfaces.
>
> I think if there are features that you want to implement, you might
> first want to look at how those features are implemented in Linux.  That
> would be the correct way to proceed.

I fully agree with this.  AF_BLUETOOTH is already in place, but it
only implements "BTPROTO_L2CAP" all of the GATT and
advertising/scanning related functionality is implemented over
"BTPROTO_HCI"


fd = socket(PF_BLUETOOTH, SOCK_RAW | SOCK_CLOEXEC | SOCK_NONBLOCK, BTPROTO_HCI);
addr.hci_family = AF_BLUETOOTH;
addr.hci_dev = dev_id;
addr.hci_channel = HCI_CHANNEL_RAW;

HCI event filters are then controlled via socket options with SOL_HCI
and HCI_FILTER

Most of these are defined in the NuttX bluetooth stack, but they have
not been implemented.
If you bind using HCI_CHANNEL_RAW and not the HCI_CHANNEL_USER the
Linux kernel will take care of some of the GAP related actions, there
is also a management socket that is exposed as well.

I see that there is an ioctl interface for the bluetooth network
driver, but I don't think this is really a good idea.  GATT is really
something that should be handled in userspace.

I finally have a few weeks off, so I can see about making some HCI
socket progress, going to take a bit to get hardware setup for it
though.

--Brennan

Reply via email to