Skip to content
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

Feature/fix invalid command edge cases? #656

Closed
wants to merge 2 commits into from
Closed
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
28 changes: 27 additions & 1 deletion bellows/ezsp/xncp.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ class XncpCommandId(t.enum16):
GET_BUILD_STRING_RSP = GET_BUILD_STRING_REQ | 0x8000
GET_FLOW_CONTROL_TYPE_RSP = GET_FLOW_CONTROL_TYPE_REQ | 0x8000

# Hacky fix for specific devices?
GET_SUPPORTED_FEATURES_RSP_ALT = GET_SUPPORTED_FEATURES_REQ | 0x0100
SET_SOURCE_ROUTE_RSP_ALT = SET_SOURCE_ROUTE_REQ | 0x0100
GET_MFG_TOKEN_OVERRIDE_RSP_ALT = GET_MFG_TOKEN_OVERRIDE_REQ | 0x0100
GET_BUILD_STRING_RSP_ALT = GET_BUILD_STRING_REQ | 0x0100
GET_FLOW_CONTROL_TYPE_RSP_ALT = GET_FLOW_CONTROL_TYPE_REQ | 0x0100


UNKNOWN = 0xFFFF


Expand Down Expand Up @@ -119,7 +127,6 @@ class GetSupportedFeaturesReq(XncpCommandPayload):
class GetSupportedFeaturesRsp(XncpCommandPayload):
features: FirmwareFeatures


@register_command(XncpCommandId.SET_SOURCE_ROUTE_REQ)
class SetSourceRouteReq(XncpCommandPayload):
destination: t.NWK
Expand Down Expand Up @@ -160,6 +167,25 @@ class GetFlowControlTypeReq(XncpCommandPayload):
class GetFlowControlTypeRsp(XncpCommandPayload):
flow_control_type: FlowControlType

@register_command(XncpCommandId.GET_SUPPORTED_FEATURES_RSP_ALT)
class GetSupportedFeaturesRspAlt(GetSupportedFeaturesRsp):
pass

@register_command(XncpCommandId.SET_SOURCE_ROUTE_RSP_ALT)
class SetSourceRouteRspAlt(SetSourceRouteRsp):
pass

@register_command(XncpCommandId.GET_MFG_TOKEN_OVERRIDE_RSP_ALT)
class GetMfgTokenOverrideRspAlt(GetMfgTokenOverrideRsp):
pass

@register_command(XncpCommandId.GET_BUILD_STRING_RSP_ALT)
class GetBuildStringRspAlt(GetBuildStringRsp):
pass

@register_command(XncpCommandId.GET_FLOW_CONTROL_TYPE_RSP_ALT)
class GetFlowControlTypeRspAlt(GetFlowControlTypeRsp):
pass

@register_command(XncpCommandId.UNKNOWN)
class Unknown(XncpCommandPayload):
Expand Down