Skip to content

Commit 0f32d34

Browse files
author
Christer Ekholm
committed
_ux_device_class_pima_object_references_set and _ux_device_class_pima_object_info_send
will return failure even if success because UX_DEVICE_CLASS_PIMA_RC_OK was handeled as error and reported to app
1 parent cfdd55c commit 0f32d34

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

common/usbx_device_classes/src/ux_device_class_pima_object_info_send.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,10 +223,18 @@ ULONG object_handle;
223223
/* Send the object to the application. */
224224
status = pima -> ux_device_class_pima_object_info_send(pima, object, storage_id, parent_object_handle, &object_handle);
225225

226-
/* Now we return a response with success. */
227-
status = (status == UX_SUCCESS) ? UX_DEVICE_CLASS_PIMA_RC_OK : status;
228-
_ux_device_class_pima_response_send(pima, status, 3, pima -> ux_device_class_pima_storage_id,
226+
if (status != UX_SUCCESS)
227+
{
228+
/* Now we return a response with error. */
229+
_ux_device_class_pima_response_send(pima, status, 3, pima -> ux_device_class_pima_storage_id,
229230
object -> ux_device_class_pima_object_parent_object, object_handle);
231+
}
232+
else
233+
{
234+
/* Now we return a response with success. */
235+
_ux_device_class_pima_response_send(pima, UX_DEVICE_CLASS_PIMA_RC_OK, 3, pima -> ux_device_class_pima_storage_id,
236+
object -> ux_device_class_pima_object_parent_object, object_handle);
237+
}
230238

231239
/* Store the object handle. It will be used for the OBJECT_SEND command. */
232240
pima -> ux_device_class_pima_current_object_handle = object_handle;

common/usbx_device_classes/src/ux_device_class_pima_object_references_set.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,16 @@ ULONG object_references_length;
128128

129129
/* Send the object references to the application. */
130130
status = pima -> ux_device_class_pima_object_references_set(pima, object_handle, object_references, object_references_length);
131-
132-
/* Now we return a response with success. */
133-
status = (status == UX_SUCCESS) ? UX_DEVICE_CLASS_PIMA_RC_OK : status;
134-
_ux_device_class_pima_response_send(pima, status, 0, 0, 0, 0);
131+
132+
/* Check error code from application. */
133+
if (status == UX_SUCCESS)
134+
135+
/* Now we return a response with success. */
136+
_ux_device_class_pima_response_send(pima, UX_DEVICE_CLASS_PIMA_RC_OK, 0, 0, 0, 0);
137+
else
138+
139+
/* We return an error. The code is passed by the application. */
140+
_ux_device_class_pima_response_send(pima, status, 0, 0, 0, 0);
135141

136142
}
137143
else

0 commit comments

Comments
 (0)