Jakeler / ble-serial

"RFCOMM for BLE" a UART over Bluetooth low energy (4+) bridge for Linux, Mac and Windows
https://blog.ja-ke.tech/tags/#bluetooth
MIT License
264 stars 37 forks source link

WSL/Cygwin: Bluepy won't install, sudo: ble-scan: command not found #15

Closed JBrakefield closed 3 years ago

JBrakefield commented 3 years ago

I've tried everything to get this running on my Ubuntu (20.04) WSL (I also tried getting it to run in Cygwin with no luck). I had a lot of trouble installing that bluepy library specifically, and when I get to the step "Find bluepy-helper" it is simply not there. My ~/.local/lib/python3.8/site-packages has no folder at all for bluepy, even after it finally installed with no errors.

I tried testing ble-scan anyway, but it says the command is not found when using sudo.

Jakeler commented 3 years ago

Did you run pip install as normal user or root? It might be in the system site packages instead, so /usr/lib/python3.8/site-packages. You can check the paths with python -m site. Also I would recommend python virtualenv to get a isolated environment.

That being said, even after fixing that it will most likely not work, because WSL does not support direct hardware access or bluetooth in general: https://github.com/microsoft/WSL/issues/242 Please try it with a native Linux installation or live CD/USB stick. Windows is currently not supported, this might change in the future after the migration to another bluetooth backend is done (ble-serial version 2.0+).

JBrakefield commented 3 years ago

Thanks for the response. You are probably correct that I can't use this on my Windows machine yet. I'm also trying to learn Bleak in hopes that library works for me.

Jakeler commented 3 years ago

I am closing this as WSL is not supported, but I am migrating to Bleak in #17 and just merged Windows support #18 in. Checkout the bleak-backend branch and please let me know if this works for you. It requires native python 3.8 and com0com. Data is read/written to \\\\.\\BLE. You can use the included ble-setup script to correctly create a BLE<>COM9 port pair.