JeffLIrion / adb_shell

A Python implementation of ADB with shell and FileSync functionality.
Apache License 2.0
530 stars 60 forks source link

Unpack requieres a buffer of 24 bytes #186

Closed Theiamania closed 2 years ago

Theiamania commented 3 years ago

I have a Rpi running Home Assistant OS 6.2

In my configuration.yaml

media_player:
  - platform: androidtv
    name: Fire_Stick
    host: 192.168.1.73

It works fine with my Fire TV stick 4K, but only at first. He disconnects very often and, after a while, he disconnects permanently.

It doesn't seem like my problem is the one that is fixed using Wakelock.

This is my log:

2021-08-11 19:20:12 DEBUG (MainThread) [adb_shell.adb_device_async] bulk_write(24): b'CNXN\x00\x00\x00\x01\x00\x00\x10\x00\x14\x00\x00\x00\xb5\x07\x00\x00\xbc\xb1\xa7\xb1'
2021-08-11 19:20:12 DEBUG (MainThread) [adb_shell.adb_device_async] bulk_write(20): b'host::homeassistant\x00'
2021-08-11 19:20:12 DEBUG (MainThread) [adb_shell.adb_device_async] bulk_read(24): b''
2021-08-11 19:20:12 WARNING (MainThread) [androidtv.adb_manager.adb_manager_async] Couldn't connect to 192.168.1.73:5555.  ValueError: ('Unable to unpack ADB command. (length=0)', b'<6I', b'', error('unpack requires a buffer of 24 bytes'))
2021-08-11 19:20:12 WARNING (MainThread) [homeassistant.components.androidtv.media_player] Could not connect to Fire_Stick at 192.168.1.73:5555 using Python ADB implementation with adbkey='/config/.storage/androidtv_adbkey'

It is very strange, because obviously it comes to accept the adbkey at the beginning, but it stops doing it even without the wifi communication being interrupted, or any device rebooting ...

Any idea to solve it?

JeffLIrion commented 3 years ago

I think this is fixed in the latest release.