You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Demos (python sdk, etc) - Using WirelessGoPro / python sdk
Describe the bug
I can successfully pair my gopro via ble and then connect with the WirelessGoPro (connecting and disconnecting successfully). However, if the battery is removed / changes or the camera sits idle for long enough after powering off then I cannot reconnect via ble without manually repairing.
Repro
gp0 = WirelessGoPro(
target=target0,
enable_wifi=False,
maintain_state=False,
)
await gp0.open()
Error:
Connection failed during establishment..
[org.bluez.Error.Failed] Operation already in progress
Failed to connect: ConnectFailed('BLE connection failed to establish after 1 retries with timeout 1'). Retrying #1
Failed to connect: ConnectFailed('BLE connection failed to establish after 1 retries with timeout 1'). Retrying #2
Connection failed during establishment..
[org.bluez.Error.Failed] Operation already in progress
Error while opening: BLE connection failed to establish after 5 retries with timeout 15
Failed to connect: ConnectFailed('BLE connection failed to establish after 1 retries with timeout 1'). Retrying #3
Failed to connect: ConnectFailed('BLE connection failed to establish after 1 retries with timeout 1'). Retrying #4
---------------------------------------------------------------------------
BleakDBusError Traceback (most recent call last)
File [~/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/bleak/__init__.py:615](http://localhost:9091/home/areiner/miniforge3/envs//lib/python3.10/site-packages/bleak/__init__.py#line=614), in BleakClient.connect(self, **kwargs)
606 """Connect to the specified GATT server.
607
608 Args:
(...)
613
614 """
--> 615 return await self._backend.connect(**kwargs)
File [~/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py:254](http://localhost:9091/home/areiner/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/bleak/backends/bluezdbus/client.py#line=253), in BleakClientBlueZDBus.connect(self, dangerous_use_bleak_cache, **kwargs)
249 raise BleakDeviceNotFoundError(
250 self.address,
251 f"Device with address {self.address} was not found. It may have been removed from BlueZ when scanning stopped.",
252 )
--> 254 assert_reply(reply)
256 self._is_connected = True
File [~/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/bleak/backends/bluezdbus/utils.py:20](http://localhost:9091/home/areiner/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/bleak/backends/bluezdbus/utils.py#line=19), in assert_reply(reply)
19 if reply.message_type == MessageType.ERROR:
---> 20 raise BleakDBusError(reply.error_name, reply.body)
21 assert reply.message_type == MessageType.METHOD_RETURN
BleakDBusError: [org.bluez.Error.Failed] Operation already in progress
The above exception was the direct cause of the following exception:
ConnectFailed Traceback (most recent call last)
File [~/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/open_gopro/ble/client.py:110](http://localhost:9091/home/areiner/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/open_gopro/ble/client.py#line=109), in BleClient.open(self, timeout, retries)
109 try:
--> 110 self._handle = await self._controller.connect(self._disconnected_cb, self._device, timeout=timeout)
111 break
File [~/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/open_gopro/ble/adapters/bleak_wrapper.py:249](http://localhost:9091/home/areiner/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/open_gopro/ble/adapters/bleak_wrapper.py#line=248), in BleakWrapperController.connect(self, disconnect_cb, device, timeout)
248 logger.warning(exception)
--> 249 raise ConnectFailed("BLE", 1, 1) from exception
250 return client
ConnectFailed: BLE connection failed to establish after 1 retries with timeout 1
The above exception was the direct cause of the following exception:
ConnectFailed Traceback (most recent call last)
File [~/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/open_gopro/gopro_wireless.py:294](http://localhost:9091/home/areiner/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/open_gopro/gopro_wireless.py#line=293), in WirelessGoPro.open(self, timeout, retries)
293 try:
--> 294 await self._open_ble(timeout, retries)
296 # Set current dst-aware time. Don't assert on success since some old cameras don't support this command.
File [~/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/open_gopro/gopro_wireless.py:583](http://localhost:9091/home/areiner/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/open_gopro/gopro_wireless.py#line=582), in WirelessGoPro._open_ble(self, timeout, retries)
582 # Establish connection, pair, etc.
--> 583 await self._ble.open(timeout, retries)
584 # Start state maintenance
File [~/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/open_gopro/ble/client.py:115](http://localhost:9091/home/areiner/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/open_gopro/ble/client.py#line=114), in BleClient.open(self, timeout, retries)
114 if retry == retries - 1:
--> 115 raise ConnectFailed("BLE", timeout, retries) from e
117 assert self._handle is not None
ConnectFailed: BLE connection failed to establish after 5 retries with timeout 15
During handling of the above exception, another exception occurred:
GoProNotOpened Traceback (most recent call last)
Cell In[13], line 1
----> 1 r = await gp0.open()
File [~/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/open_gopro/gopro_wireless.py:318](http://localhost:9091/home/areiner/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/open_gopro/gopro_wireless.py#line=317), in WirelessGoPro.open(self, timeout, retries)
316 except Exception as e:
317 logger.error(f"Error while opening: {e}")
--> 318 await self.close()
319 raise e
File [~/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/open_gopro/gopro_wireless.py:329](http://localhost:9091/home/areiner/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/open_gopro/gopro_wireless.py#line=328), in WirelessGoPro.close(self)
321 async def close(self) -> None:
322 """Safely stop the GoPro instance.
323
324 This will disconnect BLE and WiFI if applicable.
(...)
327 prevent reconnection issues because the OS has never disconnected from the previous session.
328 """
--> 329 await self._close_wifi()
330 await self._close_ble()
331 self._open = False
File [~/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/open_gopro/gopro_wireless.py:805](http://localhost:9091/home/areiner/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/open_gopro/gopro_wireless.py#line=804), in WirelessGoPro._close_wifi(self)
803 async def _close_wifi(self) -> None:
804 """Terminate the Wifi connection."""
--> 805 assert (await self.ble_command.enable_wifi_ap(enable=False)).ok
806 if hasattr(self, "_wifi"): # Corner case where instantiation fails before superclass is initialized
807 self._wifi.close()
File [~/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/open_gopro/api/builders.py:275](http://localhost:9091/home/areiner/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/open_gopro/api/builders.py#line=274), in ble_write_command.<locals>.wrapper(wrapped, instance, _, kwargs)
273 @wrapt.decorator
274 async def wrapper(wrapped: Callable, instance: BleMessages, _: Any, kwargs: Any) -> GoProResp:
--> 275 return await instance._communicator._send_ble_message(message, rules, **(await wrapped(**kwargs) or kwargs))
File [~/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/open_gopro/gopro_base.py:89](http://localhost:9091/home/areiner/miniforge3/envs/zed_dev2/lib/python3.10/site-packages/open_gopro/gopro_base.py#line=88), in ensure_opened.<locals>.wrapper(wrapped, instance, args, kwargs)
86 @wrapt.decorator
87 def wrapper(wrapped: Callable, instance: GoProBase, args: Any, kwargs: Any) -> Callable:
88 if GoProMessageInterface.BLE in interface and not instance.is_ble_connected:
---> 89 raise GpException.GoProNotOpened("BLE not connected")
90 if GoProMessageInterface.HTTP in interface and not instance.is_http_connected:
91 raise GpException.GoProNotOpened("HTTP interface not connected")
GoProNotOpened: GoPro is not correctly open: BLE not connected
Screenshots
If applicable, add screenshots to help explain your problem.
Component
What is the bug in?
Describe the bug
I can successfully pair my gopro via ble and then connect with the WirelessGoPro (connecting and disconnecting successfully). However, if the battery is removed / changes or the camera sits idle for long enough after powering off then I cannot reconnect via ble without manually repairing.
Repro
Screenshots
If applicable, add screenshots to help explain your problem.
Hardware
Additional Info
Here are some additional logs via btmon:
The text was updated successfully, but these errors were encountered: