-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On Raspberry pi bleakscanner scanning not working :BleakDBusError[org.bluez.Error.InProgress] Operation already in progress . #1603
Comments
Can you please share a minimal reproducible test case? Likely, you are doing exactly what the error says and trying to start a scanner while another scanner is still running. |
@dlech it is a django project which i am trying to run on raspberry pi where i am trying to call a django view for scanning the ble devices but it crashes async def scan_devices(request):
async def scan_callback(device, advertising_data):
# Process advertising data here
print("Device:", device.address)
print("Advertisement Data:", advertising_data)
# You can extract specific data based on keys or parsing formats
devices = []
async with BleakScanner(scan_callback) as scanner:
await scanner.start() # Start scanning for devices
# Wait for a short duration (adjust as needed)
await asyncio.sleep(5)
await scanner.stop() # Stop scanning after the wait time
devices = scanner.discovered_devices # Get discovered devices
formatted_devices = [{
'uuid': str(device.address),
'name': device.name if device.name else 'Unknown',
'adv_data': "advertising_data" # Include advertising data in the response
} for device in devices]
return JsonResponse({'devices': formatted_devices}) |
If two requests can come in within the 5 second scan time, this could cause the problem. You could protect against concurrent scanning by using an |
When using BlueZ, running |
@dlech connecting to multiple device is working fine but when it comes to get data from characteristics from different connected devices it gives data from a single device only . |
Can you please start a new issue with a minimal reproducible test case and Bluetooth packet capture logs and Bleak debug logs showing the issue? |
We're having the same problem on bleak-0.21.1 and 0.22.2. It can work a few times before we get the error. The process exits before the next run starts so there shouldn't be any stray scanners laying around. btmon:
|
Updating the firmware using |
Description
when i tried to scan the ble devices it gives me this error while running code on Raspberry pi
The text was updated successfully, but these errors were encountered: