Giter Club home page Giter Club logo

Comments (8)

undera avatar undera commented on July 18, 2024

This looks similar to peplin/pygatt#196

What exactly do you have in your demo.py file?

from pylgbst.

asbayer avatar asbayer commented on July 18, 2024

I just copied your demo.py file
https://github.com/undera/pylgbst/blob/master/examples/demo.py

After the first trail I changed the line:
connection = get_connection_auto()
to
connection = get_connection_bluegiga(hub_mac='00:16:53:A5:5A:0B')
Both scenarios prduce the output shown above.
I'm using a Kali-Linux system.

from pylgbst.

undera avatar undera commented on July 18, 2024

That demo file has no job to do, because it has demo_all() commented out. Try uncommenting it and run again.

from pylgbst.

asbayer avatar asbayer commented on July 18, 2024

This I already did. But nothing changed. This i my current code at the bottom of your demo.py file which produces the message:

if __name__ == '__main__':
    logging.basicConfig(level=logging.INFO)

    try:
        connection = DebugServerConnection()
    except BaseException:
        logging.debug("Failed to use debug server: %s", traceback.format_exc())
        connection = get_connection_bluegiga(hub_mac='00:16:53:A5:5A:0B')
        #connection =  get_connection_auto()

    try:
        hub = MoveHub(connection)
        sleep(1)
        demo_all(hub)
    finally:
        connection.disconnect()

from pylgbst.

undera avatar undera commented on July 18, 2024

Ok, I see. Can you try with another backend BLE lib?

from pylgbst.

asbayer avatar asbayer commented on July 18, 2024

This is the output when I try get_connection_gattool

/usr/bin/python2.7 /root/PycharmProjects/mypy/lego/demo.py
Can't get device info: No such device
INFO:pygatt.backends.gatttool.gatttool:Running...
INFO:comms-pygatt:Discovering devices...
INFO:pygatt.backends.gatttool.gatttool:Starting BLE scan
ERROR:pygatt.backends.gatttool.gatttool:No BLE adapter found
Traceback (most recent call last):
  File "/root/PycharmProjects/mypy/lego/demo.py", line 193, in <module>
    connection = get_connection_gattool(hub_mac='00:16:53:A5:5A:0B')
  File "/usr/local/lib/python2.7/dist-packages/pylgbst/__init__.py", line 18, in get_connection_gattool
    return GattoolConnection(controller).connect(hub_mac)
  File "/usr/local/lib/python2.7/dist-packages/pylgbst/comms/cpygatt.py", line 31, in connect
    devices = adapter.scan(1)
  File "/usr/local/lib/python2.7/dist-packages/pygatt/backends/gatttool/gatttool.py", line 326, in scan
    raise BLEError(message)
pygatt.exceptions.BLEError: No BLE adapter found

and with
connection = get_connection_gatt(hub_mac='00:16:53:A5:5A:0B')
i receive this:

/usr/bin/python2.7 /root/PycharmProjects/mypy/lego/demo.py
Traceback (most recent call last):
  File "/root/PycharmProjects/mypy/lego/demo.py", line 192, in <module>
    connection = get_connection_gatt(hub_mac='00:16:53:A5:5A:0B')
  File "/usr/local/lib/python2.7/dist-packages/pylgbst/__init__.py", line 24, in get_connection_gatt
    return GattConnection(controller).connect(hub_mac)
  File "/usr/local/lib/python2.7/dist-packages/pylgbst/comms/cgatt.py", line 93, in connect
    self._manager.start_discovery()
  File "/usr/local/lib/python2.7/dist-packages/gatt/gatt_linux.py", line 149, in start_discovery
    raise _error_from_dbus_error(e)
gatt.errors.Failed: Method "SetDiscoveryFilter" with signature "a{ss}" on interface "org.bluez.Adapter1" doesn't exist

from pylgbst.

undera avatar undera commented on July 18, 2024

pygatt might require sudo to run properly

from pylgbst.

asbayer avatar asbayer commented on July 18, 2024

I am logged in as user root on that machine. But I also tried now:
sudo python2.7 demo.py
unfortunately with the same result. I will continue investigating

from pylgbst.

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.