[Bug] PROP_BITMAP Object DP is always rejected by dp_type_check()
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- c
- Domain
- embedded-iot
Research direction
Start in dp_schema.c around dp_rept_valid_check() and dp_type_check(), then run the issue's DP 130 minimal reproduction through tuya_iot_dp_obj_report(). Confirm that a schema-matching PROP_BITMAP is accepted, serialized, and reported, while mismatched property types remain rejected.
Written by the indexing model from the issue text.
Description
Summary
tuya_iot_dp_obj_report() cannot report a schema-valid PROP_BITMAP DP. The Object-DP validator first correctly verifies that the DP type matches the schema property type, but the bitmap-specific branch then compares the same dp_obj_t.type field with the unrelated cJSON node type cJSON_Number.
This causes every bitmap/Fault Object DP to be filtered before it is serialized and sent to Tuya Cloud.
Affected versions
- Reproduced with TuyaOpen
v1.8.0
Minimal reproduction
Configure DP 130 as a report-only Fault DP with nine labels, so the downloaded product schema contains:
{
"id": 130,
"mode": "ro",
"property": {
"type": "bitmap",
"maxlen": 9
}
}
Report it through the public Object-DP API:
dp_obj_t bitmap = {
.id = 130,
.type = PROP_BITMAP,
.value.dp_bitmap = 1U,
};
int result = tuya_iot_dp_obj_report(client, NULL, &bitmap, 1U, DP_REPT_NO_FILTER_FLAG);
Actual result
The SDK logs:
[dp_schema.c:732] bitmap check fail 4 1 9
For a report containing only this DP, tuya_iot_dp_obj_report() returns OPRT_SVC_DP_ID_NOT_FOUND (-3585) because the valid-DP set is empty.
A real Fault value produces the same failure, for example:
[dp_schema.c:732] bitmap check fail 4 130 9
Here 4 is PROP_BITMAP, 130 is the bitmap value, and 9 is the schema maxlen.
Expected result
A dp_obj_t whose type is PROP_BITMAP should be accepted when the product schema property type is also PROP_BITMAP, and its numeric bitmap value should be serialized and reported.
Root cause
dp_rept_valid_check() already performs the correct Object-DP/schema check:
if (dp->type != dpnode->desc.prop_tp) {
return OPRT_SVC_DP_TP_NOT_MATCH;
}
After that check passes, dp_type_check() reaches this bitmap branch:
case PROP_BITMAP:
if (dp->type != cJSON_Number) {
PR_ERR("bitmap check fail %d %d %d", dp->type,
dp->value.dp_bitmap,
node->prop.prop_bitmap.max_len);
return FALSE;
}
break;
dp->type is a Tuya property type, not a cJSON node type:
PROP_BITMAP = 4
cJSON_Number = 8
The condition is therefore always true for every correctly formed bitmap Object DP.
The earlier dp->type != dpnode->desc.prop_tp check remains active and still rejects an Object DP whose property type does not match the product schema.
- Dominant language
- C
- Stars
- 1.9k
- Forks
- 305
- Avg merge
- 15h 30m
- Merged PRs (30d)
- 20
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from tuya/TuyaOpen
-
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
-
[Bug][v1.9.0][ESP32-S3] Internal-only tkl_system_malloc causes activation failure with PSRAM enabled Open
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 15/100
-
Board not updated Open
Difficulty 3/5 1-2 days Newbie friendliness 42/100
Similar issues
-
level/task module/gcp type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
docs
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
P3 sonic-vpp
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
sonic-net/sonic-buildimage#29662 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 94/100
spack/spack-packages#6586 ·
-
category:port-update
Difficulty 2/5 1-3 hours Newbie friendliness 72/100