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

Duplo Train - Bricknil Traceback Crash #23

Open
vladivanovic opened this issue Sep 18, 2020 · 7 comments
Open

Duplo Train - Bricknil Traceback Crash #23

vladivanovic opened this issue Sep 18, 2020 · 7 comments

Comments

@vladivanovic
Copy link

Hi all, just followed the instructions to install all Prereqs on my Raspberry Pi 3 running the latest Ubuntu mate.

I then ran the example Duplo code and his this error double traceback error:

(FYI if I don't use sudo I get a txdbus error that access is denied and rejects sending messages)

name@name-desktop:~$ sudo python3 legotraintest.py
started thread for curio
inside curio run loop
INFO:BLE Event Q.0:using bleak
INFO:BLE Event Q.0:Starting scan for UART 00001623-1212-efde-1623-785feabcd123
INFO:BLE Event Q.0:Looking for first matching hub
Awaiting on bleak discover
Unhandled Error
Traceback (most recent call last):
File "/home/name/.local/lib/python3.7/site-packages/txdbus/protocol.py", line 140, in dataReceived
self.rawDBusMessageReceived(raw_msg)
File "/home/name/.local/lib/python3.7/site-packages/txdbus/protocol.py", line 266, in rawDBusMessageReceived
self.signalReceived(m)
File "/home/name/.local/lib/python3.7/site-packages/txdbus/client.py", line 642, in signalReceived
self.router.routeMessage(msig)
File "/home/name/.local/lib/python3.7/site-packages/txdbus/router.py", line 128, in routeMessage
r.match(m)
--- ---
File "/home/name/.local/lib/python3.7/site-packages/txdbus/router.py", line 67, in match
self.callback(m)
File "/home/name/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/discovery.py", line 65, in parse_msg
device_interface = message.body[1].get("org.bluez.Device1", {})
builtins.AttributeError: 'list' object has no attribute 'get'

Traceback (most recent call last):
File "legotraintest.py", line 70, in
start(system)
File "/home/name/.local/lib/python3.7/site-packages/bricknil/bricknil.py", line 214, in start
ble.run()
File "/home/name/.local/lib/python3.7/site-packages/bricknil/bleak_interface.py", line 52, in run
self.loop.run_until_complete(self.asyncio_loop())
File "/usr/lib/python3.7/asyncio/base_events.py", line 579, in run_until_complete
return future.result()
File "/home/name/.local/lib/python3.7/site-packages/bricknil/bleak_interface.py", line 65, in asyncio_loop
devices = await bleak.discover(timeout=1, loop=self.loop)
File "/home/name/.local/lib/python3.7/site-packages/bleak/backends/bluezdbus/discovery.py", line 167, in discover
returnSignature='a{sv}').asFuture(loop)
txdbus.error.RemoteError: org.freedesktop.DBus.Error.UnknownObject: Method "GetAll" with signature "s" on interface "org.freedesktop.DBus.Properties" doesn't exist

@jncraton
Copy link

jncraton commented Oct 16, 2020

I had the same issue recently on a Pi 4. I was able to resolve it by downgrading the Bluetooth firmware:

wget http://archive.raspberrypi.org/debian/pool/main/b/bluez-firmware/bluez-firmware_1.2-4+rpt2_all.deb
sudo dpkg -i bluez-firmware_1.2-4+rpt2_all.deb

I rebooted to make sure the updated firmware was in use.

@vladivanovic
Copy link
Author

vladivanovic commented Oct 25, 2020

Hey jncraton, thank you for getting back to me!

I was on version:
Ubuntu 18.04.5 LTS (GNU/Linux 4.15.0-1060-raspi2 armv7l)
bluez-firmware/bionic,now 1.2-4+rpt1~bionic1.0 all [installed,automatic]

It seems like I was a version lower than the one you suggest. When I tried to upgrade using your commands it had a Firmware update + update to Ubuntu 20 waiting for my Rasbpi 3B:

name@name-desktop:$ sudo dpkg -i bluez-firmware_1.2-4+rpt2_all.deb
(Reading database ... 191338 files and directories currently installed.)
Preparing to unpack bluez-firmware_1.2-4+rpt2_all.deb ...
Unpacking bluez-firmware (1.2-4+rpt2) over (1.2-4+rpt1
bionic1.0) ...
dpkg: error processing archive bluez-firmware_1.2-4+rpt2_all.deb (--install):
trying to overwrite '/lib/firmware/brcm/BCM43430A1.hcd', which is also in package linux-firmware-raspi2 1.20200601+arm64-0ubuntu2~18.04.1
Errors were encountered while processing:
bluez-firmware_1.2-4+rpt2_all.deb

Check what needed upgrading I did a apt-get dist-upgrade and got the following listed out:

The following NEW packages will be installed:
libllvm10 libnetplan0 linux-image-4.15.0-1070-raspi2
linux-modules-4.15.0-1070-raspi2
The following packages will be upgraded:
libgl1-mesa-dri linux-image-raspi2 mesa-va-drivers mesa-vdpau-drivers
netplan.io

Ran the upgrade and in progress with the release upgrade now. Will try again once done and see how I go.

@vladivanovic
Copy link
Author

Did the upgrade, package didn't update all so I did a force upgrade.

Reinstalled all packages, still same issue, will need to keep digging

name@name-desktop:~$ python3 legotraintest.py
started thread for curio
inside curio run loop
INFO:BLE Event Q.0:using bleak
INFO:BLE Event Q.0:Starting scan for UART 00001623-1212-efde-1623-785feabcd123
INFO:BLE Event Q.0:Looking for first matching hub
Awaiting on bleak discover
Done Awaiting on bleak discover
INFO:BLE Event Q.0:Rescanning for 00001623-1212-efde-1623-785feabcd123 (60 tries left)
Awaiting on bleak discover
Done Awaiting on bleak discover
INFO:BLE Event Q.0:Rescanning for 00001623-1212-efde-1623-785feabcd123 (59 tries left)
Awaiting on bleak discover
Unhandled Error
Traceback (most recent call last):
File "/home/name/.local/lib/python3.8/site-packages/txdbus/protocol.py", line 140, in dataReceived
self.rawDBusMessageReceived(raw_msg)
File "/home/name/.local/lib/python3.8/site-packages/txdbus/protocol.py", line 266, in rawDBusMessageReceived
self.signalReceived(m)
File "/home/name/.local/lib/python3.8/site-packages/txdbus/client.py", line 642, in signalReceived
self.router.routeMessage(msig)
File "/home/name/.local/lib/python3.8/site-packages/txdbus/router.py", line 128, in routeMessage
r.match(m)
--- ---
File "/home/name/.local/lib/python3.8/site-packages/txdbus/router.py", line 67, in match
self.callback(m)
File "/home/name/.local/lib/python3.8/site-packages/bleak/backends/bluezdbus/discovery.py", line 65, in parse_msg
device_interface = message.body[1].get("org.bluez.Device1", {})
builtins.AttributeError: 'list' object has no attribute 'get'

Unhandled Error
Traceback (most recent call last):
File "/home/name/.local/lib/python3.8/site-packages/txdbus/protocol.py", line 140, in dataReceived
self.rawDBusMessageReceived(raw_msg)
File "/home/name/.local/lib/python3.8/site-packages/txdbus/protocol.py", line 266, in rawDBusMessageReceived
self.signalReceived(m)
File "/home/name/.local/lib/python3.8/site-packages/txdbus/client.py", line 642, in signalReceived
self.router.routeMessage(msig)
File "/home/name/.local/lib/python3.8/site-packages/txdbus/router.py", line 128, in routeMessage
r.match(m)
--- ---
File "/home/name/.local/lib/python3.8/site-packages/txdbus/router.py", line 67, in match
self.callback(m)
File "/home/name/.local/lib/python3.8/site-packages/bleak/backends/bluezdbus/discovery.py", line 65, in parse_msg
device_interface = message.body[1].get("org.bluez.Device1", {})
builtins.AttributeError: 'list' object has no attribute 'get'

Unhandled Error
Traceback (most recent call last):
File "/home/name/.local/lib/python3.8/site-packages/txdbus/protocol.py", line 140, in dataReceived
self.rawDBusMessageReceived(raw_msg)
File "/home/name/.local/lib/python3.8/site-packages/txdbus/protocol.py", line 266, in rawDBusMessageReceived
self.signalReceived(m)
File "/home/name/.local/lib/python3.8/site-packages/txdbus/client.py", line 642, in signalReceived
self.router.routeMessage(msig)
File "/home/name/.local/lib/python3.8/site-packages/txdbus/router.py", line 128, in routeMessage
r.match(m)
--- ---
File "/home/name/.local/lib/python3.8/site-packages/txdbus/router.py", line 67, in match
self.callback(m)
File "/home/name/.local/lib/python3.8/site-packages/bleak/backends/bluezdbus/discovery.py", line 65, in parse_msg
device_interface = message.body[1].get("org.bluez.Device1", {})
builtins.AttributeError: 'list' object has no attribute 'get'

Traceback (most recent call last):
File "legotraintest.py", line 70, in
start(system)
File "/home/name/.local/lib/python3.8/site-packages/bricknil/bricknil.py", line 214, in start
ble.run()
File "/home/name/.local/lib/python3.8/site-packages/bricknil/bleak_interface.py", line 52, in run
self.loop.run_until_complete(self.asyncio_loop())
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/home/name/.local/lib/python3.8/site-packages/bricknil/bleak_interface.py", line 65, in asyncio_loop
devices = await bleak.discover(timeout=1, loop=self.loop)
File "/home/name/.local/lib/python3.8/site-packages/bleak/backends/bluezdbus/discovery.py", line 161, in discover
properties = await bus.callRemote(
txdbus.error.RemoteError: org.freedesktop.DBus.Error.UnknownObject: Method "GetAll" with signature "s" on interface "org.freedesktop.DBus.Pro perties" doesn't exist

@vladivanovic
Copy link
Author

Just FYI I re-ran this as sudo after fixing all of that up, didn't work. I downloaded the examples from this git repo - still didn't work.

@vladivanovic
Copy link
Author

Interestingly after installing regular Bleak manually I get the following errors now

name@name-desktop:~/bricknil$ sudo python3 examples/duplo_train.py
started thread for curio
inside curio run loop
INFO:BLE Event Q.0:using bleak
INFO:BLE Event Q.0:Starting scan for UART 00001623-1212-efde-1623-785feabcd123
INFO:BLE Event Q.0:Looking for first matching hub
Awaiting on bleak discover
Done Awaiting on bleak discover
ERROR:curio.kernel:Task Crash: Task(id=7, name='BLEventQ.connect', state='TERMINATED')
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/curio/kernel.py", line 737, in kernel_run
trap = current.send(current._trap_result)
File "/usr/local/lib/python3.8/dist-packages/curio/task.py", line 167, in send
return self._send(value)
File "/usr/local/lib/python3.8/dist-packages/curio/task.py", line 171, in _task_runner
return await coro
File "/usr/local/lib/python3.8/dist-packages/bricknil/ble_queue.py", line 228, in connect
await self._ble_connect(hub.uart_uuid, hub.ble_name, hub.manufacturer_id, ble_id)
File "/usr/local/lib/python3.8/dist-packages/bricknil/ble_queue.py", line 171, in _ble_connect
devices = [d for d in devices if str(uart_uuid) in d.uuids]
File "/usr/local/lib/python3.8/dist-packages/bricknil/ble_queue.py", line 171, in
devices = [d for d in devices if str(uart_uuid) in d.uuids]
AttributeError: 'BLEDevice' object has no attribute 'uuids'
INFO:BLE Event Q.0:Terminating and disconnecxting
quitting
INFO:root:quitting
quit
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/curio/kernel.py", line 737, in kernel_run
trap = current.send(current._trap_result)
File "/usr/local/lib/python3.8/dist-packages/curio/task.py", line 167, in send
return self._send(value)
File "/usr/local/lib/python3.8/dist-packages/curio/task.py", line 171, in _task_runner
return await coro
File "/usr/local/lib/python3.8/dist-packages/bricknil/ble_queue.py", line 228, in connect
await self._ble_connect(hub.uart_uuid, hub.ble_name, hub.manufacturer_id, ble_id)
File "/usr/local/lib/python3.8/dist-packages/bricknil/ble_queue.py", line 171, in _ble_connect
devices = [d for d in devices if str(uart_uuid) in d.uuids]
File "/usr/local/lib/python3.8/dist-packages/bricknil/ble_queue.py", line 171, in
devices = [d for d in devices if str(uart_uuid) in d.uuids]
AttributeError: 'BLEDevice' object has no attribute 'uuids'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.8/dist-packages/bricknil/bricknil.py", line 191, in _curio_event_run
run(_run_all(ble, system), with_monitor=False)
File "/usr/local/lib/python3.8/dist-packages/curio/kernel.py", line 823, in run
return kernel.run(corofunc, *args)
File "/usr/local/lib/python3.8/dist-packages/curio/kernel.py", line 173, in run
raise ret_exc
File "/usr/local/lib/python3.8/dist-packages/curio/kernel.py", line 737, in kernel_run
trap = current.send(current._trap_result)
File "/usr/local/lib/python3.8/dist-packages/curio/task.py", line 167, in send
return self._send(value)
File "/usr/local/lib/python3.8/dist-packages/curio/task.py", line 171, in _task_runner
return await coro
File "/usr/local/lib/python3.8/dist-packages/bricknil/bricknil.py", line 138, in _run_all
await task_connect.join()
File "/usr/local/lib/python3.8/dist-packages/curio/task.py", line 187, in join
raise TaskError('Task crash') from self.exception
curio.errors.TaskError: Task crash

@eparadis
Copy link

I'm having the same issue. I also have an RPi3 that is giving the error

  File "/usr/local/lib/python3.7/dist-packages/bleak/backends/bluezdbus/discovery.py", line 65, in
parse_msg                                
    device_interface = message.body[1].get("org.bluez.Device1", {})
builtins.AttributeError: 'list' object has no attribute 'get' 

I'm using the example off the front page like sudo python3 example.py - the only change is adding lines to increase the logging level to INFO.

How can I help debug this? I'm eager to make it work.

@Kinetize
Copy link

Kinetize commented Jan 5, 2021

I also run into the original error (txdbus.error.RemoteError: org.freedesktop.DBus.Error.UnknownObject: Method "GetAll" with signature "s" on interface "org.freedesktop.DBus.Properties" doesn't exist) when connecting to a normal PoweredUpHub with a train motor attached, Downgrading the bluetooth firmware as suggested by @jncraton did not resolve the issue for me.
Interestingly, in my case, it appears rather occasionally (roughly 50% of connection attempts). When connecting to 2 hubs simultaneously, it appears roughly 90% of the time, which is really annoying.

Does anyone have a solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants