-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Description
I'm trying to connect to my 4100 excavator from raspberry pi 4, but it gets disconnected right after connection. What I discovered is that connection won't drop until "notify" message is sent to socket, but I can't find out why it happens. No error or other clue appears. I'm starting to think there is race condition because it got connected once and started controlling motors. After I turned off bluetooth on raspberry, turned it on again and restarted my script with no code changes, it doesn't connect again. Here are logs:
DEBUG:vext:zope not found in: /home/pi/dev/lego:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/home/pi/dev/lego_venv/lib/python3.7/site-packages
DEBUG:vext:zope not found in: /home/pi/dev/lego:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/home/pi/dev/lego_venv/lib/python3.7/site-packages
DEBUG:vext:zope not found in: /home/pi/dev/lego:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/home/pi/dev/lego_venv/lib/python3.7/site-packages
DEBUG:vext:zope not found in: /home/pi/dev/lego:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/home/pi/dev/lego_venv/lib/python3.7/site-packages
DEBUG:vext:win32api not found in: /home/pi/dev/lego:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/home/pi/dev/lego_venv/lib/python3.7/site-packages
DEBUG:vext:win32api not found in: /home/pi/dev/lego:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/home/pi/dev/lego_venv/lib/python3.7/site-packages
DEBUG:vext:win32api not found in: /home/pi/dev/lego:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/home/pi/dev/lego_venv/lib/python3.7/site-packages
DEBUG:vext:win32api not found in: /home/pi/dev/lego:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/home/pi/dev/lego_venv/lib/python3.7/site-packages
DEBUG:vext:OpenSSL not found in: /home/pi/dev/lego:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/home/pi/dev/lego_venv/lib/python3.7/site-packages
DEBUG:vext:OpenSSL not found in: /home/pi/dev/lego:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/home/pi/dev/lego_venv/lib/python3.7/site-packages
DEBUG:vext:found module OpenSSL in sitedir or subdirectory [/usr/lib/python3/dist-packages]
DEBUG:vext:OpenSSL not found in: /home/pi/dev/lego:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/home/pi/dev/lego_venv/lib/python3.7/site-packages
DEBUG:vext:OpenSSL not found in: /home/pi/dev/lego:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/home/pi/dev/lego_venv/lib/python3.7/site-packages
DEBUG:vext:found module OpenSSL in sitedir or subdirectory [/usr/lib/python3/dist-packages]
DEBUG:vext:OpenSSL not found in: /home/pi/dev/lego:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/home/pi/dev/lego_venv/lib/python3.7/site-packages
DEBUG:vext:OpenSSL not found in: /home/pi/dev/lego:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/home/pi/dev/lego_venv/lib/python3.7/site-packages
DEBUG:vext:found module OpenSSL in sitedir or subdirectory [/usr/lib/python3/dist-packages]
DEBUG:asyncio:Using selector: EpollSelector
started thread for curio
inside curio run loop
INFO:BLE Event Q.0:using bleak
DEBUG:truck.2:Decorating class ExcavatorBase with CPlusXLMotor
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
DEBUG:vext:cPickle not found in: /home/pi/dev/lego:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/home/pi/dev/lego_venv/lib/python3.7/site-packages
DEBUG:vext:cPickle not found in: /home/pi/dev/lego:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/home/pi/dev/lego_venv/lib/python3.7/site-packages
DEBUG:vext:cPickle not found in: /home/pi/dev/lego:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/home/pi/dev/lego_venv/lib/python3.7/site-packages
DEBUG:vext:cPickle not found in: /home/pi/dev/lego:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/home/pi/dev/lego_venv/lib/python3.7/site-packages
DEBUG:vext:OpenSSL not found in: /home/pi/dev/lego:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/home/pi/dev/lego_venv/lib/python3.7/site-packages
DEBUG:vext:OpenSSL not found in: /home/pi/dev/lego:/usr/lib/python37.zip:/usr/lib/python3.7:/usr/lib/python3.7/lib-dynload:/home/pi/dev/lego_venv/lib/python3.7/site-packages
DEBUG:vext:found module OpenSSL in sitedir or subdirectory [/usr/lib/python3/dist-packages]
Done Awaiting on bleak discover
INFO:BLE Event Q.0:Rescanning for 00001623-1212-efde-1623-785feabcd123 (60 tries left)
Awaiting on bleak discover
DEBUG:bleak.backends.bluezdbus.discovery:dev_90_84_2B_4E_A1_92, 90:84:2B:4E:A1:92 (-62 dBm), Object Path: /org/bluez/hci0/dev_90_84_2B_4E_A1_92
DEBUG:bleak.backends.bluezdbus.discovery:dev_90_84_2B_4E_A1_92, 90:84:2B:4E:A1:92 (-62 dBm), Object Path: /org/bluez/hci0/dev_90_84_2B_4E_A1_92
DEBUG:bleak.backends.bluezdbus.discovery:dev_90_84_2B_4E_A1_92, 90:84:2B:4E:A1:92 (-62 dBm), Object Path: /org/bluez/hci0/dev_90_84_2B_4E_A1_92
DEBUG:bleak.backends.bluezdbus.discovery:dev_90_84_2B_4E_A1_92, 90:84:2B:4E:A1:92 (-62 dBm), Object Path: /org/bluez/hci0/dev_90_84_2B_4E_A1_92
Done Awaiting on bleak discover
INFO:BLE Event Q.0:checking manufacturer ID for device named Technic Hub for Control+ Hub
INFO:BLE Event Q.0:found device Technic Hub
DEBUG:bleak.backends.bluezdbus.client:Connecting to BLE device @ 90:84:2B:4E:A1:92 with hci0
DEBUG:bleak.backends.bluezdbus.discovery:dev_90_84_2B_4E_A1_92, 90:84:2B:4E:A1:92 (-62 dBm), Object Path: /org/bluez/hci0/dev_90_84_2B_4E_A1_92
DEBUG:bleak.backends.bluezdbus.discovery:dev_90_84_2B_4E_A1_92, 90:84:2B:4E:A1:92 (-62 dBm), Object Path: /org/bluez/hci0/dev_90_84_2B_4E_A1_92
DEBUG:bleak.backends.bluezdbus.client:Connection successful.
DEBUG:bleak.backends.bluezdbus.discovery:dev_90_84_2B_4E_A1_92, 90:84:2B:4E:A1:92 (-62 dBm), Object Path: /org/bluez/hci0/dev_90_84_2B_4E_A1_92
DEBUG:bleak.backends.bluezdbus.discovery:dev_90_84_2B_4E_A1_92, 90:84:2B:4E:A1:92 (-62 dBm), Object Path: /org/bluez/hci0/dev_90_84_2B_4E_A1_92
DEBUG:bleak.backends.bluezdbus.client:Get Services...
DEBUG:bleak.backends.bluezdbus.client:
Primary Service
/org/bluez/hci0/dev_90_84_2B_4E_A1_92/service000c
00001623-1212-efde-1623-785feabcd123
Unknown
DEBUG:bleak.backends.bluezdbus.client:
Characteristic
/org/bluez/hci0/dev_90_84_2B_4E_A1_92/service000c/char000d
00001624-1212-efde-1623-785feabcd123
Unknown
DEBUG:bleak.backends.bluezdbus.client:
Descriptor
/org/bluez/hci0/dev_90_84_2B_4E_A1_92/service000c/char000d/desc000f
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
DEBUG:bleak.backends.bluezdbus.client:
Primary Service
/org/bluez/hci0/dev_90_84_2B_4E_A1_92/service0001
00001801-0000-1000-8000-00805f9b34fb
Generic Attribute Profile
DEBUG:bleak.backends.bluezdbus.client:
Characteristic
/org/bluez/hci0/dev_90_84_2B_4E_A1_92/service0001/char0002
00002a05-0000-1000-8000-00805f9b34fb
Service Changed
DEBUG:bleak.backends.bluezdbus.client:
Descriptor
/org/bluez/hci0/dev_90_84_2B_4E_A1_92/service0001/char0002/desc0004
00002902-0000-1000-8000-00805f9b34fb
Client Characteristic Configuration
INFO:BLE Event Q.0:Device advertised: {'00001624-1212-efde-1623-785feabcd123': {'UUID': '00001624-1212-efde-1623-785feabcd123', 'Service': '/org/bluez/hci0/dev_90_84_2B_4E_A1_92/service000c', 'Value': [15, 0, 4, 1, 1, 47, 0, 0, 16, 0, 0, 0, 16, 0, 0], 'Notifying': False, 'Flags': ['read', 'write-without-response', 'write', 'notify'], 'WriteAcquired': False, 'NotifyAcquired': False, 'Path': '/org/bluez/hci0/dev_90_84_2B_4E_A1_92/service000c/char000d'}, '00002a05-0000-1000-8000-00805f9b34fb': {'UUID': '00002a05-0000-1000-8000-00805f9b34fb', 'Service': '/org/bluez/hci0/dev_90_84_2B_4E_A1_92/service0001', 'Value': [], 'Notifying': False, 'Flags': ['indicate'], 'Path': '/org/bluez/hci0/dev_90_84_2B_4E_A1_92/service0001/char0002'}}
INFO:BLE Event Q.0:Connected to device Technic Hub:90:84:2B:4E:A1:92
INFO:BLE Event Q.0:Waiting for hubs to end
DEBUG:truck.2:starting peripheral message loop
INFO:truck.2:Running
DEBUG:BLE Event Q.0:Got msg: req mode info on 255 = [0, 33, 255, 1]
DEBUG:bleak.backends.bluezdbus.discovery:dev_90_84_2B_4E_A1_92, 90:84:2B:4E:A1:92 (-62 dBm), Object Path: /org/bluez/hci0/dev_90_84_2B_4E_A1_92
DEBUG:bleak.backends.bluezdbus.discovery:dev_90_84_2B_4E_A1_92, 90:84:2B:4E:A1:92 (-62 dBm), Object Path: /org/bluez/hci0/dev_90_84_2B_4E_A1_92
Traceback (most recent call last):
File "main.py", line 53, in <module>
start(system)
File "/home/pi/dev/lego/bricknil/bricknil.py", line 214, in start
ble.run()
File "/home/pi/dev/lego/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 584, in run_until_complete
return future.result()
File "/home/pi/dev/lego/bricknil/bleak_interface.py", line 75, in asyncio_loop
await device.write_gatt_char(char_uuid, msg_bytes)
File "/home/pi/dev/lego_venv/lib/python3.7/site-packages/bleak/backends/bluezdbus/client.py", line 252, in write_gatt_char
self.loop
txdbus.error.RemoteError: org.bluez.Error.Failed: Not connected
If I comment out line line 112 in bricknil.ble_queue (await self.ble.in_queue.put( ('notify', (device, char_uuid, bleak_received) ))), it doesn't disconnect, but motors don't move.
Can anyone help?
Metadata
Metadata
Assignees
Labels
No labels