Skip to content

Commit

Permalink
Fix the CMD_MAC_* commands
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffLIrion committed Feb 3, 2022
1 parent be393dc commit 06c82cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions androidtv/constants.py
Expand Up @@ -163,8 +163,8 @@ class DeviceEnum(IntEnum):
CMD_VERSION = "getprop ro.build.version.release"

# 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"
CMD_MAC_WLAN0 = "ip addr show wlan0 | grep -m 1 ether || echo ''"
CMD_MAC_ETH0 = "ip addr show eth0 | grep -m 1 ether || echo ''"

#: The command used for getting the device properties
CMD_DEVICE_PROPERTIES = (
Expand All @@ -177,7 +177,7 @@ class DeviceEnum(IntEnum):
+ CMD_VERSION
+ " && "
+ CMD_MAC_WLAN0
+ " && "
+ "; "
+ CMD_MAC_ETH0
)

Expand Down
6 changes: 3 additions & 3 deletions tests/test_constants.py
Expand Up @@ -98,7 +98,7 @@ def test_constants(self):
# CMD_DEVICE_PROPERTIES
self.assertCommand(
constants.CMD_DEVICE_PROPERTIES,
r"getprop ro.product.manufacturer && getprop ro.product.model && getprop ro.serialno && getprop ro.build.version.release && ip addr show wlan0 | grep -m 1 ether && ip addr show eth0 | grep -m 1 ether",
r"getprop ro.product.manufacturer && getprop ro.product.model && getprop ro.serialno && getprop ro.build.version.release && ip addr show wlan0 | grep -m 1 ether || echo ''; ip addr show eth0 | grep -m 1 ether || echo ''",
)

# CMD_HDMI_INPUT
Expand All @@ -123,10 +123,10 @@ def test_constants(self):
)

# CMD_MAC_ETH0
self.assertCommand(constants.CMD_MAC_ETH0, r"ip addr show eth0 | grep -m 1 ether")
self.assertCommand(constants.CMD_MAC_ETH0, r"ip addr show eth0 | grep -m 1 ether || echo ''")

# CMD_MAC_WLAN0
self.assertCommand(constants.CMD_MAC_WLAN0, r"ip addr show wlan0 | grep -m 1 ether")
self.assertCommand(constants.CMD_MAC_WLAN0, r"ip addr show wlan0 | grep -m 1 ether || echo ''")

# CMD_MANUFACTURER
self.assertCommand(constants.CMD_MANUFACTURER, r"getprop ro.product.manufacturer")
Expand Down

0 comments on commit 06c82cc

Please sign in to comment.