This repository was archived by the owner on Jan 10, 2023. It is now read-only.
This repository was archived by the owner on Jan 10, 2023. It is now read-only.
[Bug] Protocol: AttributeError: 'NoneType' object has no attribute 'ReadUntilClose' still occurring on NVidia Shield #136
Open
Description
I think this might be related to #59. It seems the error only occurs on "Official" Android TV OS devices because I have not been able to reproduce the error on my android box that runs an Android Tablet OS. Anyway, the traceback is as follows
Mon Nov 12 2018 13:23:15 GMT-0500 (Eastern Standard Time)
Update for media_player.shieldtv fails
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
await self.async_device_update()
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 347, in async_device_update
await self.async_update()
File "/home/homeassistant/.homeassistant/custom_components/media_player/androidtv.py", line 255, in async_update
await self._androidtv.update()
File "/srv/homeassistant/lib/python3.6/site-packages/androidtv/__init__.py", line 361, in update
screen_on = await self._screen_on
File "/srv/homeassistant/lib/python3.6/site-packages/androidtv/__init__.py", line 407, in _screen_on
screen_on = await self._dump_has('power', 'Display Power', 'state=ON')
File "/srv/homeassistant/lib/python3.6/site-packages/androidtv/__init__.py", line 461, in _dump_has
dump_result = await self._dump(service, grep=grep)
File "/srv/homeassistant/lib/python3.6/site-packages/androidtv/__init__.py", line 448, in _dump
result = await self._adb.shell('dumpsys {0} | grep "{1}"'.format(service, grep))
File "/srv/homeassistant/lib/python3.6/site-packages/androidtv/__init__.py", line 298, in shell
return await fut
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/lib/python3.6/site-packages/adb/adb_commands.py", line 383, in Shell
timeout_ms=timeout_ms)
File "/srv/homeassistant/lib/python3.6/site-packages/adb/adb_protocol.py", line 493, in Command
result = ''.join(cls.StreamingCommand(usb, service, command, timeout_ms))
File "/srv/homeassistant/lib/python3.6/site-packages/adb/adb_protocol.py", line 529, in StreamingCommand
timeout_ms=timeout_ms)
File "/srv/homeassistant/lib/python3.6/site-packages/adb/adb_protocol.py", line 440, in Open
timeout_ms=timeout_ms)
File "/srv/homeassistant/lib/python3.6/site-packages/adb/adb_protocol.py", line 308, in Read
'Unknown command: %x' % cmd, cmd, (arg0, arg1))
adb.adb_protocol.InvalidCommandError: ('Unknown command: 70736944', 1886611780, (544825708, 1702326096))
Mon Nov 12 2018 13:23:02 GMT-0500 (Eastern Standard Time)
Update for media_player.shieldtv fails
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
await self.async_device_update()
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 347, in async_device_update
await self.async_update()
File "/home/homeassistant/.homeassistant/custom_components/media_player/androidtv.py", line 255, in async_update
await self._androidtv.update()
File "/srv/homeassistant/lib/python3.6/site-packages/androidtv/__init__.py", line 361, in update
screen_on = await self._screen_on
File "/srv/homeassistant/lib/python3.6/site-packages/androidtv/__init__.py", line 407, in _screen_on
screen_on = await self._dump_has('power', 'Display Power', 'state=ON')
File "/srv/homeassistant/lib/python3.6/site-packages/androidtv/__init__.py", line 461, in _dump_has
dump_result = await self._dump(service, grep=grep)
File "/srv/homeassistant/lib/python3.6/site-packages/androidtv/__init__.py", line 448, in _dump
result = await self._adb.shell('dumpsys {0} | grep "{1}"'.format(service, grep))
File "/srv/homeassistant/lib/python3.6/site-packages/androidtv/__init__.py", line 298, in shell
return await fut
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/lib/python3.6/site-packages/adb/adb_commands.py", line 383, in Shell
timeout_ms=timeout_ms)
File "/srv/homeassistant/lib/python3.6/site-packages/adb/adb_protocol.py", line 493, in Command
result = ''.join(cls.StreamingCommand(usb, service, command, timeout_ms))
File "/srv/homeassistant/lib/python3.6/site-packages/adb/adb_protocol.py", line 529, in StreamingCommand
timeout_ms=timeout_ms)
File "/srv/homeassistant/lib/python3.6/site-packages/adb/adb_protocol.py", line 440, in Open
timeout_ms=timeout_ms)
File "/srv/homeassistant/lib/python3.6/site-packages/adb/adb_protocol.py", line 312, in Read
if time.time() - start > total_timeout_ms:
TypeError: '>' not supported between instances of 'float' and 'NoneType'
Mon Nov 12 2018 13:22:49 GMT-0500 (Eastern Standard Time)
Update for media_player.shieldtv fails
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
await self.async_device_update()
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 347, in async_device_update
await self.async_update()
File "/home/homeassistant/.homeassistant/custom_components/media_player/androidtv.py", line 255, in async_update
await self._androidtv.update()
File "/srv/homeassistant/lib/python3.6/site-packages/androidtv/__init__.py", line 366, in update
wake_lock = await self._wake_lock
File "/srv/homeassistant/lib/python3.6/site-packages/androidtv/__init__.py", line 419, in _wake_lock
wake_lock = await self._dump_has('power', 'Locks', 'size=0')
File "/srv/homeassistant/lib/python3.6/site-packages/androidtv/__init__.py", line 461, in _dump_has
dump_result = await self._dump(service, grep=grep)
File "/srv/homeassistant/lib/python3.6/site-packages/androidtv/__init__.py", line 448, in _dump
result = await self._adb.shell('dumpsys {0} | grep "{1}"'.format(service, grep))
File "/srv/homeassistant/lib/python3.6/site-packages/androidtv/__init__.py", line 298, in shell
return await fut
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/lib/python3.6/site-packages/adb/adb_commands.py", line 383, in Shell
timeout_ms=timeout_ms)
File "/srv/homeassistant/lib/python3.6/site-packages/adb/adb_protocol.py", line 493, in Command
result = ''.join(cls.StreamingCommand(usb, service, command, timeout_ms))
File "/srv/homeassistant/lib/python3.6/site-packages/adb/adb_protocol.py", line 531, in StreamingCommand
for data in connection.ReadUntilClose():
File "/srv/homeassistant/lib/python3.6/site-packages/adb/adb_protocol.py", line 169, in ReadUntilClose
cmd, data = self.ReadUntil(b'CLSE', b'WRTE')
File "/srv/homeassistant/lib/python3.6/site-packages/adb/adb_protocol.py", line 160, in ReadUntil
self.remote_id, remote_id))
adb.adb_protocol.InvalidResponseError: Incorrect remote id, expected 27640 got 27639
Update for media_player.shieldtv fails
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
await self.async_device_update()
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 347, in async_device_update
await self.async_update()
File "/home/homeassistant/.homeassistant/custom_components/media_player/androidtv.py", line 255, in async_update
await self._androidtv.update()
File "/srv/homeassistant/lib/python3.6/site-packages/androidtv/__init__.py", line 361, in update
screen_on = await self._screen_on
File "/srv/homeassistant/lib/python3.6/site-packages/androidtv/__init__.py", line 407, in _screen_on
screen_on = await self._dump_has('power', 'Display Power', 'state=ON')
File "/srv/homeassistant/lib/python3.6/site-packages/androidtv/__init__.py", line 461, in _dump_has
dump_result = await self._dump(service, grep=grep)
File "/srv/homeassistant/lib/python3.6/site-packages/androidtv/__init__.py", line 448, in _dump
result = await self._adb.shell('dumpsys {0} | grep "{1}"'.format(service, grep))
File "/srv/homeassistant/lib/python3.6/site-packages/androidtv/__init__.py", line 298, in shell
return await fut
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/lib/python3.6/site-packages/adb/adb_commands.py", line 383, in Shell
timeout_ms=timeout_ms)
File "/srv/homeassistant/lib/python3.6/site-packages/adb/adb_protocol.py", line 493, in Command
result = ''.join(cls.StreamingCommand(usb, service, command, timeout_ms))
File "/srv/homeassistant/lib/python3.6/site-packages/adb/adb_protocol.py", line 531, in StreamingCommand
for data in connection.ReadUntilClose():
AttributeError: 'NoneType' object has no attribute 'ReadUntilClose'
I've taken the liberty of modifying the adb_protocol.py
file to add in a ton of logging to see what's going on. You can find the modified file's code here and a partial log showing where the error begins to occur here
From what I could gather after jumping down the rabbit hole bouncing from function to function after a few hours I have the following theory:
- The errors are connected (in case that wasn't obvious). First erroring on line 308 of
adb_protocol.py
, then line 312 because we're receiving a command that isn't expected (we getb'WRTE'
while it's looking for eitherb'CLSE'
orb'OKAY'
- The 3rd error (although not obvious at first glance) is still a product of the previous two errors. It seems tied to arg0 in the Read function. In my logging output you can see that arg0 in the Read function is clearly correct though (arg0: 27640).
What's wrong with the adb_protocol.py
file? Does anyone know of a fix?
Metadata
Metadata
Assignees
Labels
No labels