delphiki / AirStatus

Check AirPods battery levels on Linux
GNU General Public License v3.0
131 stars 23 forks source link

Operation already in progress #11

Closed TheSn0wDev closed 2 years ago

TheSn0wDev commented 2 years ago

I can't execute main.py, I get this error:

/home/snow/scripts/AirStatus/main.py:59: DeprecationWarning: There is no current event loop
  loop = get_event_loop()
Traceback (most recent call last):
  File "/home/snow/scripts/AirStatus/main.py", line 147, in <module>
    run()
  File "/home/snow/scripts/AirStatus/main.py", line 132, in run
    data = get_data()
  File "/home/snow/scripts/AirStatus/main.py", line 68, in get_data
    raw = get_data_hex()
  File "/home/snow/scripts/AirStatus/main.py", line 60, in get_data_hex
    a = loop.run_until_complete(get_device())
  File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/home/snow/scripts/AirStatus/main.py", line 43, in get_device
    devices = await discover()
  File "/home/snow/.local/lib/python3.10/site-packages/bleak/backends/scanner.py", line 99, in discover
    async with cls(**kwargs) as scanner:
  File "/home/snow/.local/lib/python3.10/site-packages/bleak/backends/scanner.py", line 79, in __aenter__
    await self.start()
  File "/home/snow/.local/lib/python3.10/site-packages/bleak/backends/bluezdbus/scanner.py", line 156, in start
    assert_reply(reply)
  File "/home/snow/.local/lib/python3.10/site-packages/bleak/backends/bluezdbus/utils.py", line 23, in assert_reply
    raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.InProgress] Operation already in progress

I've tried to search a way to solve this but nothing works. I'm using PopOS 22.04, Python 3.10.4, Bleak 0.13.0.

TheSn0wDev commented 2 years ago

I finally found the solution. You need to edit the file sudo nano /etc/bluetooth/main.conf and set ControllerMode = dual