Hi Travis, On Mon, Sep 12, 2016 at 8:49 PM, Travis Griggs <travisgriggs@xxxxxxxxx> wrote: > >> On Sep 12, 2016, at 8:52 AM, Travis Griggs <travisgriggs@xxxxxxxxx> wrote: >> >> It seems to me though, that maybe I’m going about this wrong. I don’t care about the device identity, or which devices are connected or not. What I really care about is if any device is connected to my app. And maybe I have this (kind of indirectly). My characteristic will get a StartNotify/StopNotify event on connect/disconnect edges. I can just use those to keep track of when I’m active or not. > > So I implemented this, and now notice that while I get the StartNotify events, I don’t seem to get the StopNotify events. > > In one case, I just shut down my iOS app (which had successfully triggered the StartNotify), while the device eventually showed up as disconnected, it never propagated a stop notify. > > In the next case, I used the LightBlueLE app which allows one to explicitly start listen and stop listen. Explicit stop listen commands on either didn’t show anything. > > Running btmon during a start listen/stop listen cycle produced the following output: > > # btmon > Bluetooth monitor ver 5.41 > = New Index: 5C:F3:70:68:C1:F9 (Primary,USB,hci0) [hci0] 0.149811 >> ACL Data RX: Handle 64 flags 0x02 dlen 9 [hci0] 2.681703 > ATT: Write Request (0x12) len 4 > Handle: 0x000d > Data: 0100 > < ACL Data TX: Handle 64 flags 0x00 dlen 5 [hci0] 2.693201 > ATT: Write Response (0x13) len 0 >> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 3.036696 > Num handles: 1 > Handle: 64 > Count: 1 >> ACL Data RX: Handle 64 flags 0x02 dlen 9 [hci0] 11.862591 > ATT: Write Request (0x12) len 4 > Handle: 0x000d > Data: 0000 > < ACL Data TX: Handle 64 flags 0x00 dlen 5 [hci0] 11.864894 > ATT: Write Response (0x13) len 0 >> HCI Event: Number of Completed Packets (0x13) plen 5 [hci0] 12.161577 > Num handles: 1 > Handle: 64 > Count: 1 > > > (also, having btmon running when connected caused btmon to buffer overflow and die)-- We did have some fixes recently to btmon, please check with upstream version. Regarding StopNotify we are currently using refcount to track when to disable the notifications so I suspect this is not working properly. Also we are not stopping the notification when there is no peer connected, so there is a couple of things to fix. -- Luiz Augusto von Dentz -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html