Comments (5)
@advancingu Thank you for the detailed report. In the console output, the line below is weird.
BLE iface #0: Failed to execute management command 'scanend' (code: 13, error: Invalid Parameters)
This message comes from bluepy layer. So something wrong happens in that layer. I may need to ask you to get some logs from that layer, but I need some time to investigate how to do that.
In the mean time, please try two actions if you have time to afford. First one is updating all Ubuntu packages to the latest version. In the past, some troubles were avoided with this action. Second one is uninstall bluepy and install it again. It may fix something wrong in that layer.
from pyscrlink.
I found this error is discussed in bluepy GitHub issue 150. It is said that following command avoids the error on some systems.
$ sudo hciconfig hci0 down && sudo hciconfig hci0 up
Please try the command above on your system before starting pyscrlink.
In case the command above does not work for you, please check bleutooth service status.
$ sudo systemctl status bluetooth.service
I found that when that service is stopped, similar error message is reported on my system ("Failed to execute management command 'scanend' (code: 11, error: Rejected)"). So I want to ensure that the service is working on your system.
from pyscrlink.
@kawasaki Thank you for your answers. I finally got around to testing your suggestions.
It appears I was suffering from two issues:
- The failure to scan. I was able to resolve this by bringing the hci0 interface down and up again as you pointed out.
- The failure to initiate the BLE connection. It turns out that I must not establish a connection to the Lego Move Hub before starting
scratch_link
. If the Hub is already connected, it does not get found during scanning. So instead, I did pair and trust the Hub usingbluetoothctl
and only then startscratch_link
. This way the connection got established automatically when searching for the Hub in Scratch.
bluepy
apparently was fine and I didn't reinstall it.
For documentation, the commands in bluetoothctl
were as follows:
pairable on
agent KeyboardOnly
scan on
# turn on Hub
# look for Lego Hub device ID ($DEVICE_ID below)
pair $DEVICE_ID
# enter number `0` as PIN
scan off
trust $DEVICE_ID
disconnect $DEVICE_ID
I will try this out on another PC soon. Hopefully it will work immediately then.
from pyscrlink.
Tested on a second PC. Worked fine right away using the process above.
from pyscrlink.
@advancingu Thank you for sharing your findings :) This github issue itself can be a good reference. I'll think about how to document this in README, or refer this github issue from README.
from pyscrlink.
Related Issues (20)
- Avoid sudo for scratcy_link.py HOT 7
- Multiple users support HOT 3
- Lego WeDo Support HOT 3
- Delay between sending command from Scratch and forwarding to the device HOT 3
- bluetooth connection to lego boost HOT 16
- Try to connect to LEGO HUB HOT 16
- Bluetooh connection Raspberry Pi 4 with Lego WeDo 2.0 HOT 13
- Second device disconnected HOT 10
- scratch_link procudes endless loop HOT 6
- BLE session disconnected with toio on playmat HOT 3
- failed to connect with latest master HOT 8
- Support for Intelino Smart Train HOT 21
- Unicode decode error HOT 1
- BUG Method always returns None and awaits a miracle? ;) HOT 3
- LEGO boost HOT 8
- ERROR:ssl_client_socket_impl.cc handshake failed on Ubuntu 22.04 HOT 10
- PR_END_OF_FILE_ERROR - Secure Connection Failed HOT 6
- Lego WeDo: Unable to reestablish connection HOT 3
- CPU ressources HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyscrlink.