Open r-bt opened 1 year ago
any chance you can compile in debug mode and send a stack trace?
Sure, I'm not sure if this is right (I don't have too much experience with c++) but I recompiled libblepp with cmake -DWITH_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Debug ..
and then ran sudo gdb --args ./examples/blelogger f7:aa:cd:dc:21:75
and ran bt
once it crashed which gave:
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0xf7c37364 in __GI_abort () at abort.c:79
#2 0xf7e20f88 in __gnu_cxx::__verbose_terminate_handler() () from /lib/arm-linux-gnueabihf/libstdc++.so.6
#3 0xf7e1eacc in ?? () from /lib/arm-linux-gnueabihf/libstdc++.so.6
#4 0xf7e1eb58 in std::terminate() () from /lib/arm-linux-gnueabihf/libstdc++.so.6
#5 0xf7e1ef28 in __cxa_throw () from /lib/arm-linux-gnueabihf/libstdc++.so.6
#6 0xf7f55f10 in BLEPP::BLEGATTStateMachine::read_and_process_next (this=0xfffef344) at /home/rbeattie/Documents/libblepp/src/blestatemachine.cc:519
#7 0x00011164 in main (argc=<optimized out>, argv=<optimized out>) at examples/blelogger.cc:89
It looks quite short so I might have missed a step to get the proper stacktrace.
From my own debugging I've found that it gets to
int ret = log_fd(::connect(sock, (sockaddr *)&addr, sizeof(addr)));
where it hangs until the function times out. Ret is then equal to -1
indicating an error while errorno
is set to EINPROGRESS
indicating the connection is still happening. In blelogger
it then immediately calls read_and_process_next()
which throws if the state is set to Connecting
. I tried modifying this so that it wouldn't read while the state was still connecting with
for (;;)
if (!gatt.wait_on_write())
{
gatt.read_and_process_next();
}
but that just hangs. I'm not sure is there another function I should be calling that checks if state
can be changed from Connecting
to Idle
@edrosten not sure if it's relevant but while I was debugging I found https://stackoverflow.com/questions/72451087/how-to-connect-ble-devices-using-linux-bluetooth-c-library which seems to imply that BlueZ's move to DBUS can get in the way of connecting to devices through the old hci_xxx
methods
@edrosten Just as a check I downgraded to bluez 5.48
and 5.42
, recompiled libblepp but the issue was still present
I've made and installed this library and am attempting to run the
blelogger
file with:I've also modified the
blelogger
file to change the debug level toWhen I try run
blelogger
it gives the followingI'm getting the address from
lescan
so I'm sure that the adapter can see it