Skip to content

Commit 658adce

Browse files
authored
Potential fixes for EZSP v16 (#683)
* Only deserialize `GetTokenDataRsp` when the status is successful * Add new status codes
1 parent 0960652 commit 658adce

File tree

2 files changed

+89
-2
lines changed

2 files changed

+89
-2
lines changed

bellows/ezsp/v14/commands.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from zigpy.types import EUI64, NWK, BroadcastAddress, Struct
1+
from zigpy.types import EUI64, NWK, BroadcastAddress, Struct, StructField
22

33
import bellows.types as t
44

@@ -7,7 +7,7 @@
77

88
class GetTokenDataRsp(Struct):
99
status: t.sl_Status
10-
value: t.LVBytes32
10+
value: t.LVBytes32 = StructField(requires=lambda rsp: rsp.status == t.sl_Status.OK)
1111

1212

1313
# EmberStatus and EzspStatus have been replaced with sl_Status globally.

bellows/types/named.py

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,6 +1468,73 @@ class sl_Status(basic.enum32):
14681468
NVM3_TOKEN_INIT_FAILED = 0x005C
14691469
# The initialization was aborted as the NVM3 instance was already opened with other parameters
14701470
NVM3_OPENED_WITH_OTHER_PARAMETERS = 0x005D
1471+
# Initialization aborted, no valid page found
1472+
NVM3_NO_VALID_PAGES = 0x005E
1473+
# The object size is not supported
1474+
NVM3_OBJECT_SIZE_NOT_SUPPORTED = 0x005F
1475+
# Trying to access a data object which is currently a counter object
1476+
NVM3_OBJECT_IS_NOT_DATA = 0x0060
1477+
# Trying to access a counter object which is currently a data object
1478+
NVM3_OBJECT_IS_NOT_A_COUNTER = 0x0061
1479+
# The object is too large
1480+
NVM3_WRITE_DATA_SIZE = 0x0062
1481+
# Trying to read with a length different from actual object size
1482+
NVM3_READ_DATA_SIZE = 0x0063
1483+
# The module was opened with a full NVM
1484+
NVM3_INIT_WITH_FULL_NVM = 0x0064
1485+
# Illegal parameter
1486+
NVM3_RESIZE_PARAMETER = 0x0065
1487+
# Not enough NVM to complete resize
1488+
NVM3_RESIZE_NOT_ENOUGH_SPACE = 0x0066
1489+
# Erase counts are not valid
1490+
NVM3_ERASE_COUNT_ERROR = 0x0067
1491+
# A NVM function call was failing
1492+
NVM3_NVM_ACCESS = 0x0068
1493+
# Write to memory that is not erased
1494+
NVM3_WRITE_TO_NOT_ERASED = 0x006D
1495+
# Invalid NVM address
1496+
NVM3_INVALID_ADDR = 0x006E
1497+
# Key validation failure
1498+
NVM3_KEY_MISMATCH = 0x006F
1499+
# Size mismatch error
1500+
NVM3_SIZE_ERROR = 0x0070
1501+
# Emulator error
1502+
NVM3_EMULATOR = 0x0071
1503+
1504+
# Security status codes
1505+
# Encryption failed
1506+
SECURITY_ENCRYPT_ERROR = 0x0072
1507+
# Error in obtaining crypto key
1508+
SECURITY_KEY_ERROR = 0x0073
1509+
# Error in obtaining random number
1510+
SECURITY_RANDOM_NUM_GEN_ERROR = 0x0074
1511+
1512+
## MVP Driver and MVP Math status codes
1513+
# Critical fault
1514+
COMPUTE_DRIVER_FAULT = 0x1501
1515+
# ALU operation output NaN
1516+
COMPUTE_DRIVER_ALU_NAN = 0x1502
1517+
# ALU numeric overflow
1518+
COMPUTE_DRIVER_ALU_OVERFLOW = 0x1503
1519+
# ALU numeric underflow
1520+
COMPUTE_DRIVER_ALU_UNDERFLOW = 0x1504
1521+
# Overflow during array store
1522+
COMPUTE_DRIVER_STORE_CONVERSION_OVERFLOW = 0x1505
1523+
# Underflow during array store conversion
1524+
COMPUTE_DRIVER_STORE_CONVERSION_UNDERFLOW = 0x1506
1525+
# Infinity encountered during array store conversion
1526+
COMPUTE_DRIVER_STORE_CONVERSION_INFINITY = 0x1507
1527+
# NaN encountered during array store conversion
1528+
COMPUTE_DRIVER_STORE_CONVERSION_NAN = 0x1508
1529+
1530+
# MATH NaN encountered
1531+
COMPUTE_MATH_NAN = 0x1512
1532+
# MATH Infinity encountered
1533+
COMPUTE_MATH_INFINITY = 0x1513
1534+
# MATH numeric overflow
1535+
COMPUTE_MATH_OVERFLOW = 0x1514
1536+
# MATH numeric underflow
1537+
COMPUTE_MATH_UNDERFLOW = 0x1515
14711538

14721539
## Zigbee status codes
14731540
# Packet is dropped by packet-handoff callbacks
@@ -1530,6 +1597,26 @@ class sl_Status(basic.enum32):
15301597
ZIGBEE_PRECONFIGURED_KEY_REQUIRED = 0x0C1D
15311598
# A Zigbee EZSP error has occurred. Track the origin and corresponding EzspStatus for more info.
15321599
ZIGBEE_EZSP_ERROR = 0x0C1E
1600+
# Node ID discovery failed.
1601+
ZIGBEE_ID_DISCOVERY_FAILED = 0x0C1F
1602+
# Message was sent but no APS ACK received.
1603+
ZIGBEE_NO_APS_ACK = 0x0C20
1604+
# APS message was canceled.
1605+
ZIGBEE_APS_MESSAGE_CANCELED = 0x0C21
1606+
# Node ID discovery not enabled.
1607+
ZIGBEE_ID_DISCOVERY_NOT_ENABLED = 0x0C22
1608+
# Message was not sent, Node ID discovery is underway.
1609+
ZIGBEE_ID_DISCOVERY_UNDERWAY = 0x0C23
1610+
# The message was not sent because a route discovery is currently underway. There is no route to the target until the route discovery completes.
1611+
ZIGBEE_SEND_UNICAST_ROUTE_DISCOVERY_UNDERWAY = 0x0C24
1612+
# Radius is 0 or message has been dropped because route request failed or failed to submit message to tx queue.
1613+
ZIGBEE_SEND_UNICAST_FAILURE = 0x0C25
1614+
# No active route to the destination.
1615+
ZIGBEE_SEND_UNICAST_NO_ROUTE = 0x0C26
1616+
# Broadcast message timeout while waiting for sleepy children to poll.
1617+
ZIGBEE_BROADCAST_TO_SLEEPY_CHILDREN_TIMEOUT = 0x0C27
1618+
# Expected a neighbor to relay the message, but none did.
1619+
ZIGBEE_BROADCAST_RELAY_FAILED = 0x0C28
15331620

15341621
@classmethod
15351622
def from_ember_status(

0 commit comments

Comments
 (0)