Hi,

        About a month ago I posted on the Subsurface group 
(https://groups.google.com/g/subsurface-divelog/c/35cwOUrPxw4) about problems 
connecting to my Scubapro G2 from an Apple Silicon (M2) MacBook Pro running 
Sonoma.   It works perfectly on my old Intel Macbook Pro running Catalina.    
Several people said they had similar problems, but no one said anything about a 
working connection.    I also contacted ScubaPro and asked if they had it 
working with LogTraks and they weren’t much help.

        Both BT dev and QT are new to me, and I’m not a Mac developer, but I 
was very curious as to why Subsurface sees my G2 on my old Intel Mac and not my 
new M2. (yes, I know about curiosity and the cat...)   I found the QT 
lowenergyscanner example and sure enough, it shows the G2 when I run it on the 
M2.   I compared it to  btdeviceselectiondialog.cpp and the difference seems to 
be the call to QBluetoothDeviceDiscoveryAgent::start().   Subsurface uses 
start() while lowenergyscanner uses 
start(QBluetoothDeviceDiscoveryAgent::LowEnergyMethod) and after changing it in 
Subsurface, my G2 shows up when scanning.   I'm really not sure of the 
implications of this find,  but I'm pretty sure something bad would happen if 
this change was simply made.   Maybe it could be tied to the "force LE' 
checkbox?

        Continuing down this path, I made the same change in btdiscovery.cpp.   
 Again, this is not a suggested code change, but simply data gathering at this 
point.    With that change, I get as far as the point where INFO: 
qt_ble_open({...}) is logged and then it crashes.   I should mention that the 
binary was built on my old Intel Mac and then copied over to the M2 (more about 
that later).    Oddly enough (to me at least), the crash reporter was not 
invoked.   I ran it using lldb and the output is:

INFO: connected to the controller for device 
{a8f5364d-eabf-b24a-2f6c-79ccb49b7424}
Process 19648 stopped
* thread #23, queue = 'com.apple.bluetooth.iobluetooth.coordinatorQueue', stop 
reason = EXC_BAD_ACCESS (code=1, address=0x400000000000012)
    frame #0: 0x000000010aa1bf51 QtBluetooth`-[OSXBTConnectionMonitor 
connectionNotification:withDevice:] + 161
QtBluetooth`-[OSXBTConnectionMonitor connectionNotification:withDevice:]:
->  0x10aa1bf51 <+161>: callq  *0x10(%rax)
    0x10aa1bf54 <+164>: leaq   -0x20(%rbp), %rdi
    0x10aa1bf58 <+168>: callq  0x10a9fbab0               ; 
QBluetoothAddress::~QBluetoothAddress()
    0x10aa1bf5d <+173>: leaq   -0x28(%rbp), %rdi

It’s probably worth mentioning at this point that it was built using a brew 
installed QT 5.15.7.    Hoping to get more, useful, information I tried 
building Subsurface on the M2.   First I tried using an offline installer 
version of QT Qt5.12.12 (I couldn’t find a installer for 5.15).   This wouldn’t 
build so I installed brew QT 5.15.13_1 and was able to build.    When I tried 
running it I get:

        Exception Type:        EXC_BAD_ACCESS (SIGKILL (Code Signature Invalid))
        Exception Codes:       UNKNOWN_0x32 at 0x0000000102f2c000
        Exception Codes:       0x0000000000000032, 0x0000000102f2c000

but, I found that it does run under lldb.   With lldb it actually connected to 
the G2, but it fails with:

INFO: Found service {fdcdeaaa-295d-470e-bf15-04217b7aa0a0} Unknown Service
INFO:    c: {a188b7dd-debb-449a-852d-c243d46b4b1a}
INFO:    c: {aa0c68f0-ea9c-493d-8112-62879e72af68}
INFO:         d: {00002902-0000-1000-8000-00805f9b34fb}
INFO: Using service {fdcdeaaa-295d-470e-bf15-04217b7aa0a0} as preferred service
INFO:  .. enabling notifications
INFO: Using read characteristic {aa0c68f0-ea9c-493d-8112-62879e72af68}
INFO: now writing "0x0100" to the descriptor 
{00002902-0000-1000-8000-00805f9b34fb}
INFO: Bluetooth: Failed to enable notifications for characteristic 
{aa0c68f0-ea9c-493d-8112-62879e72af68}
ERROR: Bluetooth: Failed to enable notifications.

At this point I’m well and truly in over my head...

        Questions:

        1. Is a can of worms that should be opened?
        2. Is there anything obviouly wrong with using a brew installed version 
of QT?
        3. Is trying to build and debug on the M2 a waste of time given that 
the distribution version of Subsurface is for the Intel architecture?

thanks for any suggestions,
jim
_______________________________________________
subsurface mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to