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

Windows Support #6

Open
kariudo opened this issue Dec 31, 2021 · 4 comments · May be fixed by #7
Open

Windows Support #6

kariudo opened this issue Dec 31, 2021 · 4 comments · May be fixed by #7
Assignees
Labels
bug Something isn't working

Comments

@kariudo
Copy link
Owner

kariudo commented Dec 31, 2021

Currently with the bleak rewrite, windows should be supported.

There is however an error at the unlock response (notify likely failing to get response):

2021-12-31 14:39:33 INFO     Likely found a onewheel, using ***
2021-12-31 14:39:56 INFO     Services resolved for BleakClientWinRT (***)
2021-12-31 14:40:28 ERROR    Error: timeout reached waiting for encryption key response.
2021-12-31 14:40:28 ERROR    Connection error: Timeout reached waiting for encryption key response
2021-12-31 14:40:28 INFO     Connected to board: None
2021-12-31 14:40:28 WARNING  Unable to read valid data, retrying in 3 sec...
2021-12-31 14:40:31 WARNING  Unable to read valid data, retrying in 3 sec...
2021-12-31 14:40:34 WARNING  Unable to read valid data, retrying in 3 sec...
2021-12-31 14:40:37 WARNING  Unable to read valid data, retrying in 3 sec...
2021-12-31 14:40:41 WARNING  Unable to read valid data, retrying in 3 sec...
2021-12-31 14:40:44 ERROR    Unable able to read valid data, after 5 failed attempts. Exiting.
@kariudo kariudo self-assigned this Dec 31, 2021
@kariudo kariudo added the bug Something isn't working label Dec 31, 2021
@kariudo kariudo linked a pull request Dec 31, 2021 that will close this issue
@kariudo
Copy link
Owner Author

kariudo commented Dec 31, 2021

Additional errors include:

2021-12-31 14:45:12 INFO     Likely found a onewheel, using ***
2021-12-31 14:45:15 ERROR    Connection error: [WinError -2147483629] The object has been closed
2021-12-31 14:45:15 WARNING  Cannot read data, not connected

@kariudo
Copy link
Owner Author

kariudo commented Dec 31, 2021

Full debug output after detecting the board with scan:

2021-12-31 14:50:41 DEBUG    Connecting to BLE device @ ***
2021-12-31 14:50:42 DEBUG    _ConnectionStatusChanged_Handler: 1
2021-12-31 14:50:42 DEBUG    Get Services...
2021-12-31 14:50:43 DEBUG    _ConnectionStatusChanged_Handler: 0
2021-12-31 14:50:43 ERROR    Connection error: Could not get GATT services: Unreachable
2021-12-31 14:50:43 DEBUG    _ConnectionStatusChanged_Handler: 1
2021-12-31 14:50:43 INFO     Connected to board: None
2021-12-31 14:50:43 DEBUG    _ConnectionStatusChanged_Handler: 0
2021-12-31 14:50:43 WARNING  Not connected, exiting loop
2021-12-31 14:50:43 DEBUG    _ConnectionStatusChanged_Handler: 1
2021-12-31 14:50:43 DEBUG    Disconnecting from ***
2021-12-31 14:50:43 DEBUG    _ConnectionStatusChanged_Handler: 0
2021-12-31 14:50:43 DEBUG    Disconnecting from BLE device...
2021-12-31 14:50:43 DEBUG    Disconnected

@kariudo
Copy link
Owner Author

kariudo commented Dec 31, 2021

I think the problem is coming from this bit in bleak

https://github.com/hbldh/bleak/blob/156e8af24a4ec13540586fc32a13f99e75b2abb9/bleak/backends/winrt/client.py#L262

            # Windows does not support explicitly connecting to a device.
            # Instead it has the concept of a GATT session that is owned
            # by the calling program.
            self._session.maintain_connection = True
            # This keeps the device connected until we set maintain_connection = False.

            # wait for the session to become active
            await asyncio.wait_for(event.wait(), timeout=timeout)
        except BaseException:
            handle_disconnect()
            raise
        finally:
            self._session_active_events.remove(event)

        # Obtain services, which also leads to connection being established.
        await self.get_services()

@kariudo
Copy link
Owner Author

kariudo commented Dec 31, 2021

Since this looks like a bleak issue and I am more interested in linux support for my usage currently, this is not a priority unless someone else has a fix or input short of me making changes to bleak to work around it.

@kariudo kariudo added wontfix This will not be worked on and removed wontfix This will not be worked on labels Dec 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant