summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrédéric Desbiens <[email protected]>2025-06-10 08:58:17 -0400
committerGitHub <[email protected]>2025-06-10 08:58:17 -0400
commit2bbf1fa75c9b6758b06ef6f69492f2a2586943ac (patch)
tree040def35922408aeade1e2615658ac4a43ff460c
parentcce17442a8f0a6c7574384699909515b58f43052 (diff)
parent0f32d34ad7c1476af02d7e04a53efb3dbe4d3ef1 (diff)
Merge pull request #196 from Christer-Ekholm/Pima_some_functions_returns_error_when_action_was_success
Some PIMA functions returns != UX_SUCCESS even when success
-rw-r--r--common/usbx_device_classes/src/ux_device_class_pima_object_info_send.c14
-rw-r--r--common/usbx_device_classes/src/ux_device_class_pima_object_references_set.c14
2 files changed, 21 insertions, 7 deletions
diff --git a/common/usbx_device_classes/src/ux_device_class_pima_object_info_send.c b/common/usbx_device_classes/src/ux_device_class_pima_object_info_send.c
index 4d64c6a..557c386 100644
--- a/common/usbx_device_classes/src/ux_device_class_pima_object_info_send.c
+++ b/common/usbx_device_classes/src/ux_device_class_pima_object_info_send.c
@@ -223,10 +223,18 @@ ULONG object_handle;
/* Send the object to the application. */
status = pima -> ux_device_class_pima_object_info_send(pima, object, storage_id, parent_object_handle, &object_handle);
- /* Now we return a response with success. */
- status = (status == UX_SUCCESS) ? UX_DEVICE_CLASS_PIMA_RC_OK : status;
- _ux_device_class_pima_response_send(pima, status, 3, pima -> ux_device_class_pima_storage_id,
+ if (status != UX_SUCCESS)
+ {
+ /* Now we return a response with error. */
+ _ux_device_class_pima_response_send(pima, status, 3, pima -> ux_device_class_pima_storage_id,
object -> ux_device_class_pima_object_parent_object, object_handle);
+ }
+ else
+ {
+ /* Now we return a response with success. */
+ _ux_device_class_pima_response_send(pima, UX_DEVICE_CLASS_PIMA_RC_OK, 3, pima -> ux_device_class_pima_storage_id,
+ object -> ux_device_class_pima_object_parent_object, object_handle);
+ }
/* Store the object handle. It will be used for the OBJECT_SEND command. */
pima -> ux_device_class_pima_current_object_handle = object_handle;
diff --git a/common/usbx_device_classes/src/ux_device_class_pima_object_references_set.c b/common/usbx_device_classes/src/ux_device_class_pima_object_references_set.c
index d9c704d..5197f06 100644
--- a/common/usbx_device_classes/src/ux_device_class_pima_object_references_set.c
+++ b/common/usbx_device_classes/src/ux_device_class_pima_object_references_set.c
@@ -128,10 +128,16 @@ ULONG object_references_length;
/* Send the object references to the application. */
status = pima -> ux_device_class_pima_object_references_set(pima, object_handle, object_references, object_references_length);
-
- /* Now we return a response with success. */
- status = (status == UX_SUCCESS) ? UX_DEVICE_CLASS_PIMA_RC_OK : status;
- _ux_device_class_pima_response_send(pima, status, 0, 0, 0, 0);
+
+ /* Check error code from application. */
+ if (status == UX_SUCCESS)
+
+ /* Now we return a response with success. */
+ _ux_device_class_pima_response_send(pima, UX_DEVICE_CLASS_PIMA_RC_OK, 0, 0, 0, 0);
+ else
+
+ /* We return an error. The code is passed by the application. */
+ _ux_device_class_pima_response_send(pima, status, 0, 0, 0, 0);
}
else