pygatt connects but unable to subscribe vs. bleak connects and able to subscribe: why isn't bleak replicable with pygatt? - python-3.x

I am trying to subscribe to single characteristic on a BLE device. Using bleak I am able to connect to the device and then write / subscribe to characteristics. With virtually identical code using pygatt, I can connect to the same device using my BLED112 dongle, but am not able to write/subscribe to that same characteristic.
bleak test program:
import sys
import os
import asyncio
import aioconsole
from bleak import BleakClient
ADDRESS = '28686572-5A71-435E-952A-6F4292F5B04A'
#ADDRESS = '00:55:DA:B7:98:9C'
CHARACTERISTIC_UUID = '273e0003-4c4d-454d-96be-f03bac821358'
if len(sys.argv) == 3:
ADDRESS = sys.argv[1]
CHARACTERISTIC_UUID = sys.argv[2]
def notification_handler(sender, data):
"""Simple notification handler which prints the data received."""
print("{0}: {1}".format(sender, data))
async def run(address):
async with BleakClient(address) as client:
await client.connect()
print("Is connected")
# start notifications on control characteristic
await client.start_notify('273e0001-4c4d-454d-96be-f03bac821358', notification_handler)
# write to control handle, set preset to 21
await client.write_gatt_char('273e0001-4c4d-454d-96be-f03bac821358', bytearray([0x04, 0x70, 0x32, 0x31, 0x0a]), False)
# write to control handle get device info
await client.write_gatt_char('273e0001-4c4d-454d-96be-f03bac821358', bytearray([0x03, 0x76, 0x31, 0x0a]), False)
# write to control handle for resume
await client.write_gatt_char('273e0001-4c4d-454d-96be-f03bac821358', bytearray([0x02, 0x64, 0x0a]), False)
# start notifications on TP9
await client.start_notify('273e0003-4c4d-454d-96be-f03bac821358', notification_handler)
# wait for input
await aioconsole.ainput('Running: Press a key to quit')
await client.stop_notify('273e0003-4c4d-454d-96be-f03bac821358')
if __name__ == "__main__":
os.environ["PYTHONASYNCIODEBUG"] = str(1)
loop = asyncio.get_event_loop()
loop.run_until_complete(run(ADDRESS))
Output:
$ python3 bleaktest.py
Is connected
13: bytearray(b'\x08{"rc":0}\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
13: bytearray(b'\x10{"ap":"headset",\x00\x00\x00')
13: bytearray(b'\x13"sp":"Blackcomb_rev')
13: bytearray(b'\x03B",":"Blackcomb_rev')
13: bytearray(b'\x10"tp":"consumer",rev')
13: bytearray(b'\x0c"hw":"10.6",er",rev')
13: bytearray(b'\x07"bn":2,0.6",er",rev')
13: bytearray(b'\x0e"fw":"1.0.21",",rev')
13: bytearray(b'\r"bl":"1.0.0",,",rev')
13: bytearray(b'\x07"pv":1,.0.0",,",rev')
13: bytearray(b'\x07"rc":0}.0.0",,",rev')
Running: Press a key to quit
13: bytearray(b'\x08{"rc":0}0.0",,",rev')
31: bytearray(b'\x00\x00\x80\x08\x00z\xa8\xdfL#\x00\xa8!\xb6p\xa0\x00hA\x92')
31: bytearray(b'\x00\x01\x9d0\x00]q\x86\xb5\xb0\x00+\xaf\x96\xf3#\x1a\x00\t\x88')
31: bytearray(b'\x00\x02\x1bh\x04\x00\x06\x14\x18\t\xe8\x00\x05&\x13\xdc%\x00\x01\x97')
...
31: bytearray(b'\x00\x19_\xf1\x85\x9e\xc0\x00GP\xe9\xcb#\x00\t\x9c\xaf\x11\x15\xe4')
...
As you can see from the output, the writes are successful because of the response handles. And the subscriptions are clearly functional given the responses from both the control characteristic and the secondary characteristic.
pygatt test program:
import pygatt
import time
from binascii import hexlify
from pygatt.backends.backend import BLEAddressType
def handle_data(handle, data):
"""
handle -- integer, characteristic read handle the data was received on
raw_value -- bytearray, the data returned in the notification
"""
print(hexlify(data))
#adapter = pygatt.GATTToolBackend('hci0') linux backend
adapter = pygatt.BGAPIBackend()
try:
adapter.start()
device = adapter.connect('00:55:DA:B7:98:9C', address_type = BLEAddressType.public)
print("Is connected")
# start notifications on control characteristic
device.subscribe('273e0001-4c4d-454d-96be-f03bac821358', callback = handle_data, wait_for_response = True)
# write to control handle, set preset to 21
device.char_write('273e0001-4c4d-454d-96be-f03bac821358', bytearray([0x04, 0x70, 0x32, 0x31, 0x0a]), wait_for_response = True)
# write to control handle get device info
device.char_write('273e0001-4c4d-454d-96be-f03bac821358', bytearray([0x03, 0x76, 0x31, 0x0a]), wait_for_response = True)
# write to control handle for resume
device.char_write('273e0001-4c4d-454d-96be-f03bac821358', bytearray([0x02, 0x64, 0x0a]), wait_for_response = True)
time.sleep(5)
# subscribe to eeg characteristic
device.subscribe('273e0003-4c4d-454d-96be-f03bac821358', callback = handle_data, indication = False, wait_for_response = True)
time.sleep(5)
finally:
print("Adapter stopped")
adapter.stop()
Output:
$ python3 pygatttest.py
Is connected
Adapter stopped
The pygatt program is able to connect to the device (I can see the indicator light change states from flashing to solid), but subscription fails. I don't know if char_write is working because I don't receive a return notification. Am in the process of trying the logging module to figure out more per the comments below.
Updated output with logging enabled:
$ python3 pygatttest.py
INFO:pygatt.backends.bgapi.bgapi:Initialized new BGAPI backend
INFO:pygatt.backends.bgapi.bgapi:Auto-detecting serial port for BLED112
DEBUG:pygatt.backends.bgapi.util:Found 4 serial USB devices
DEBUG:pygatt.backends.bgapi.util:Checking serial USB device: /dev/cu.Bluetooth-Incoming-Port - n/a
DEBUG:pygatt.backends.bgapi.util:Checking serial USB device: /dev/cu.usbmodem11 - Low Energy Dongle - CDC data
DEBUG:pygatt.backends.bgapi.util:USB device: Low Energy Dongle - CDC data VID=0x2458 PID=0x0001 on /dev/cu.usbmodem11
INFO:pygatt.backends.bgapi.bgapi:Found BLED112 on serial port /dev/cu.usbmodem11
INFO:pygatt.backends.bgapi.bgapi:Resetting and reconnecting to device for a clean environment
DEBUG:pygatt.backends.bgapi.bgapi:Opening connection to serial port (attempt 1)
INFO:pygatt.backends.bgapi.bgapi:Auto-detecting serial port for BLED112
DEBUG:pygatt.backends.bgapi.util:Found 4 serial USB devices
DEBUG:pygatt.backends.bgapi.util:Checking serial USB device: /dev/cu.Bluetooth-Incoming-Port - n/a
DEBUG:pygatt.backends.bgapi.util:Checking serial USB device: /dev/cu.usbmodem11 - Low Energy Dongle - CDC data
DEBUG:pygatt.backends.bgapi.util:USB device: Low Energy Dongle - CDC data VID=0x2458 PID=0x0001 on /dev/cu.usbmodem11
INFO:pygatt.backends.bgapi.bgapi:Found BLED112 on serial port /dev/cu.usbmodem11
DEBUG:pygatt.backends.bgapi.bgapi:Opening connection to serial port (attempt 1)
INFO:pygatt.backends.bgapi.bgapi:Auto-detecting serial port for BLED112
DEBUG:pygatt.backends.bgapi.util:Found 3 serial USB devices
DEBUG:pygatt.backends.bgapi.util:Checking serial USB device: /dev/cu.Bluetooth-Incoming-Port - n/a
DEBUG:pygatt.backends.bgapi.bgapi:Failed to open serial port
Traceback (most recent call last):
File ".../pygatt/backends/bgapi/bgapi.py", line 171, in _open_serial_port
serial_port = self._serial_port or self._detect_device_port()
File ".../pygatt/backends/bgapi/bgapi.py", line 147, in _detect_device_port
raise BGAPIError("Unable to auto-detect BLED112 serial port")
pygatt.backends.bgapi.exceptions.BGAPIError: Unable to auto-detect BLED112 serial port
DEBUG:pygatt.backends.bgapi.bgapi:Opening connection to serial port (attempt 2)
INFO:pygatt.backends.bgapi.bgapi:Auto-detecting serial port for BLED112
DEBUG:pygatt.backends.bgapi.util:Found 3 serial USB devices
DEBUG:pygatt.backends.bgapi.util:Checking serial USB device: /dev/cu.Bluetooth-Incoming-Port - n/a
...
DEBUG:pygatt.backends.bgapi.bgapi:Failed to open serial port
Traceback (most recent call last):
File ".../pygatt/backends/bgapi/bgapi.py", line 171, in _open_serial_port
serial_port = self._serial_port or self._detect_device_port()
File ".../pygatt/backends/bgapi/bgapi.py", line 147, in _detect_device_port
raise BGAPIError("Unable to auto-detect BLED112 serial port")
pygatt.backends.bgapi.exceptions.BGAPIError: Unable to auto-detect BLED112 serial port
DEBUG:pygatt.backends.bgapi.bgapi:Opening connection to serial port (attempt 3)
INFO:pygatt.backends.bgapi.bgapi:Auto-detecting serial port for BLED112
DEBUG:pygatt.backends.bgapi.util:Found 4 serial USB devices
DEBUG:pygatt.backends.bgapi.util:Checking serial USB device: /dev/cu.Bluetooth-Incoming-Port - n/a
...
DEBUG:pygatt.backends.bgapi.util:Checking serial USB device: /dev/cu.usbmodem11 - Low Energy Dongle - CDC data
DEBUG:pygatt.backends.bgapi.util:USB device: Low Energy Dongle - CDC data VID=0x2458 PID=0x0001 on /dev/cu.usbmodem11
INFO:pygatt.backends.bgapi.bgapi:Found BLED112 on serial port /dev/cu.usbmodem11
INFO:pygatt.backends.bgapi.bgapi:Running receiver
INFO:pygatt.backends.bgapi.bgapi:Disabling advertising
DEBUG:pygatt.backends.bgapi.bgapi:Expecting a response of one of [<ResponsePacketType.gap_set_mode: 58>] within 1.000000s
DEBUG:pygatt.backends.bgapi.bgapi:Received a ResponsePacketType.gap_set_mode packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Expecting a response of one of [<ResponsePacketType.sm_set_bondable_mode: 51>] within 1.000000s
DEBUG:pygatt.backends.bgapi.bgapi:Received a ResponsePacketType.sm_set_bondable_mode packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Stopping any outstanding GAP procedure
DEBUG:pygatt.backends.bgapi.bgapi:Expecting a response of one of [<ResponsePacketType.gap_end_procedure: 61>] within 1.000000s
DEBUG:pygatt.backends.bgapi.bgapi:Received a ResponsePacketType.gap_end_procedure packet: Device in wrong state
INFO:pygatt.backends.bgapi.bgapi:Connecting to device at address 00:55:DA:B7:98:9C (timeout 5s)
DEBUG:pygatt.backends.bgapi.bgapi:Expecting a response of one of [<ResponsePacketType.sm_set_bondable_mode: 51>] within 1.000000s
DEBUG:pygatt.backends.bgapi.bgapi:Received a ResponsePacketType.sm_set_bondable_mode packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Expecting a response of one of [<ResponsePacketType.gap_connect_direct: 60>] within 1.000000s
DEBUG:pygatt.backends.bgapi.bgapi:Received a ResponsePacketType.gap_connect_direct packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Expecting a response of one of [<EventPacketType.connection_status: 11>] within 5.000000s
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.connection_status packet: Success
INFO:pygatt.backends.bgapi.bgapi:Connection status: handle=0x0, flags=5, address=0xb'9c98b7da5500', connection interval=75.000000ms, timeout=1000, latency=0 intervals, bonding=0xff
INFO:pygatt.backends.bgapi.bgapi:Connected to 00:55:DA:B7:98:9C
Is connected
DEBUG:pygatt.device:Looking up handle for characteristic 273e0001-4c4d-454d-96be-f03bac821358
INFO:pygatt.backends.bgapi.bgapi:Fetching characteristics for connection 0
DEBUG:pygatt.backends.bgapi.bgapi:Expecting a response of one of [<ResponsePacketType.attclient_find_information: 41>] within 1.000000s
DEBUG:pygatt.backends.bgapi.bgapi:Received a ResponsePacketType.attclient_find_information packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Expecting a response of one of [<EventPacketType.attclient_procedure_completed: 17>] within 30.000000s
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
INFO:pygatt.backends.bgapi.bgapi:Found approved characteristic 00002a05-0000-1000-8000-00805f9b34fb
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
INFO:pygatt.backends.bgapi.bgapi:Found approved characteristic 00002a00-0000-1000-8000-00805f9b34fb
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
INFO:pygatt.backends.bgapi.bgapi:Found approved characteristic 00002a01-0000-1000-8000-00805f9b34fb
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
INFO:pygatt.backends.bgapi.bgapi:Found approved characteristic 00002a04-0000-1000-8000-00805f9b34fb
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
INFO:pygatt.backends.bgapi.bgapi:Found custom characteristic 273e0001-4c4d-454d-96be-f03bac821358
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
INFO:pygatt.backends.bgapi.bgapi:Found custom characteristic 273e0008-4c4d-454d-96be-f03bac821358
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
INFO:pygatt.backends.bgapi.bgapi:Found custom characteristic 273e0009-4c4d-454d-96be-f03bac821358
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
INFO:pygatt.backends.bgapi.bgapi:Found custom characteristic 273e000a-4c4d-454d-96be-f03bac821358
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
INFO:pygatt.backends.bgapi.bgapi:Found custom characteristic 273e000b-4c4d-454d-96be-f03bac821358
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
INFO:pygatt.backends.bgapi.bgapi:Found custom characteristic 273e0002-4c4d-454d-96be-f03bac821358
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
INFO:pygatt.backends.bgapi.bgapi:Found custom characteristic 273e0003-4c4d-454d-96be-f03bac821358
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
INFO:pygatt.backends.bgapi.bgapi:Found custom characteristic 273e0004-4c4d-454d-96be-f03bac821358
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
INFO:pygatt.backends.bgapi.bgapi:Found custom characteristic 273e0005-4c4d-454d-96be-f03bac821358
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
INFO:pygatt.backends.bgapi.bgapi:Found custom characteristic 273e0006-4c4d-454d-96be-f03bac821358
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
INFO:pygatt.backends.bgapi.bgapi:Found custom characteristic 273e0007-4c4d-454d-96be-f03bac821358
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
INFO:pygatt.backends.bgapi.bgapi:Found custom characteristic 273e000c-4c4d-454d-96be-f03bac821358
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
cDEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
INFO:pygatt.backends.bgapi.bgapi:Found custom characteristic 273e000d-4c4d-454d-96be-f03bac821358
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
INFO:pygatt.backends.bgapi.bgapi:Found custom characteristic 273e000e-4c4d-454d-96be-f03bac821358
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
INFO:pygatt.backends.bgapi.bgapi:Found custom characteristic 273e000f-4c4d-454d-96be-f03bac821358
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
INFO:pygatt.backends.bgapi.bgapi:Found custom characteristic 273e0010-4c4d-454d-96be-f03bac821358
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
INFO:pygatt.backends.bgapi.bgapi:Found custom characteristic 273e0011-4c4d-454d-96be-f03bac821358
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_find_information_found packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_procedure_completed packet: Success
INFO:pygatt.backends.bgapi.bgapi:Characteristic 0x00002a05-0000-1000-8000-00805f9b34fb is handle 0x3
INFO:pygatt.backends.bgapi.bgapi:Characteristic descriptor 0x00002902-0000-1000-8000-00805f9b34fb is handle 0x4
INFO:pygatt.backends.bgapi.bgapi:Characteristic 0x00002a00-0000-1000-8000-00805f9b34fb is handle 0x7
INFO:pygatt.backends.bgapi.bgapi:Characteristic 0x00002a01-0000-1000-8000-00805f9b34fb is handle 0x9
INFO:pygatt.backends.bgapi.bgapi:Characteristic 0x00002a04-0000-1000-8000-00805f9b34fb is handle 0xb
INFO:pygatt.backends.bgapi.bgapi:Characteristic 0x273e0001-4c4d-454d-96be-f03bac821358 is handle 0xe
INFO:pygatt.backends.bgapi.bgapi:Characteristic descriptor 0x00002902-0000-1000-8000-00805f9b34fb is handle 0xf
INFO:pygatt.backends.bgapi.bgapi:Characteristic 0x273e0008-4c4d-454d-96be-f03bac821358 is handle 0x11
INFO:pygatt.backends.bgapi.bgapi:Characteristic descriptor 0x00002902-0000-1000-8000-00805f9b34fb is handle 0x12
INFO:pygatt.backends.bgapi.bgapi:Characteristic 0x273e0009-4c4d-454d-96be-f03bac821358 is handle 0x14
INFO:pygatt.backends.bgapi.bgapi:Characteristic descriptor 0x00002902-0000-1000-8000-00805f9b34fb is handle 0x15
INFO:pygatt.backends.bgapi.bgapi:Characteristic 0x273e000a-4c4d-454d-96be-f03bac821358 is handle 0x17
INFO:pygatt.backends.bgapi.bgapi:Characteristic descriptor 0x00002902-0000-1000-8000-00805f9b34fb is handle 0x18
INFO:pygatt.backends.bgapi.bgapi:Characteristic 0x273e000b-4c4d-454d-96be-f03bac821358 is handle 0x1a
INFO:pygatt.backends.bgapi.bgapi:Characteristic descriptor 0x00002902-0000-1000-8000-00805f9b34fb is handle 0x1b
INFO:pygatt.backends.bgapi.bgapi:Characteristic 0x273e0002-4c4d-454d-96be-f03bac821358 is handle 0x1d
INFO:pygatt.backends.bgapi.bgapi:Characteristic descriptor 0x00002902-0000-1000-8000-00805f9b34fb is handle 0x1e
INFO:pygatt.backends.bgapi.bgapi:Characteristic 0x273e0003-4c4d-454d-96be-f03bac821358 is handle 0x20
INFO:pygatt.backends.bgapi.bgapi:Characteristic descriptor 0x00002902-0000-1000-8000-00805f9b34fb is handle 0x21
INFO:pygatt.backends.bgapi.bgapi:Characteristic 0x273e0004-4c4d-454d-96be-f03bac821358 is handle 0x23
INFO:pygatt.backends.bgapi.bgapi:Characteristic descriptor 0x00002902-0000-1000-8000-00805f9b34fb is handle 0x24
INFO:pygatt.backends.bgapi.bgapi:Characteristic 0x273e0005-4c4d-454d-96be-f03bac821358 is handle 0x26
INFO:pygatt.backends.bgapi.bgapi:Characteristic descriptor 0x00002902-0000-1000-8000-00805f9b34fb is handle 0x27
INFO:pygatt.backends.bgapi.bgapi:Characteristic 0x273e0006-4c4d-454d-96be-f03bac821358 is handle 0x29
INFO:pygatt.backends.bgapi.bgapi:Characteristic descriptor 0x00002902-0000-1000-8000-00805f9b34fb is handle 0x2a
INFO:pygatt.backends.bgapi.bgapi:Characteristic 0x273e0007-4c4d-454d-96be-f03bac821358 is handle 0x2c
INFO:pygatt.backends.bgapi.bgapi:Characteristic descriptor 0x00002902-0000-1000-8000-00805f9b34fb is handle 0x2d
INFO:pygatt.backends.bgapi.bgapi:Characteristic 0x273e000c-4c4d-454d-96be-f03bac821358 is handle 0x2f
INFO:pygatt.backends.bgapi.bgapi:Characteristic descriptor 0x00002902-0000-1000-8000-00805f9b34fb is handle 0x30
INFO:pygatt.backends.bgapi.bgapi:Characteristic 0x273e000d-4c4d-454d-96be-f03bac821358 is handle 0x32
INFO:pygatt.backends.bgapi.bgapi:Characteristic descriptor 0x00002902-0000-1000-8000-00805f9b34fb is handle 0x33
INFO:pygatt.backends.bgapi.bgapi:Characteristic 0x273e000e-4c4d-454d-96be-f03bac821358 is handle 0x35
INFO:pygatt.backends.bgapi.bgapi:Characteristic descriptor 0x00002902-0000-1000-8000-00805f9b34fb is handle 0x36
INFO:pygatt.backends.bgapi.bgapi:Characteristic 0x273e000f-4c4d-454d-96be-f03bac821358 is handle 0x38
INFO:pygatt.backends.bgapi.bgapi:Characteristic descriptor 0x00002902-0000-1000-8000-00805f9b34fb is handle 0x39
INFO:pygatt.backends.bgapi.bgapi:Characteristic 0x273e0010-4c4d-454d-96be-f03bac821358 is handle 0x3b
INFO:pygatt.backends.bgapi.bgapi:Characteristic descriptor 0x00002902-0000-1000-8000-00805f9b34fb is handle 0x3c
INFO:pygatt.backends.bgapi.bgapi:Characteristic 0x273e0011-4c4d-454d-96be-f03bac821358 is handle 0x3e
INFO:pygatt.backends.bgapi.bgapi:Characteristic descriptor 0x00002902-0000-1000-8000-00805f9b34fb is handle 0x3f
DEBUG:pygatt.device:Found <Characteristic uuid=273e0001-4c4d-454d-96be-f03bac821358 handle=14>
DEBUG:pygatt.backends.bgapi.bgapi:Expecting a response of one of [<ResponsePacketType.attclient_attribute_write: 43>] within 1.000000s
DEBUG:pygatt.backends.bgapi.bgapi:Received a ResponsePacketType.attclient_attribute_write packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Expecting a response of one of [<EventPacketType.attclient_procedure_completed: 17>] within 30.000000s
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_procedure_completed packet: Success
INFO:pygatt.device:Subscribed to uuid=273e0001-4c4d-454d-96be-f03bac821358
DEBUG:pygatt.device:Looking up handle for characteristic 273e0001-4c4d-454d-96be-f03bac821358
DEBUG:pygatt.device:Found <Characteristic uuid=273e0001-4c4d-454d-96be-f03bac821358 handle=14>
DEBUG:pygatt.backends.bgapi.bgapi:Expecting a response of one of [<ResponsePacketType.attclient_attribute_write: 43>] within 1.000000s
DEBUG:pygatt.backends.bgapi.bgapi:Received a ResponsePacketType.attclient_attribute_write packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Expecting a response of one of [<EventPacketType.attclient_procedure_completed: 17>] within 30.000000s
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_procedure_completed packet: Write not permitted
DEBUG:pygatt.device:Looking up handle for characteristic 273e0001-4c4d-454d-96be-f03bac821358
DEBUG:pygatt.device:Found <Characteristic uuid=273e0001-4c4d-454d-96be-f03bac821358 handle=14>
DEBUG:pygatt.backends.bgapi.bgapi:Expecting a response of one of [<ResponsePacketType.attclient_attribute_write: 43>] within 1.000000s
DEBUG:pygatt.backends.bgapi.bgapi:Received a ResponsePacketType.attclient_attribute_write packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Expecting a response of one of [<EventPacketType.attclient_procedure_completed: 17>] within 30.000000s
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_procedure_completed packet: Write not permitted
DEBUG:pygatt.device:Looking up handle for characteristic 273e0001-4c4d-454d-96be-f03bac821358
DEBUG:pygatt.device:Found <Characteristic uuid=273e0001-4c4d-454d-96be-f03bac821358 handle=14>
DEBUG:pygatt.backends.bgapi.bgapi:Expecting a response of one of [<ResponsePacketType.attclient_attribute_write: 43>] within 1.000000s
DEBUG:pygatt.backends.bgapi.bgapi:Received a ResponsePacketType.attclient_attribute_write packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Expecting a response of one of [<EventPacketType.attclient_procedure_completed: 17>] within 30.000000s
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.attclient_procedure_completed packet: Write not permitted
DEBUG:pygatt.device:Looking up handle for characteristic 273e0003-4c4d-454d-96be-f03bac821358
DEBUG:pygatt.device:Found <Characteristic uuid=273e0003-4c4d-454d-96be-f03bac821358 handle=32>
DEBUG:pygatt.backends.bgapi.bgapi:Expecting a response of one of [<ResponsePacketType.attclient_attribute_write: 43>] within 1.000000s
DEBUG:pygatt.backends.bgapi.bgapi:Received a EventPacketType.connection_disconnected packet: Success
DEBUG:pygatt.backends.bgapi.bgapi:Received a ResponsePacketType.attclient_attribute_write packet: Not connected
DEBUG:pygatt.backends.bgapi.bgapi:Expecting a response of one of [<EventPacketType.attclient_procedure_completed: 17>] within 30.000000s
Adapter stopped
INFO:pygatt.backends.bgapi.bgapi:Stopping
INFO:pygatt.backends.bgapi.bgapi:Stopping receiver
I'm not sure if I'm interpreting this information correctly, but it seems as if the subscription is working and that I'm receiving information but the callback is not being fired?
I tried the solution here: pygatt: Unable to execute device.subscribe() by adding the time.sleep() lines to my code, but the output did not change.
How can I translate my bleak program to pygatt and subscribe successfully using pygatt?

Related

Activating and using on board Bluetooth on orange pi

I am using an orange pi to connect to BLE devices, and I would like to use the on board ble interface, I am using OPI3 LTS OS: Orange Pi Focal with Linux 5.10.75-sunxi64
when I run sudo hciconfig -a I can see devices available:
hci1: Type: Primary Bus: UART
BD Address: 10:11:12:13:14:15 ACL MTU: 1021:8 SCO MTU: 240:3
UP RUNNING PSCAN
RX bytes:213806 acl:0 sco:0 events:12843 errors:0
TX bytes:689392 acl:0 sco:0 commands:12843 errors:0
Features: 0xbf 0xff 0x8d 0xfe 0xdb 0x3d 0x7b 0xc7
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy:
Link mode: SLAVE ACCEPT
Name: 'orangepi3-lts'
Class: 0x000000
Service Classes: Unspecified
Device Class: Miscellaneous,
HCI Version: 5.0 (0x9) Revision: 0x400
LMP Version: 5.0 (0x9) Subversion: 0x400
Manufacturer: Spreadtrum Communications Shanghai Ltd (492)
hci0: Type: Primary Bus: USB
BD Address: 00:1A:7D:DA:71:13 ACL MTU: 310:10 SCO MTU: 64:8
DOWN
RX bytes:184866998 acl:8964 sco:0 events:5069260 errors:0
TX bytes:1669130 acl:9985 sco:0 commands:96182 errors:16
Features: 0xff 0xff 0x8f 0xfe 0xdb 0xff 0x5b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF PARK
Link mode: SLAVE ACCEPT
The on board ble interface is hci1, so I shutdown my dongle hci0 and when I try doing a scan using bluetoothctl, I get this error Failed to start discovery: org.bluez.Error.NotReady
I can use the hci0 to do scan though and connect to devices when I bring it up and running, but not on board hci1.

Query a database of MongoDB from terminal: [MongoError]: failed to connect to server

I have a web application and a database of MongoDB. Now, I just want to write scripts to query the database from terminal. I have written the following code.
const userModel = require('../models/Users');
const mongoose = require('mongoose');
const CONN = 'mongodb://tie:<password>#178.62.87.72:27017/news'
const option = {
socketTimeoutMS: 30000,
keepAlive: true,
reconnectTries: 30000,
// useNewUrlParser: true
};
mongoose.connect(CONN, option);
mongoose.connection.on('connected', async function () {
console.log('Database connected: ' + CONN);
try {
let x = await userModel.user.find({ "_id": "5a95bbc0763e1f4bad37b864" }).lean()
console.log(x)
mongoose.connection.close()
console.log("done");
} catch (error) {
console.log(error);
}
});
mongoose.connection.on('disconnected', function () {
console.log('Database disconnected:' + CONN);
});
Then, node kpi.js in the terminal returned an error:
events.js:200
throw er; // Unhandled 'error' event
^
Error [MongoError]: failed to connect to server [178.62.87.72:27017] on first connect [Error: connect ECONNREFUSED 178.62.87.72:27017
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1134:16) {
name: 'MongoError',
message: 'connect ECONNREFUSED 178.62.87.72:27017'
}]
at Pool.<anonymous> (/Users/chengtie/Startup/PRODSERVER/From202005/funfun/node_modules/mongodb-core/lib/topologies/server.js:336:35)
at Pool.emit (events.js:223:5)
at Connection.<anonymous> (/Users/chengtie/Startup/PRODSERVER/From202005/funfun/node_modules/mongodb-core/lib/connection/pool.js:280:12)
at Object.onceWrapper (events.js:313:26)
at Connection.emit (events.js:223:5)
at Socket.<anonymous> (/Users/chengtie/Startup/PRODSERVER/From202005/funfun/node_modules/mongodb-core/lib/connection/connection.js:189:49)
at Object.onceWrapper (events.js:313:26)
at Socket.emit (events.js:223:5)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:81:21)
Emitted 'error' event on NativeConnection instance at:
at Immediate.<anonymous> (/Users/chengtie/Startup/PRODSERVER/From202005/funfun/node_modules/mongoose/lib/connection.js:325:19)
at processImmediate (internal/timers.js:439:21) {
name: 'MongoError',
message: 'failed to connect to server [178.62.87.72:27017] on first connect [Error: connect ECONNREFUSED 178.62.87.72:27017\n' +
' at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1134:16) {\n' +
" name: 'MongoError',\n" +
" message: 'connect ECONNREFUSED 178.62.87.72:27017'\n" +
'}]'
}
Does anyone know how to solve this? Do I need to use for example MongoClient?
PS: I'm able to query the database by Robo 3T with the following settings:
Edit 1: ssh tie#178.62.87.72 -nNT -v -L 27014:localhost:27017 returned:
(base) Ties-MBP:kpi chengtie$ ssh tie#178.62.87.72 -nNT -v -L 27014:localhost:27017
OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to 178.62.87.72 [178.62.87.72] port 22.
debug1: Connection established.
debug1: identity file /Users/chengtie/.ssh/id_rsa type 0
debug1: identity file /Users/chengtie/.ssh/id_rsa-cert type -1
debug1: identity file /Users/chengtie/.ssh/id_dsa type -1
debug1: identity file /Users/chengtie/.ssh/id_dsa-cert type -1
debug1: identity file /Users/chengtie/.ssh/id_ecdsa type -1
debug1: identity file /Users/chengtie/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/chengtie/.ssh/id_ed25519 type -1
debug1: identity file /Users/chengtie/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/chengtie/.ssh/id_xmss type -1
debug1: identity file /Users/chengtie/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.13
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.13 pat OpenSSH_6.6.1* compat 0x04000002
debug1: Authenticating to 178.62.87.72:22 as 'tie'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256#libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305#openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305#openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:z8rrvKqvVmSxKFlCnb49HwUTQ/ABB9DUi9A3DUIpKtI
debug1: Host '178.62.87.72' is known and matches the ECDSA host key.
debug1: Found key in /Users/chengtie/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: Will attempt key: /Users/chengtie/.ssh/id_rsa RSA SHA256:EL7hm5LvdVADZiv662nneDEeoLKy+etj8OT61eugu4Y
debug1: Will attempt key: /Users/chengtie/.ssh/id_dsa
debug1: Will attempt key: /Users/chengtie/.ssh/id_ecdsa
debug1: Will attempt key: /Users/chengtie/.ssh/id_ed25519
debug1: Will attempt key: /Users/chengtie/.ssh/id_xmss
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/chengtie/.ssh/id_rsa RSA SHA256:EL7hm5LvdVADZiv662nneDEeoLKy+etj8OT61eugu4Y
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /Users/chengtie/.ssh/id_dsa
debug1: Trying private key: /Users/chengtie/.ssh/id_ecdsa
debug1: Trying private key: /Users/chengtie/.ssh/id_ed25519
debug1: Trying private key: /Users/chengtie/.ssh/id_xmss
debug1: Next authentication method: password
tie#178.62.87.72's password:
debug1: Authentication succeeded (password).
Authenticated to 178.62.87.72 ([178.62.87.72]:22).
debug1: Local connections to LOCALHOST:27014 forwarded to remote address localhost:27017
debug1: Local forwarding listening on ::1 port 27014.
debug1: channel 0: new [port listener]
debug1: Local forwarding listening on 127.0.0.1 port 27014.
debug1: channel 1: new [port listener]
debug1: Requesting no-more-sessions#openssh.com
debug1: Entering interactive session.
debug1: pledge: network
Your code looks fine, and we also get a response from the server of ECONNREFUSED or in english connection refused. this can be caused from several different reasons. the most common is firewall / IP issue's (which is not your case as you manage to connect using robo3T).
If you look closely in the second image you post, the ssh tab you can see a box called Use SSH Tunnel marked. this is what you're missing to be able to connect from code.
Open a new terminal tab and run something like this:
ssh user#178.62.87.72 -L [LOCAL_PORT]:localhost:27017
Where LOCAL_PORT can be any open port on your localhost. This creates an open "tunnel" being your machines and the remote machine. and this is how Mongo can communicate with you.
Then change you're connection code to this:
const CONN = 'mongodb://127.0.0.1:LOCAL_PORT'
You can keep using 27017 as your LOCAL_PORT but usually people have a running local Mongo process on that port.

SSH times out while connecting via ipv6 but works with ipv4 [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
Yesterday I reinstalled my Ubuntu (for unrelated reasons) and since then ssh behaves very weirdly.
It takes suuuper long to connect (multiple minutes). Using -vvv I found that it first tries to connect using an ipv6 (which times out) and after that tries to connect via ipv4 which works almost instantly.
I never had any issues with ssh before.
running
ssh login#address.net -vvv
(with the address I want to connect to) returns
OpenSSH_8.2p1 Ubuntu-4, OpenSSL 1.1.1f 31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolving "address.net" port 22
debug2: ssh_connect_direct
debug1: Connecting to address.net [*:*:*:*::*] port 22.
debug1: connect to address *:*:*:*::* port 22: Connection timed out
debug1: Connecting to address.net [*.*.*.*] port 22.
debug1: Connection established.
debug1: identity file /home/malte/.ssh/id_rsa type 0
debug1: identity file /home/malte/.ssh/id_rsa-cert type -1
debug1: identity file /home/malte/.ssh/id_dsa type -1
debug1: identity file /home/malte/.ssh/id_dsa-cert type -1
debug1: identity file /home/malte/.ssh/id_ecdsa type -1
debug1: identity file /home/malte/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/malte/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/malte/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/malte/.ssh/id_ed25519 type -1
debug1: identity file /home/malte/.ssh/id_ed25519-cert type -1
debug1: identity file /home/malte/.ssh/id_ed25519_sk type -1
debug1: identity file /home/malte/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/malte/.ssh/id_xmss type -1
debug1: identity file /home/malte/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2p1 Ubuntu-4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: match: OpenSSH_7.6p1 Ubuntu-4ubuntu0.3 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to login.caps.in.tum.de:22 as 'ehren'
debug3: hostkeys_foreach: reading file "/home/malte/.ssh/known_hosts"
debug3: record_hostkey: found key type ED25519 in file /home/malte/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from login.caps.in.tum.de
debug3: order_hostkeyalgs: prefer hostkeyalgs: ssh-ed25519-cert-v01#openssh.com,ssh-ed25519
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256#libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c
debug2: host key algorithms: ssh-ed25519-cert-v01#openssh.com,ssh-ed25519,ecdsa-sha2-nistp256-cert-v01#openssh.com,ecdsa-sha2-nistp384-cert-v01#openssh.com,ecdsa-sha2-nistp521-cert-v01#openssh.com,sk-ecdsa-sha2-nistp256-cert-v01#openssh.com,sk-ssh-ed25519-cert-v01#openssh.com,rsa-sha2-512-cert-v01#openssh.com,rsa-sha2-256-cert-v01#openssh.com,ssh-rsa-cert-v01#openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256#openssh.com,sk-ssh-ed25519#openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: chacha20-poly1305#openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm#openssh.com,aes256-gcm#openssh.com
debug2: ciphers stoc: chacha20-poly1305#openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm#openssh.com,aes256-gcm#openssh.com
debug2: MACs ctos: umac-64-etm#openssh.com,umac-128-etm#openssh.com,hmac-sha2-256-etm#openssh.com,hmac-sha2-512-etm#openssh.com,hmac-sha1-etm#openssh.com,umac-64#openssh.com,umac-128#openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm#openssh.com,umac-128-etm#openssh.com,hmac-sha2-256-etm#openssh.com,hmac-sha2-512-etm#openssh.com,hmac-sha1-etm#openssh.com,umac-64#openssh.com,umac-128#openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib#openssh.com,zlib
debug2: compression stoc: none,zlib#openssh.com,zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256#libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
debug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519,ssh-ed25519-cert-v01#openssh.com
debug2: ciphers ctos: chacha20-poly1305#openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm#openssh.com,aes256-gcm#openssh.com
debug2: ciphers stoc: chacha20-poly1305#openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm#openssh.com,aes256-gcm#openssh.com
debug2: MACs ctos: umac-64-etm#openssh.com,umac-128-etm#openssh.com,hmac-sha2-256-etm#openssh.com,hmac-sha2-512-etm#openssh.com,hmac-sha1-etm#openssh.com,umac-64#openssh.com,umac-128#openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm#openssh.com,umac-128-etm#openssh.com,hmac-sha2-256-etm#openssh.com,hmac-sha2-512-etm#openssh.com,hmac-sha1-etm#openssh.com,umac-64#openssh.com,umac-128#openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib#openssh.com
debug2: compression stoc: none,zlib#openssh.com
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519-cert-v01#openssh.com
debug1: kex: server->client cipher: chacha20-poly1305#openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305#openssh.com MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host certificate: ssh-ed25519-cert-v01#openssh.com SHA256:3rfJzCTfq9xb2UYjwCf+FLMo5s46IDcAeKWN4OEN9Qw, serial 0 ID "host:intum:vmschulz30" CA ssh-ed25519 SHA256:xw6Z8D0o6klmmOcnCzhqhTkitvGcjuuQ9JsunW4bvm8 valid forever
debug2: Server host certificate hostname: vmschulz30
debug2: Server host certificate hostname: vmschulz30.in.tum.de
debug3: hostkeys_foreach: reading file "/home/malte/.ssh/known_hosts"
debug3: record_hostkey: found key type ED25519 in file /home/malte/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from login.caps.in.tum.de
debug1: No matching CA found. Retry with plain key
debug1: Host 'login.caps.in.tum.de' is known and matches the ED25519 host key.
debug1: Found key in /home/malte/.ssh/known_hosts:1
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/malte/.ssh/id_rsa RSA SHA256:nmOOjBiUCmQEF8b08sB9LIwjSfwxA03cRStE6BrNe2g agent
debug1: Will attempt key: /home/malte/.ssh/id_dsa
debug1: Will attempt key: /home/malte/.ssh/id_ecdsa
debug1: Will attempt key: /home/malte/.ssh/id_ecdsa_sk
debug1: Will attempt key: /home/malte/.ssh/id_ed25519
debug1: Will attempt key: /home/malte/.ssh/id_ed25519_sk
debug1: Will attempt key: /home/malte/.ssh/id_xmss
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/malte/.ssh/id_rsa RSA SHA256:nmOOjBiUCmQEF8b08sB9LIwjSfwxA03cRStE6BrNe2g agent
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/malte/.ssh/id_dsa
debug3: no such identity: /home/malte/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /home/malte/.ssh/id_ecdsa
debug3: no such identity: /home/malte/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /home/malte/.ssh/id_ecdsa_sk
debug3: no such identity: /home/malte/.ssh/id_ecdsa_sk: No such file or directory
debug1: Trying private key: /home/malte/.ssh/id_ed25519
debug3: no such identity: /home/malte/.ssh/id_ed25519: No such file or directory
debug1: Trying private key: /home/malte/.ssh/id_ed25519_sk
debug3: no such identity: /home/malte/.ssh/id_ed25519_sk: No such file or directory
debug1: Trying private key: /home/malte/.ssh/id_xmss
debug3: no such identity: /home/malte/.ssh/id_xmss: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
login#address.net's password:
debug3: send packet: type 50
debug2: we sent a password packet, wait for reply
debug3: receive packet: type 52
debug1: Authentication succeeded (password).
Authenticated to address.net ([*.*.*.*]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting no-more-sessions#openssh.com
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug3: receive packet: type 80
debug1: client_input_global_request: rtype hostkeys-00#openssh.com want_reply 0
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IP_TOS 0x10
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug3: send packet: type 98
debug1: Sending environment.
debug3: Ignored env SHELL
debug3: Ignored env SESSION_MANAGER
debug3: Ignored env QT_ACCESSIBILITY
debug3: Ignored env COLORTERM
debug3: Ignored env XDG_CONFIG_DIRS
debug3: Ignored env XDG_MENU_PREFIX
debug3: Ignored env GNOME_DESKTOP_SESSION_ID
debug3: Ignored env GTK_IM_MODULE
debug3: Ignored env QT4_IM_MODULE
debug1: Sending env LC_ADDRESS = de_DE.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env GNOME_SHELL_SESSION_MODE
debug1: Sending env LC_NAME = de_DE.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env SSH_AUTH_SOCK
debug3: Ignored env XMODIFIERS
debug3: Ignored env DESKTOP_SESSION
debug1: Sending env LC_MONETARY = de_DE.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env SSH_AGENT_PID
debug3: Ignored env GTK_MODULES
debug3: Ignored env PWD
debug3: Ignored env LOGNAME
debug3: Ignored env XDG_SESSION_DESKTOP
debug3: Ignored env XDG_SESSION_TYPE
debug3: Ignored env GPG_AGENT_INFO
debug3: Ignored env XAUTHORITY
debug3: Ignored env GJS_DEBUG_TOPICS
debug3: Ignored env WINDOWPATH
debug3: Ignored env HOME
debug3: Ignored env USERNAME
debug3: Ignored env IM_CONFIG_PHASE
debug1: Sending env LC_PAPER = de_DE.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug1: Sending env LANG = en_US.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env LS_COLORS
debug3: Ignored env XDG_CURRENT_DESKTOP
debug3: Ignored env VTE_VERSION
debug3: Ignored env GNOME_TERMINAL_SCREEN
debug3: Ignored env INVOCATION_ID
debug3: Ignored env MANAGERPID
debug3: Ignored env CLUTTER_IM_MODULE
debug3: Ignored env GJS_DEBUG_OUTPUT
debug3: Ignored env LESSCLOSE
debug3: Ignored env XDG_SESSION_CLASS
debug3: Ignored env TERM
debug1: Sending env LC_IDENTIFICATION = de_DE.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env LESSOPEN
debug3: Ignored env USER
debug3: Ignored env GNOME_TERMINAL_SERVICE
debug3: Ignored env DISPLAY
debug3: Ignored env SHLVL
debug1: Sending env LC_TELEPHONE = de_DE.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env QT_IM_MODULE
debug1: Sending env LC_MEASUREMENT = de_DE.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env XDG_RUNTIME_DIR
debug1: Sending env LC_TIME = de_DE.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env JOURNAL_STREAM
debug3: Ignored env XDG_DATA_DIRS
debug3: Ignored env PATH
debug3: Ignored env GDMSESSION
debug3: Ignored env DBUS_SESSION_BUS_ADDRESS
debug1: Sending env LC_NUMERIC = de_DE.UTF-8
debug2: channel 0: request env confirm 0
debug3: send packet: type 98
debug3: Ignored env OLDPWD
debug3: Ignored env _
debug2: channel 0: request shell confirm 1
debug3: send packet: type 98
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
annoyling this happens will all servers I try to connect to and also affects git (over ssh)
thanks in advance for any hints as to what the issue could be <3
The symptom suggests that after the reinstall there's a different ssh config; check /etc/ssh/ssh_config for AddressFamily set to any; you could set to inet there or privately in ~/.ssh/config

How do i find some text and symbols in string python 3.7

I need some help figuring out how to find TV (0) -> Broadcast (F): routing change (80)
From this lot....
Loaded CEC from /home/user/.local/lib/python2.7/site-packages/cec.so
Callback added
CEC has cec_adapter_descriptor
Initializing CEC library
CEC Log message: Broadcast (F): osd name set to 'Broadcast'
CEC Log message: connection opened, clearing any previous input and waiting for active transmissions to end before starting
CEC Log message: communication thread started
CEC Log message: turning controlled mode on
CEC Log message: communication thread ended
CEC Log message: connection opened
CEC Log message: GetPhysicalAddress - trying to get the physical address via ADL
CEC Log message: GetPhysicalAddress - ADL returned physical address 0000
CEC Log message: GetPhysicalAddress - trying to get the physical address via nvidia driver
CEC Log message: GetPhysicalAddress - nvidia driver returned physical address 0000
CEC Log message: GetPhysicalAddress - trying to get the physical address via drm files
CEC Log message: GetPhysicalAddress - drm files returned physical address 0000
CEC Log message: GetPhysicalAddress - trying to get the physical address from the OS
CEC Log message: GetPhysicalAddress - OS returned physical address 0000
CEC Log message: unregistering all CEC clients
CEC Log message: connection opened, clearing any previous input and waiting for active transmissions to end before starting
CEC Log message: communication thread started
CEC Log message: turning controlled mode on
CEC Log message: connection opened
CEC Log message: << Broadcast (F) -> TV (0): POLL
CEC Log message: << f0
CEC Log message: processor thread started
CEC Log message: setting the line timeout to 3
CEC Log message: >> POLL sent
CEC Log message: TV (0): device status changed into 'present'
CEC Log message: << requesting vendor ID of 'TV' (0)
CEC Log message: << f0:8c
CEC Log message: >> 0f:00:8c:04
Got event 4 with data ({'initiator': 0, 'parameters': '\x8c\x04', 'ack': True, 'opcode_set': True, 'destination': 15, 'eom': True, 'transmit_timeout': 1000, 'opcode': 0},)
CEC Log message: marking opcode 'give device vendor id' as unsupported feature for device 'TV'
CEC Log message: expected response received (87: device vendor id)
CEC Log message: registering new CEC client - v4.0.4
CEC Log message: detecting logical address for type 'recording device'
CEC Log message: trying logical address 'Recorder 1'
CEC Log message: << Recorder 1 (1) -> Recorder 1 (1): POLL
CEC Log message: << 11
CEC Log message: >> TV (0) -> Broadcast (F): feature abort ( 0)
CEC Log message: CEC transmission - received response - TRANSMIT_FAILED_ACK
CEC Log message: << 11
CEC Log message: CEC transmission - received response - TRANSMIT_FAILED_ACK
CEC Log message: >> POLL not sent
CEC Log message: using logical address 'Recorder 1'
CEC Log message: Recorder 1 (1): device status changed into 'handled by libCEC'
CEC Log message: Recorder 1 (1): power status changed from 'unknown' to 'on'
CEC Log message: Recorder 1 (1): vendor = Pulse Eight (001582)
CEC Log message: Recorder 1 (1): CEC version 1.4
CEC Log message: AllocateLogicalAddresses - device '0', type 'recording device', LA '1'
CEC Log message: setting ackmask to 2
CEC Log message: Recorder 1 (1): osd name set to 'python-cec'
CEC Log message: Recorder 1 (1): menu language set to 'eng'
CEC Log message: GetPhysicalAddress - trying to get the physical address via ADL
CEC Log message: GetPhysicalAddress - ADL returned physical address 0000
CEC Log message: GetPhysicalAddress - trying to get the physical address via nvidia driver
CEC Log message: GetPhysicalAddress - nvidia driver returned physical address 0000
CEC Log message: GetPhysicalAddress - trying to get the physical address via drm files
CEC Log message: GetPhysicalAddress - drm files returned physical address 0000
CEC Log message: GetPhysicalAddress - trying to get the physical address from the OS
CEC Log message: GetPhysicalAddress - OS returned physical address 0000
CEC Log message: setting HDMI port to 1 on device TV (0)
CEC Log message: Recorder 1 (1): physical address changed from ffff to 1000
CEC Log message: << Recorder 1 (1) -> broadcast (F): physical address 1000
CEC Log message: << 1f:84:10:00:01
CEC Log message: using persisted autonomous mode setting: 'enabled'
CEC Log message: using persisted CEC version setting: '1.4'
CEC Log message: using persisted logical address setting: 'Recorder 1'
CEC Log message: >> 01:46
CEC Log message: using persisted device type setting: 'recording device'
Got event 4 with data ({'initiator': 0, 'parameters': '', 'ack': False, 'opcode_set': True, 'destination': 1, 'eom': True, 'transmit_timeout': 1000, 'opcode': 70},)
CEC Log message: << Recorder 1 (1) -> TV (0): OSD name 'python-cec'
CEC Log message: << 10:47:70:79:74:68:6f:6e:2d:63:65:63
CEC Log message: >> TV (0) -> Recorder 1 (1): give osd name (46)
CEC Log message: using persisted logical address mask setting: '206'
CEC Log message: using persisted physical address setting: '1000'
CEC Log message: CEC client registered: libCEC version = 4.0.4, client version = 4.0.4, firmware version = 9, firmware build date: Fri Nov 2 10:08:56 2018 +0000, logical address(es) = Recorder 1 (1) , base device: TV (0), HDMI port number: 1, physical address: 1.0.0.0, compiled on Linux-4.4.0-161-generic ... , features: P8_USB, DRM, P8_detect, randr, Exynos, AOCEC
CEC Log message: << Recorder 1 (1) -> TV (0): OSD name 'python-cec'
CEC Log message: << 10:47:70:79:74:68:6f:6e:2d:63:65:63
CEC Log message: << requesting power status of 'TV' (0)
CEC Log message: << 10:8f
CEC Log message: RECEIVE_FAILED
Creating Device object for TV
CEC Log message: >> 01:90:00
Got event 4 with data ({'initiator': 0, 'parameters': '\x00', 'ack': False, 'opcode_set': True, 'destination': 1, 'eom': True, 'transmit_timeout': 1000, 'opcode': 144},)
CEC Log message: TV (0): power status changed from 'unknown' to 'on'
CEC Log message: expected response received (90: report power status)
CEC Log message: >> TV (0) -> Recorder 1 (1): report power status (90)
CEC Log message: >> 01:46
Got event 4 with data ({'initiator': 0, 'parameters': '', 'ack': False, 'opcode_set': True, 'destination': 1, 'eom': True, 'transmit_timeout': 1000, 'opcode': 70},)
CEC Log message: << Recorder 1 (1) -> TV (0): OSD name 'python-cec'
CEC Log message: << 10:47:70:79:74:68:6f:6e:2d:63:65:63
CEC Log message: >> TV (0) -> Recorder 1 (1): give osd name (46)
CEC Log message: >> 06
CEC Log message: << POLL: TV (0) -> Tuner 2 (6)
CEC Log message: >> 06
CEC Log message: << POLL: TV (0) -> Tuner 2 (6)
CEC Log message: >> 07
CEC Log message: << POLL: TV (0) -> Tuner 3 (7)
CEC Log message: >> 07
CEC Log message: << POLL: TV (0) -> Tuner 3 (7)
CEC Log message: >> 08
CEC Log message: << POLL: TV (0) -> Playback 2 (8)
CEC Log message: >> 08
CEC Log message: << POLL: TV (0) -> Playback 2 (8)
CEC Log message: >> 09
CEC Log message: << POLL: TV (0) -> Recorder 3 (9)
CEC Log message: >> 09
CEC Log message: << POLL: TV (0) -> Recorder 3 (9)
CEC Log message: >> 0f:80:30:00:30:00
Got event 4 with data ({'initiator': 0, 'parameters': '0\x000\x00', 'ack': True, 'opcode_set': True, 'destination': 15, 'eom': True, 'transmit_timeout': 1000, 'opcode': 128},)
CEC Log message: >> TV (0) -> Broadcast (F): routing change (80)
CEC Log message: >> 0f:86:30:00
Got event 4 with data ({'initiator': 0, 'parameters': '0\x00', 'ack': True, 'opcode_set': True, 'destination': 15, 'eom': True, 'transmit_timeout': 1000, 'opcode': 134},)
CEC Log message: >> TV (0) sets stream path to physical address 3000
CEC Log message: >> TV (0) -> Broadcast (F): set stream path (86)
CEC Log message: >> 0a
CEC Log message: << POLL: TV (0) -> Tuner 4 (a)
CEC Log message: >> 0a
CEC Log message: << POLL: TV (0) -> Tuner 4 (a)
CEC Log message: >> 0b
CEC Log message: << POLL: TV (0) -> Playback 3 (b)
CEC Log message: >> 0b
CEC Log message: << POLL: TV (0) -> Playback 3 (b)
CEC Log message: >> 0f:80:10:00:10:00
Got event 4 with data ({'initiator': 0, 'parameters': '\x10\x00\x10\x00', 'ack': True, 'opcode_set': True, 'destination': 15, 'eom': True, 'transmit_timeout': 1000, 'opcode': 128},)
CEC Log message: making Recorder 1 (1) the active source
CEC Log message: marking the adapter as active source
CEC Log message: >> TV (0) -> Broadcast (F): routing change (80)
CEC Log message: >> source activated: Recorder 1 (1)
Got event 64 with data (True, 1)
CEC Log message: sending active source message for 'Recorder 1'
CEC Log message: << requesting vendor ID of 'TV' (0)
CEC Log message: 'give device vendor id' is marked as unsupported feature for device 'TV'
CEC Log message: << powering on 'TV' (0)
CEC Log message: << 10:04
CEC Log message: << Recorder 1 (1) -> broadcast (F): active source (1000)
CEC Log message: << 1f:82:10:00
CEC Log message: << Recorder 1 (1) -> TV (0): menu state 'activated'
CEC Log message: << 10:8e:00
CEC Log message: >> 0f:86:10:00
Got event 4 with data ({'initiator': 0, 'parameters': '\x10\x00', 'ack': True, 'opcode_set': True, 'destination': 15, 'eom': True, 'transmit_timeout': 1000, 'opcode': 134},)
CEC Log message: >> TV (0) sets stream path to physical address 1000
CEC Log message: Recorder 1 (1) was already marked as active source
CEC Log message: >> source activated: Recorder 1 (1)
Got event 64 with data (True, 1)
CEC Log message: << Recorder 1 (1) -> broadcast (F): active source (1000)
CEC Log message: << 1f:82:10:00
CEC Log message: >> TV (0) -> Broadcast (F): set stream path (86)
CEC Log message: >> 01:46
Got event 4 with data ({'initiator': 0, 'parameters': '', 'ack': False, 'opcode_set': True, 'destination': 1, 'eom': True, 'transmit_timeout': 1000, 'opcode': 70},)
CEC Log message: << Recorder 1 (1) -> TV (0): OSD name 'python-cec'
CEC Log message: << 10:47:70:79:74:68:6f:6e:2d:63:65:63
CEC Log message: >> TV (0) -> Recorder 1 (1): give osd name (46)
CEC Log message: >> 01:8d:02
Got event 4 with data ({'initiator': 0, 'parameters': '\x02', 'ack': False, 'opcode_set': True, 'destination': 1, 'eom': True, 'transmit_timeout': 1000, 'opcode': 141},)
CEC Log message: << Recorder 1 (1) -> TV (0): menu state 'activated'
CEC Log message: << 10:8e:00
CEC Log message: >> TV (0) -> Recorder 1 (1): menu request (8D)
CEC Log message: >> 01:46
Got event 4 with data ({'initiator': 0, 'parameters': '', 'ack': False, 'opcode_set': True, 'destination': 1, 'eom': True, 'transmit_timeout': 1000, 'opcode': 70},)
CEC Log message: << Recorder 1 (1) -> TV (0): OSD name 'python-cec'
CEC Log message: << 10:47:70:79:74:68:6f:6e:2d:63:65:63
CEC Log message: >> TV (0) -> Recorder 1 (1): give osd name (46)
CEC Log message: >> 01:8d:02
Got event 4 with data ({'initiator': 0, 'parameters': '\x02', 'ack': False, 'opcode_set': True, 'destination': 1, 'eom': True, 'transmit_timeout': 1000, 'opcode': 141},)
CEC Log message: << Recorder 1 (1) -> TV (0): menu state 'activated'
CEC Log message: << 10:8e:00
CEC Log message: >> TV (0) -> Recorder 1 (1): menu request (8D)
^CTraceback (most recent call last):
File "/home/user/Documents/Python works/event-test.py", line 31, in <module>
while True:
KeyboardInterrupt
this is code snipped from my project.
def cb(event, *args):
print("Got event", event, "with data", args)
def log_cb(event, level, time, message):
print("CEC Log message:", message)
I made this but it doesn't work.
while True:
if "routing change(80)" in '$log_cb':
print("it worked ")
# if (cb == "___routing change(80) "):
# print("it worked ")
-------------------------------------------------- update -------------------------------------------------------------------
After Tom Robinson gave me a pointer in the right direction
here is the full code, the error i'm receiving is as he said but now I cannot fathom what arguments for event, level, time and message are needed
I've tried a few print commands to see if i can get the right info.
also tried if "routing change(80)" in log_cb(event, level, time, message): but get NameError: name 'event' is not defined
#!/usr/bin/env python
# Callback test; just to see if callbacks are working.
from __future__ import print_function
from time import sleep
import cec
print("Loaded CEC from", cec.__file__)
def cb(event, *args):
print("Got event", event, "with data", args)
# arguments: iils
def log_cb(event, level, time, message):
print("CEC Log message:", message)
cec.add_callback(cb, cec.EVENT_ALL & ~cec.EVENT_LOG)
cec.add_callback(log_cb, cec.EVENT_LOG)
print("Callback added")
sleep(2)
if cec.HAVE_CEC_ADAPTER_DESCRIPTOR:
print("CEC has cec_adapter_descriptor");
else:
print("CEC does not have cec_adapter_descriptor");
print("Initializing CEC library")
cec.init()
print("Creating Device object for TV")
while True:
# if "routing change(80)" in "log_cb":
if "routing change(80)" in log_cb():
print("it worked ")
And the new error:
Traceback (most recent call last):
File "/home/user/Documents/Python works/event-test.py", line 32, in <module>
if "routing change(80)" in log_cb():
TypeError: log_cb() takes exactly 4 arguments (0 given)
close failed in file object destructor:
sys.excepthook is missing
lost sys.stderr
Got event 4 with data ({'initiator': 0, 'parameters': '\x00', 'ack': False, 'opcode_set'
code update:
#!/usr/bin/env python
# Callback test; just to see if callbacks are working.
from __future__ import print_function
from time import sleep
import cec
print("Loaded CEC from", cec.__file__)
def cb(event, *args):
print("Got event", event, "with data", args)
# arguments: iils
def log_cb(event, level, time, message):
print("CEC Log message:", message)
if "routing change (80)" in message:
exit()
# print("it worked ")
# if (message == "routing change(80)"):
# exit()
cec.add_callback(cb, cec.EVENT_ALL & ~cec.EVENT_LOG)
cec.add_callback(log_cb, cec.EVENT_LOG)
print("Callback added")
sleep(2)
if cec.HAVE_CEC_ADAPTER_DESCRIPTOR:
print("CEC has cec_adapter_descriptor");
else:
print("CEC does not have cec_adapter_descriptor");
print("Initializing CEC library")
cec.init()
print("Creating Device object for TV")
print(cb)
print(log_cb)
#sleep(22)
while True:
pass
that while true is only there for testing as without it the script ends at line print(log_cb)
I'm running it from CLI
Log message:
Loaded CEC from /home/user/.local/lib/python2.7/site-packages/cec.so
Callback added
CEC has cec_adapter_descriptor
Initializing CEC library
CEC Log message: Broadcast (F): osd name set to 'Broadcast'
CEC Log message: connection opened, clearing any previous input and waiting for active transmissions to end before starting
CEC Log message: communication thread started
CEC Log message: turning controlled mode on
CEC Log message: communication thread ended
CEC Log message: connection opened
CEC Log message: GetPhysicalAddress - trying to get the physical address via ADL
CEC Log message: GetPhysicalAddress - ADL returned physical address 0000
CEC Log message: GetPhysicalAddress - trying to get the physical address via nvidia driver
CEC Log message: GetPhysicalAddress - nvidia driver returned physical address 0000
CEC Log message: GetPhysicalAddress - trying to get the physical address via drm files
CEC Log message: GetPhysicalAddress - drm files returned physical address 0000
CEC Log message: GetPhysicalAddress - trying to get the physical address from the OS
CEC Log message: GetPhysicalAddress - OS returned physical address 0000
CEC Log message: unregistering all CEC clients
CEC Log message: connection opened, clearing any previous input and waiting for active transmissions to end before starting
CEC Log message: communication thread started
CEC Log message: turning controlled mode on
CEC Log message: connection opened
CEC Log message: << Broadcast (F) -> TV (0): POLL
CEC Log message: << f0
CEC Log message: processor thread started
CEC Log message: setting the line timeout to 3
CEC Log message: >> POLL sent
CEC Log message: TV (0): device status changed into 'present'
CEC Log message: << requesting vendor ID of 'TV' (0)
CEC Log message: << f0:8c
CEC Log message: >> 0f:00:8c:04
Got event 4 with data ({'initiator': 0, 'parameters': '\x8c\x04', 'ack': True, 'opcode_set': True, 'destination': 15, 'eom': True, 'transmit_timeout': 1000, 'opcode': 0},)
CEC Log message: marking opcode 'give device vendor id' as unsupported feature for device 'TV'
CEC Log message: expected response received (87: device vendor id)
CEC Log message: registering new CEC client - v4.0.4
CEC Log message: detecting logical address for type 'recording device'
CEC Log message: trying logical address 'Recorder 1'
CEC Log message: << Recorder 1 (1) -> Recorder 1 (1): POLL
CEC Log message: << 11
CEC Log message: >> TV (0) -> Broadcast (F): feature abort ( 0)
CEC Log message: CEC transmission - received response - TRANSMIT_FAILED_ACK
CEC Log message: << 11
CEC Log message: CEC transmission - received response - TRANSMIT_FAILED_ACK
CEC Log message: >> POLL not sent
CEC Log message: using logical address 'Recorder 1'
CEC Log message: Recorder 1 (1): device status changed into 'handled by libCEC'
CEC Log message: Recorder 1 (1): power status changed from 'unknown' to 'on'
CEC Log message: Recorder 1 (1): vendor = Pulse Eight (001582)
CEC Log message: Recorder 1 (1): CEC version 1.4
CEC Log message: AllocateLogicalAddresses - device '0', type 'recording device', LA '1'
CEC Log message: setting ackmask to 2
CEC Log message: Recorder 1 (1): osd name set to 'python-cec'
CEC Log message: Recorder 1 (1): menu language set to 'eng'
CEC Log message: GetPhysicalAddress - trying to get the physical address via ADL
CEC Log message: GetPhysicalAddress - ADL returned physical address 0000
CEC Log message: GetPhysicalAddress - trying to get the physical address via nvidia driver
CEC Log message: GetPhysicalAddress - nvidia driver returned physical address 0000
CEC Log message: GetPhysicalAddress - trying to get the physical address via drm files
CEC Log message: GetPhysicalAddress - drm files returned physical address 0000
CEC Log message: GetPhysicalAddress - trying to get the physical address from the OS
CEC Log message: GetPhysicalAddress - OS returned physical address 0000
CEC Log message: setting HDMI port to 1 on device TV (0)
CEC Log message: Recorder 1 (1): physical address changed from ffff to 1000
CEC Log message: << Recorder 1 (1) -> broadcast (F): physical address 1000
CEC Log message: << 1f:84:10:00:01
CEC Log message: using persisted autonomous mode setting: 'enabled'
CEC Log message: using persisted CEC version setting: '1.4'
CEC Log message: using persisted logical address setting: 'Recorder 1'
CEC Log message: using persisted device type setting: 'recording device'
CEC Log message: >> 01:46
Got event 4 with data ({'initiator': 0, 'parameters': '', 'ack': False, 'opcode_set': True, 'destination': 1, 'eom': True, 'transmit_timeout': 1000, 'opcode': 70},)
CEC Log message: << Recorder 1 (1) -> TV (0): OSD name 'python-cec'
CEC Log message: >> TV (0) -> Recorder 1 (1): give osd name (46)
CEC Log message: << 10:47:70:79:74:68:6f:6e:2d:63:65:63
CEC Log message: using persisted logical address mask setting: '206'
CEC Log message: using persisted physical address setting: '1000'
CEC Log message: CEC client registered: libCEC version = 4.0.4, client version = 4.0.4, firmware version = 9, firmware build date: Fri Nov 2 10:08:56 2018 +0000, logical address(es) = Recorder 1 (1) , base device: TV (0), HDMI port number: 1, physical address: 1.0.0.0, compiled on Linux-4.4.0-161-generic ... , features: P8_USB, DRM, P8_detect, randr, Exynos, AOCEC
CEC Log message: << Recorder 1 (1) -> TV (0): OSD name 'python-cec'
CEC Log message: << 10:47:70:79:74:68:6f:6e:2d:63:65:63
CEC Log message: << requesting power status of 'TV' (0)
CEC Log message: << 10:8f
CEC Log message: RECEIVE_FAILED
CEC Log message: >> 01:90:00Creating Device object for TV
Got event 4<function cb at 0x7f61ce15e2d0>
with data ({'initiator': 0, 'parameters': '\x00', 'ack': False, 'opcode_set': True, 'destination': 1, 'eom': True, 'transmit_timeout': 1000, 'opcode': 144},)
CEC Log message: TV (0): power status changed from 'unknown' to 'on'
CEC Log message: expected response received (90: report power status)
CEC Log message: >> TV (0) -> Recorder 1 (1): report power status (90)
<function log_cb at 0x7f61ce15e250>
CEC Log message: >> 01:46
Got event 4 with data ({'initiator': 0, 'parameters': '', 'ack': False, 'opcode_set': True, 'destination': 1, 'eom': True, 'transmit_timeout': 1000, 'opcode': 70},)
CEC Log message: << Recorder 1 (1) -> TV (0): OSD name 'python-cec'
CEC Log message: << 10:47:70:79:74:68:6f:6e:2d:63:65:63
CEC Log message: >> TV (0) -> Recorder 1 (1): give osd name (46)
CEC Log message: >> 0e
CEC Log message: << POLL: TV (0) -> Free use (e)
CEC Log message: >> 0e
CEC Log message: << POLL: TV (0) -> Free use (e)
CEC Log message: >> 0f:80:30:00:30:00
Got event 4 with data ({'initiator': 0, 'parameters': '0\x000\x00', 'ack': True, 'opcode_set': True, 'destination': 15, 'eom': True, 'transmit_timeout': 1000, 'opcode': 128},)
CEC Log message: >> TV (0) -> Broadcast (F): routing change (80)
CEC Log message: >> 0f:86:30:00
Got event 4 with data ({'initiator': 0, 'parameters': '0\x00', 'ack': True, 'opcode_set': True, 'destination': 15, 'eom': True, 'transmit_timeout': 1000, 'opcode': 134},)
CEC Log message: >> TV (0) sets stream path to physical address 3000
CEC Log message: >> TV (0) -> Broadcast (F): set stream path (86)
CEC Log message: >> 01
CEC Log message: << POLL: TV (0) -> Recorder 1 (1)
CEC Log message: >> 0f:80:10:00:10:00
Got event 4 with data ({'initiator': 0, 'parameters': '\x10\x00\x10\x00', 'ack': True, 'opcode_set': True, 'destination': 15, 'eom': True, 'transmit_timeout': 1000, 'opcode': 128},)
CEC Log message: making Recorder 1 (1) the active source
CEC Log message: marking the adapter as active source
CEC Log message: >> TV (0) -> Broadcast (F): routing change (80)
CEC Log message: >> source activated: Recorder 1 (1)
Got event 64 with data (True, 1)
CEC Log message: sending active source message for 'Recorder 1'
CEC Log message: << requesting vendor ID of 'TV' (0)
CEC Log message: 'give device vendor id' is marked as unsupported feature for device 'TV'
CEC Log message: << powering on 'TV' (0)
CEC Log message: << 10:04
CEC Log message: << Recorder 1 (1) -> broadcast (F): active source (1000)
CEC Log message: << 1f:82:10:00
CEC Log message: << Recorder 1 (1) -> TV (0): menu state 'activated'
CEC Log message: << 10:8e:00
CEC Log message: >> 0f:86:10:00
Got event 4 with data ({'initiator': 0, 'parameters': '\x10\x00', 'ack': True, 'opcode_set': True, 'destination': 15, 'eom': True, 'transmit_timeout': 1000, 'opcode': 134},)
CEC Log message: >> TV (0) sets stream path to physical address 1000
CEC Log message: Recorder 1 (1) was already marked as active source
CEC Log message: >> source activated: Recorder 1 (1)
Got event 64 with data (True, 1)
CEC Log message: << Recorder 1 (1) -> broadcast (F): active source (1000)
CEC Log message: << 1f:82:10:00
CEC Log message: >> TV (0) -> Broadcast (F): set stream path (86)
CEC Log message: >> 01:46
Got event 4 with data ({'initiator': 0, 'parameters': '', 'ack': False, 'opcode_set': True, 'destination': 1, 'eom': True, 'transmit_timeout': 1000, 'opcode': 70},)
CEC Log message: << Recorder 1 (1) -> TV (0): OSD name 'python-cec'
CEC Log message: << 10:47:70:79:74:68:6f:6e:2d:63:65:63
CEC Log message: >> TV (0) -> Recorder 1 (1): give osd name (46)
CEC Log message: >> 01:8d:02
Got event 4 with data ({'initiator': 0, 'parameters': '\x02', 'ack': False, 'opcode_set': True, 'destination': 1, 'eom': True, 'transmit_timeout': 1000, 'opcode': 141},)
CEC Log message: << Recorder 1 (1) -> TV (0): menu state 'activated'
CEC Log message: << 10:8e:00
CEC Log message: >> TV (0) -> Recorder 1 (1): menu request (8D)
CEC Log message: >> 01:46
Got event 4 with data ({'initiator': 0, 'parameters': '', 'ack': False, 'opcode_set': True, 'destination': 1, 'eom': True, 'transmit_timeout': 1000, 'opcode': 70},)
CEC Log message: << Recorder 1 (1) -> TV (0): OSD name 'python-cec'
CEC Log message: << 10:47:70:79:74:68:6f:6e:2d:63:65:63
CEC Log message: >> TV (0) -> Recorder 1 (1): give osd name (46)
CEC Log message: >> 01:8d:02
Got event 4 with data ({'initiator': 0, 'parameters': '\x02', 'ack': False, 'opcode_set': True, 'destination': 1, 'eom': True, 'transmit_timeout': 1000, 'opcode': 141},)
CEC Log message: << Recorder 1 (1) -> TV (0): menu state 'activated'
CEC Log message: << 10:8e:00
CEC Log message: >> TV (0) -> Recorder 1 (1): menu request (8D)
CEC Log message: >> 03
CEC Log message: << POLL: TV (0) -> Tuner 1 (3)
CEC Log message: >> 03
CEC Log message: << POLL: TV (0) -> Tuner 1 (3)
CEC Log message: >> 04
CEC Log message: << POLL: TV (0) -> Playback 1 (4)
^CTraceback (most recent call last):
File "/home/user/Documents/Python works/event-test.py", line 42, in <module>
while True:
KeyboardInterrupt
It should stop as soon as it sees the request change but it doesn't. arrrrggg
last update I tried a few different things after someone suggested print(message)so I tried this but I think the 0f:86:30:00 needs to be written in different format and have no idea how to to do that.
def log_cb(event, level, time, message):
print("CEC Log message:", message)
print(message)
if '0f:86:30:00' in message:
exit()
log message snipped with few lines ether side of the event :
CEC Log message: << POLL: TV (0) -> Recorder 2 (2)
CEC Log message: >> 0f:80:30:00:30:00
Got event 4 with data ({'initiator': 0, 'parameters': '0\x000\x00', 'ack': True, 'opcode_set': True, 'destination': 15, 'eom': True, 'transmit_timeout': 1000, 'opcode': 128},)
CEC Log message: >> TV (0) -> Broadcast (F): routing change (80)
CEC Log message: >> 0f:86:30:00
Got event 4 with data ({'initiator': 0, 'parameters': '0\x00', 'ack': True, 'opcode_set': True, 'destination': 15, 'eom': True, 'transmit_timeout': 1000, 'opcode': 134},)
CEC Log message: >> TV (0) sets stream path to physical address 3000
log_cb is a callback you provide to the cec module with cec.add_callback(log_cb, cec.EVENT_LOG). This is clearly a logging handler that cec calls automatically on certain events; it's not something that makes sense for you to call yourself. This handler seems working since you've shown the output from its print statement.
message contains the substring you're interested in, so move your substring check into log_cb and get rid of the while True: block which will (probably) freeze your program (I'm not familiar with the cec library, but it seems like the wrong way to keep the program alive to poll for events and I don't see it mentioned in the docs):
def log_cb(event, level, time, message):
print("CEC Log message:", message)
if "routing change (80)" in message:
print("routing change (80) was in the message")
Note that the line if "routing change (80)" in '$log_cb': is nonsensical because it's always false. '$log_cb' is a string literal, not a variable holding a value like you may think.
In your updated code:
if (message == "routing change(80)"):
There are two problems:
The real substring in the log you posted is "routing change (80)", not "routing change(80)" (the space matters).
message == "routing change (80)" is not the correct logic and will likely never be true based on the log you showed. "routing change (80)" in message is the correct logic because it checks whether the desired string is a substring of message rather than an exact match.
Your code is checking if "routing change(80)" is a substring of the string "$log_cb". If you are intending to run the function log_cb, you need to call it using log_cb():
while True:
if "routing change(80)" in log_cb():
print("it worked ")
You will need to pass arguments for event, level, time and message, otherwise you will get a TypeError
Hope this helps!

Chromecast Custom Receiver JPG loading

I am not able to cast a simple JPG or PNG file to chromecast device.
I keep getting the error message
[cast.receiver.MediaManager] Load metadata error
I even tried it with Google's examples "sample_media_receiver.html" and "web_sender_tool.html", but without success.
Video files like MP4 or even HLS work fine, but not an simple image. Altough in the default receiver the images are working, but not in the custom receiver.
I tried with different values of metadata and without any metadata - nothing helps.
Here is the log of the chromecast console (with working MP4 and not working JPG):
### Application Loaded. Starting system. sample_media_receiver.html:605
[ 0.285s] [cast.receiver.IpcChannel] Opening message bus websocket
cast_receiver.js:19
[ 0.297s] [goog.net.WebSocket] Opening the WebSocket on ws://localhost:8008/v2/ipc
cast_receiver.js:19
[ 0.369s] [goog.net.WebSocket] WebSocket opened on ws://localhost:8008/v2/ipc
cast_receiver.js:19
[ 0.380s] [cast.receiver.IpcChannel] IpcChannel opened
cast_receiver.js:19
[ 0.393s] [cast.receiver.CastMessageBus] Dispatching CastMessageBus message [urn:x-cast:com.google.cast.system, SystemSender]: {"type":"opened"}
cast_receiver.js:19
[ 0.408s] [cast.receiver.CastReceiverManager] CastReceiverManager message received: [object Object]
cast_receiver.js:19
[ 0.410s] [cast.receiver.CastReceiverManager] Underlying message bus is open
cast_receiver.js:19
[ 0.413s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.system","senderId":"SystemSender","data":"{\"type\":\"ready\",\"statusText\":\"Ready to play\",\"activeNamespaces\":[\"urn:x-cast:com.google.devrel.custom\",\"urn:x-cast:com.google.cast.media\"],\"version\":\"2.0.0\",\"messagesVersion\":\"1.0\"}"}
cast_receiver.js:19
[ 0.421s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.system","senderId":"SystemSender","data":"{\"type\":\"startheartbeat\",\"maxInactivity\":6000}"}
cast_receiver.js:19
[ 0.440s] [cast.receiver.IpcChannel] Received message: {"data":"{\"applicationId\":\"XXXXXXX\",\"applicationName\":\"MDTest\",\"launchingSenderId\":\"8:client-68103\",\"messagesVersion\":\"1.0\",\"sessionId\":\"2A80FF6F-F9B2-4D78-D99A-997CF6FC2F69\",\"type\":\"ready\",\"version\":\"1.0\"}","namespace":"urn:x-cast:com.google.cast.system","senderId":"SystemSender"}
cast_receiver.js:19
[ 0.443s] [cast.receiver.CastMessageBus] Dispatching CastMessageBus message [urn:x-cast:com.google.cast.system, SystemSender]: {"applicationId":"XXXXXXXX","applicationName":"MDTest","launchingSenderId":"8:client-68103","messagesVersion":"1.0","sessionId":"2A80FF6F-F9B2-4D78-D99A-997CF6FC2F69","type":"ready","version":"1.0"}
cast_receiver.js:19
[ 0.446s] [cast.receiver.CastReceiverManager] CastReceiverManager message received: [object Object]
cast_receiver.js:19
[ 0.448s] [cast.receiver.CastReceiverManager] Dispatching CastReceiverManager system ready event [[object Object]]
cast_receiver.js:19
### Cast Receiver Manager is READY: sample_media_receiver.html:204
[ 0.567s] [cast.receiver.IpcChannel] Received message: {"data":"{\"senderId\":\"8:client-68103\",\"type\":\"senderconnected\",\"userAgent\":\"\"}","namespace":"urn:x-cast:com.google.cast.system","senderId":"SystemSender"}
cast_receiver.js:19
[ 0.570s] [cast.receiver.CastMessageBus] Dispatching CastMessageBus message [urn:x-cast:com.google.cast.system, SystemSender]: {"senderId":"8:client-68103","type":"senderconnected","userAgent":""}
cast_receiver.js:19
[ 0.572s] [cast.receiver.CastReceiverManager] CastReceiverManager message received: [object Object]
cast_receiver.js:19
[ 0.574s] [cast.receiver.CastReceiverManager] Dispatching CastReceiverManager sender connected event [8:client-68103]
cast_receiver.js:19
[ 0.576s] [cast.receiver.CastMessageBus] Registering sender [urn:x-cast:com.google.devrel.custom, 8:client-68103]
cast_receiver.js:19
[ 0.578s] [cast.receiver.CastMessageBus] Registering sender [urn:x-cast:com.google.cast.media, 8:client-68103]
cast_receiver.js:19
### Cast Receiver Manager - Sender Connected : sample_media_receiver.html:217
[ 17.252s] [cast.receiver.IpcChannel] Received message: {"data":"{\"type\":\"LOAD\",\"requestId\":28532030,\"sessionId\":\"2A80FF6F-F9B2-4D78-D99A-997CF6FC2F69\",\"media\":{\"contentId\":\"http://192.168.0.103/~marco/cast/video0.mp4\",\"streamType\":\"buffered\",\"contentType\":\"video/mp4\",\"metadata\":null,\"duration\":null,\"customData\":null},\"autoplay\":true,\"currentTime\":null,\"customData\":null}","namespace":"urn:x-cast:com.google.cast.media","senderId":"8:client-68103"}
cast_receiver.js:19
[ 17.255s] [cast.receiver.CastMessageBus] Dispatching CastMessageBus message [urn:x-cast:com.google.cast.media, 8:client-68103]: {"type":"LOAD","requestId":28532030,"sessionId":"2A80FF6F-F9B2-4D78-D99A-997CF6FC2F69","media":{"contentId":"http://192.168.0.103/~marco/cast/video0.mp4","streamType":"buffered","contentType":"video/mp4","metadata":null,"duration":null,"customData":null},"autoplay":true,"currentTime":null,"customData":null}
cast_receiver.js:19
[ 17.258s] [cast.receiver.MediaManager] MediaManager message received [8:client-68103] {"type":"LOAD","requestId":28532030,"sessionId":"2A80FF6F-F9B2-4D78-D99A-997CF6FC2F69","media":{"contentId":"http://192.168.0.103/~marco/cast/video0.mp4","streamType":"buffered","contentType":"video/mp4","metadata":null,"duration":null,"customData":null},"autoplay":true,"currentTime":null,"customData":null}
cast_receiver.js:19
[ 17.259s] [cast.receiver.MediaManager] Dispatching MediaManager load event
cast_receiver.js:19
### Media Manager - LOAD: {"type":"load","B":false,"defaultPrevented":false,"Qa":true,"data":{"requestId":28532030,"sessionId":"2A80FF6F-F9B2-4D78-D99A-997CF6FC2F69","media":{"contentId":"http://192.168.0.103/~marco/cast/video0.mp4","streamType":"buffered","contentType":"video/mp4","metadata":null,"duration":null,"customData":null},"autoplay":true,"currentTime":null,"customData":null},"senderId":"8:client-68103"} sample_media_receiver.html:549
### Media Protocol Identified as mp4 sample_media_receiver.html:588
######### MEDIA ELEMENT LOAD START sample_media_receiver.html:121
[ 18.270s] [cast.receiver.MediaManager] Metadata loaded
cast_receiver.js:19
[ 18.286s] [cast.receiver.MediaManager] Sending broadcast status message
cast_receiver.js:19
[ 18.300s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.media","senderId":"*:*","data":"{\"type\":\"MEDIA_STATUS\",\"status\":[{\"mediaSessionId\":1,\"playbackRate\":1,\"playerState\":\"BUFFERING\",\"currentTime\":0,\"supportedMediaCommands\":15,\"volume\":{\"level\":1,\"muted\":false},\"media\":{\"contentId\":\"http://192.168.0.103/~marco/cast/video0.mp4\",\"streamType\":\"buffered\",\"contentType\":\"video/mp4\",\"metadata\":null,\"duration\":8.057324,\"customData\":null}}],\"requestId\":28532030}"}
cast_receiver.js:19
######### MEDIA ELEMENT DATA LOADED sample_media_receiver.html:125
######### MEDIA ELEMENT CAN PLAY sample_media_receiver.html:129
######### MEDIA ELEMENT PLAYING sample_media_receiver.html:137
[ 20.625s] [cast.receiver.MediaManager] Buffering state changed, isPlayerBuffering: false old time: 0.083322 current time: 1.125
cast_receiver.js:19
[ 20.627s] [cast.receiver.MediaManager] Sending broadcast status message
cast_receiver.js:19
[ 20.630s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.media","senderId":"*:*","data":"{\"type\":\"MEDIA_STATUS\",\"status\":[{\"mediaSessionId\":1,\"playbackRate\":1,\"playerState\":\"PLAYING\",\"currentTime\":1.125,\"supportedMediaCommands\":15,\"volume\":{\"level\":1,\"muted\":false}}],\"requestId\":0}"}
cast_receiver.js:19
######### MEDIA ELEMENT ENDED sample_media_receiver.html:133
### Media Manager - ENDED: sample_media_receiver.html:347
[ 27.445s] [cast.receiver.MediaManager] Resetting media element
cast_receiver.js:19
[ 27.579s] [cast.receiver.MediaManager] Sending broadcast status message
cast_receiver.js:19
[ 27.581s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.media","senderId":"*:*","data":"{\"type\":\"MEDIA_STATUS\",\"status\":[{\"mediaSessionId\":1,\"playbackRate\":1,\"playerState\":\"IDLE\",\"currentTime\":0,\"supportedMediaCommands\":15,\"volume\":{\"level\":1,\"muted\":false},\"idleReason\":\"FINISHED\"}],\"requestId\":0}"}
cast_receiver.js:19
######### MEDIA ELEMENT ABORT [object Event] sample_media_receiver.html:153
[ 31.019s] [cast.receiver.IpcChannel] Received message: {"data":"{\"type\":\"LOAD\",\"requestId\":28532031,\"sessionId\":\"2A80FF6F-F9B2-4D78-D99A-997CF6FC2F69\",\"media\":{\"contentId\":\"http://192.168.0.103/~marco/cast/myimage.jpg\",\"streamType\":\"buffered\",\"contentType\":\"image/jpg\",\"metadata\":null,\"duration\":null,\"customData\":null},\"autoplay\":true,\"currentTime\":null,\"customData\":null}","namespace":"urn:x-cast:com.google.cast.media","senderId":"8:client-68103"}
cast_receiver.js:19
[ 31.028s] [cast.receiver.CastMessageBus] Dispatching CastMessageBus message [urn:x-cast:com.google.cast.media, 8:client-68103]: {"type":"LOAD","requestId":28532031,"sessionId":"2A80FF6F-F9B2-4D78-D99A-997CF6FC2F69","media":{"contentId":"http://192.168.0.103/~marco/cast/myimage.jpg","streamType":"buffered","contentType":"image/jpg","metadata":null,"duration":null,"customData":null},"autoplay":true,"currentTime":null,"customData":null}
cast_receiver.js:19
[ 31.031s] [cast.receiver.MediaManager] MediaManager message received [8:client-68103] {"type":"LOAD","requestId":28532031,"sessionId":"2A80FF6F-F9B2-4D78-D99A-997CF6FC2F69","media":{"contentId":"http://192.168.0.103/~marco/cast/myimage.jpg","streamType":"buffered","contentType":"image/jpg","metadata":null,"duration":null,"customData":null},"autoplay":true,"currentTime":null,"customData":null}
cast_receiver.js:19
[ 31.033s] [cast.receiver.MediaManager] Dispatching MediaManager load event
cast_receiver.js:19
### Media Manager - LOAD: {"type":"load","B":false,"defaultPrevented":false,"Qa":true,"data":{"requestId":28532031,"sessionId":"2A80FF6F-F9B2-4D78-D99A-997CF6FC2F69","media":{"contentId":"http://192.168.0.103/~marco/cast/myimage.jpg","streamType":"buffered","contentType":"image/jpg","metadata":null,"duration":null,"customData":null},"autoplay":true,"currentTime":null,"customData":null},"senderId":"8:client-68103"} sample_media_receiver.html:549
### Media Protocol Identified as jpg sample_media_receiver.html:588
######### MEDIA ELEMENT LOAD START sample_media_receiver.html:121
######### MEDIA ELEMENT ERROR [object Event] sample_media_receiver.html:149
[ 31.293s] [cast.receiver.MediaManager] Load metadata error
cast_receiver.js:19
### Media Manager - LOAD METADATA ERROR: {"senderId":"8:client-68103","message":{"requestId":28532031,"sessionId":"2A80FF6F-F9B2-4D78-D99A-997CF6FC2F69","media":{"contentId":"http://192.168.0.103/~marco/cast/myimage.jpg","streamType":"buffered","contentType":"image/jpg","metadata":null,"duration":null,"customData":null},"autoplay":true,"currentTime":null,"customData":null}} sample_media_receiver.html:399
[ 31.297s] [cast.receiver.MediaManager] Resetting media element
cast_receiver.js:19
[ 31.303s] [cast.receiver.MediaManager] Sending error message to 8:client-68103
cast_receiver.js:19
[ 31.305s] [cast.receiver.IpcChannel] IPC message sent: {"namespace":"urn:x-cast:com.google.cast.media","senderId":"8:client-68103","data":"{\"requestId\":28532031,\"type\":\"LOAD_FAILED\"}"}
What is wrong?
When you say "custom receiver", it means that you have written your own receiver. When doing that, did you add any <img/> tag for images and the associated logic to use that element for images? Sounds like you have not. The Styled and Default receivers do that so that is why you can see images when using those receivers.

Resources