Skip to content
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

Second discovery attempt fails with InProgress error #47

Closed
jmagnuson opened this issue Sep 2, 2022 · 2 comments
Closed

Second discovery attempt fails with InProgress error #47

jmagnuson opened this issue Sep 2, 2022 · 2 comments
Labels
external caused by bluetoothd or kernel

Comments

@jmagnuson
Copy link
Contributor

Device: Raspberry Pi zero 2w
OS: Yocto Linux
BlueZ: 5.64

Running the gatt_client example the first time succeeds as expected:

root@yocto:/tmp# ./gatt_client
Discovering on Bluetooth adapter hci0 with address B8:27:EB...

...

Discovered device B8:27:EB... with service UUIDs {00000002-e900-4e66-854c-cde416ae1332, 00000000-0000-0000-0000-0000feedc0de}
    Manufacturer data: Some(...)
    Device provides our service!
    Connecting...
    Connect error: Bluetooth operation failed: le-connection-abort-by-local
    Connected
    Enumerating services...
    Service UUID: 00001801-0000-1000-8000-00805f9b34fb
    Service data: [Primary(true), Uuid(00001801-0000-1000-8000-00805f9b34fb), Includes([])]
    Service UUID: 00001800-0000-1000-8000-00805f9b34fb

...

    Stopping notification IO
    Characteristic exercise completed
    Device disconnected

Stopping discovery

And I can see both StartDiscovery and StopDiscovery going over DBus:

method call time=1662105582.357526 sender=:1.71 -> destination=org.bluez serial=12 path=/org/bluez/hci0; interface=org.bluez.Adapter1; member=StartDiscovery
method return time=1662105582.361596 sender=:1.61 -> destination=:1.71 serial=189 reply_serial=12
signal time=1662105582.367611 sender=:1.61 -> destination=(null destination) serial=190 path=/org/bluez/hci0; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
   string "org.bluez.Adapter1"
   array [
      dict entry(
         string "Discovering"
         variant             boolean true
      )
   ]
   array [
   ]

...

method call time=1662105596.823707 sender=:1.71 -> destination=org.bluez serial=16 path=/org/bluez/hci0; interface=org.bluez.Adapter1; member=StopDiscovery
method return time=1662105596.828165 sender=:1.61 -> destination=:1.71 serial=222 reply_serial=16

However, subsequent attempts fail with org.bluez.Error.InProgress:

root@yocto:/tmp# ./gatt_client
Discovering on Bluetooth adapter hci0 with address B8:27:EB...

Error: Error { kind: InProgress, message: "Operation already in progress" }

root@yocto:/tmp# bluetoothctl show | grep Discovering
        Discovering: no
method call time=1662107942.325967 sender=:1.80 -> destination=org.bluez serial=10 path=/org/bluez/hci0; interface=org.bluez.Adapter1; member=StartDiscovery
error time=1662107942.330377 sender=:1.61 -> destination=:1.80 error_name=org.bluez.Error.InProgress reply_serial=10
   string "Operation already in progress"

I have been able to correct this by power cycling with bluetoothctl power on/off, but ideally there's something that can be done in bluer to avoid this.

I'm not an expert on the BlueZ DBus API, but it seems like it may have to do with the device connection being made after discovery, since I do not see this issue with the discover_devices example, which only does device discovery and no connection attempts.

@surban
Copy link
Collaborator

surban commented Oct 1, 2022

It is difficult to say what is causing it. You will probably have to look into bluetoothd why it is rejecting subsequent discovery requests. As a workaround you could reset the adapter's power using BlueR, but of course this is not a good solution.

I am tagging this as external, because according to your description this behavior is caused by the Bluetooth daemon.

@surban surban added the external caused by bluetoothd or kernel label Oct 1, 2022
otaviojr added a commit to otaviojr/bluer that referenced this issue May 10, 2023
# This is the 1st commit message:

BLE Passive Scanning

# This is the commit message #2:

monitor

# This is the commit message bluez#3:

monitor

# This is the commit message bluez#4:

monitor

# This is the commit message bluez#5:

monitor

# This is the commit message bluez#6:

monitor

# This is the commit message bluez#7:

monitor

# This is the commit message bluez#8:

monitor

# This is the commit message bluez#9:

monitor

# This is the commit message bluez#10:

monitor

# This is the commit message bluez#11:

monitor

# This is the commit message bluez#12:

monitor

# This is the commit message bluez#13:

monitor

# This is the commit message bluez#14:

monitor

# This is the commit message bluez#15:

monitor

# This is the commit message bluez#16:

monitor

# This is the commit message bluez#17:

monitor

# This is the commit message bluez#18:

monitor

# This is the commit message bluez#19:

monitor

# This is the commit message bluez#20:

monitor

# This is the commit message bluez#21:

monitor

# This is the commit message bluez#22:

monitor

# This is the commit message bluez#23:

monitor

# This is the commit message bluez#24:

monitor

# This is the commit message bluez#25:

monitor

# This is the commit message bluez#26:

monitor

# This is the commit message bluez#27:

monitor

# This is the commit message bluez#28:

monitor

# This is the commit message bluez#29:

monitor

# This is the commit message bluez#30:

monitor

# This is the commit message bluez#31:

monitor

# This is the commit message bluez#32:

monitor

# This is the commit message bluez#33:

monitor

# This is the commit message bluez#34:

monitor

# This is the commit message bluez#35:

monitor

# This is the commit message bluez#36:

monitor

# This is the commit message bluez#37:

monitor

# This is the commit message bluez#38:

monitor

# This is the commit message bluez#39:

monitor

# This is the commit message bluez#40:

monitor

# This is the commit message bluez#41:

monitor

# This is the commit message bluez#42:

monitor

# This is the commit message bluez#43:

monitor

# This is the commit message bluez#44:

monitor

# This is the commit message bluez#45:

monitor

# This is the commit message bluez#46:

monitor

# This is the commit message bluez#47:

monitor

# This is the commit message bluez#48:

monitor

# This is the commit message bluez#49:

monitor

# This is the commit message bluez#50:

monitor

# This is the commit message bluez#51:

monitor

# This is the commit message bluez#52:

monitor

# This is the commit message bluez#53:

monitor

# This is the commit message bluez#54:

monitor

# This is the commit message bluez#55:

monitor

# This is the commit message bluez#56:

monitor

# This is the commit message bluez#57:

monitor

# This is the commit message bluez#58:

monitor

# This is the commit message bluez#59:

monitor

# This is the commit message bluez#60:

monitor

# This is the commit message bluez#61:

monitor

# This is the commit message bluez#62:

monitor
@surban
Copy link
Collaborator

surban commented Feb 1, 2024

I am closing as completed for now, since there has been no response. Feel free to reopen if the issue still exists.

@surban surban closed this as completed Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external caused by bluetoothd or kernel
Projects
None yet
Development

No branches or pull requests

2 participants