Skip to content

fix: empty manufacturer lead to failed parse_device_properties #359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions androidtv/basetv/basetv.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,17 @@ def _parse_device_properties(self, properties):
return

lines = properties.strip().splitlines()
if len(lines) != 5:
if len(lines) != 7:
_LOGGER.warning(
"%s:%d `get_device_properties` Invalid response length: %s",
self.host,
self.port,
properties,
)
self.device_properties = {}
return

manufacturer, model, serialno, version, product_id = lines
_, manufacturer, model, serialno, version, product_id, _ = lines

if not serialno.strip():
_LOGGER.warning(
Expand Down
3 changes: 2 additions & 1 deletion androidtv/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,15 @@ class DeviceEnum(IntEnum):
CMD_SERIALNO = "getprop ro.serialno"
CMD_VERSION = "getprop ro.build.version.release"
CMD_PRODUCT_ID = "getprop ro.product.vendor.device"
CMD_ECHO_PLACEHOLDER = "echo %"

# Commands for getting the MAC address
CMD_MAC_WLAN0 = "ip addr show wlan0 | grep -m 1 ether"
CMD_MAC_ETH0 = "ip addr show eth0 | grep -m 1 ether"

#: The command used for getting the device properties
CMD_DEVICE_PROPERTIES = (
CMD_MANUFACTURER + " && " + CMD_MODEL + " && " + CMD_SERIALNO + " && " + CMD_VERSION + " && " + CMD_PRODUCT_ID
CMD_ECHO_PLACEHOLDER + " && " + CMD_MANUFACTURER + " && " + CMD_MODEL + " && " + CMD_SERIALNO + " && " + CMD_VERSION + " && " + CMD_PRODUCT_ID + " && " + CMD_ECHO_PLACEHOLDER
)


Expand Down
Loading