Skip to content

macOS 12 Arm M1 MAX script aborts #768

@pawelm87

Description

@pawelm87
  • bleak version: 0.12.1
  • Python version: 3.9
  • Operating System: macOS 12 Arm M1 MAX and macOS (probably version 12) standard
  • BlueZ version (bluetoothctl -v) in case of Linux: -

Description

I would like to run the program on the new architecture - macOS 12 ARM M1, unfortunately the program crashes. It works correctly on WIN10 and macOS Intel.

What I Did

In order to locate the error I try to run an example from the repository - disconnect_callback.py. In the example I changed only the debug level (line 7):

import asyncio
from bleak import BleakScanner
from bleak.backends.device import BLEDevice
from bleak.backends.scanner import AdvertisementData
​
import logging
logging.basicConfig(format='[%(name)s - %(levelname)s] %(message)s', level=logging.DEBUG)
​
​
def simple_callback(device: BLEDevice, advertisement_data: AdvertisementData):
    print(device.address, "RSSI:", device.rssi, advertisement_data)
​
​
async def run():
    scanner = BleakScanner()
    scanner.register_detection_callback(simple_callback)
​
    while True:
        await scanner.start()
        await asyncio.sleep(5.0)
        await scanner.stop()
​
​
loop = asyncio.get_event_loop()
loop.run_until_complete(run())

Running the example on macOS ARM M1 (standard, not MAX) then I get the message:

username@user-name-osx Downloads % python3 /Users/username/Downloads/detect_callback.py
[asyncio - DEBUG] Using selector: KqueueSelector
[bleak.backends.corebluetooth.CentralManagerDelegate - DEBUG] centralManagerDidUpdateState_
[bleak.backends.corebluetooth.CentralManagerDelegate - DEBUG] Bluetooth powered on
[bleak.backends.corebluetooth.CentralManagerDelegate - DEBUG] 'isScanning' changed
[bleak.backends.corebluetooth.CentralManagerDelegate - DEBUG] 'isScanning' changed
[bleak.backends.corebluetooth.CentralManagerDelegate - DEBUG] 'isScanning' changed
[bleak.backends.corebluetooth.CentralManagerDelegate - DEBUG] 'isScanning' changed
[bleak.backends.corebluetooth.CentralManagerDelegate - DEBUG] 'isScanning' changed
[bleak.backends.corebluetooth.CentralManagerDelegate - DEBUG] 'isScanning' changed
[bleak.backends.corebluetooth.CentralManagerDelegate - DEBUG] 'isScanning' changed
[bleak.backends.corebluetooth.CentralManagerDelegate - DEBUG] 'isScanning' changed
...

The program supposedly works, but it does not find any device, even though there are a lot of devices with BLE around. I have seen similar problems that are solved by migrating to the latest version of the library, tomorrow i will update library, but...

I am now trying to run the same example on macOS 12 ARM M1 MAX:

image

In this case, the program crashes immediately. You can see that the program starts because the DEBUG log is displayed, but after a while it is aborted without any message. And it's strange, different behavior than before - I couldn't find a similar issues on the forum.

I found on the forum that macOS 12 needs a library update - fix in version 0.14.0 and higher but script running on MAX version is aborted immediately ?

If I am duplicating the problem I apologize but I have limited access to these two machines for testing so I would like to make sure if it is the fault of the library version possibly try something new. Tomorrow I will update the library to the latest version and see if it worked.

Metadata

Metadata

Assignees

No one assigned

    Labels

    3rd party issueThe issue is with the Bluetooth stack, the BLE device, or other 3rd party code not with Bleak itselfBackend: Core BluetoothIssues and PRs relating to the Core Bluetooth backend

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions