Giter VIP home page Giter VIP logo

Comments (5)

kawasaki avatar kawasaki commented on June 13, 2024

@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.

kawasaki avatar kawasaki commented on June 13, 2024

@advancingu

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.

advancingu avatar advancingu commented on June 13, 2024

@kawasaki Thank you for your answers. I finally got around to testing your suggestions.

It appears I was suffering from two issues:

  1. The failure to scan. I was able to resolve this by bringing the hci0 interface down and up again as you pointed out.
  2. 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 using bluetoothctl and only then start scratch_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.

advancingu avatar advancingu commented on June 13, 2024

Tested on a second PC. Worked fine right away using the process above.

from pyscrlink.

kawasaki avatar kawasaki commented on June 13, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.