v01d commented on issue #1639: URL: https://github.com/apache/incubator-nuttx/issues/1639#issuecomment-680408893
@btashton I'm trying to understand how the code would look like once this new socket interface is added and, specifically, how would the GATT layer use it. For example, to read a GATT characteristic the code path right now is: 1. SIOCBTGATTRD ioctl on the socket 2. bt_gatt_read 3. gatt_send 4. bt_att_send 5. bt_l2cap_send 6. bt_conn_send (pushes to HCI tx queue) 7. hci_tx_kthread (pops from HCI tx queue) calls into bt driver send callback This last send ends up in the Link Layer I created. What I'm missing is how the existing L2CAP socket and the new HCI socket would be used here, since for this code path I don't see any socket used at all, it all starts on an ioctl and uses direct calls to all internal APIs. If the HCI socket where to sit between 6 and 7 I understand you would gain access to, for example, enabling advertising from userspace. But to send ATT/GATT you would use the L2CAP socket. Is this correct? What is also confusing is that the `btsak` application does not really use the L2CAP socket for more than ioctl calls. I'm guessing that it should already be possible to send L2CAP packets from userspace in NuttX, as I see on `bt_netdev,c` another call to bt_l2cap_send which I would think it will be called when one write()s the socket. Is that correct? In that case, besides adding the HCI socket, we also should make the ATT/GATT code into a library that speaks to the L2CAP socket via read/write. Am I understanding this correctly? I could work on that if so, unless you had plans for it or you have a clearer idea on how to do so. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
