sdphost does not return failure state on all failures

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

sdphost does not return failure state on all failures

723 Views
luc_perneel
Contributor I

We found a problem with sdphost: it does not return a non zero value upon all failures.

This is very annoying when using this in scripts... this is the case both for the windows as the linux variant.

The following example illustrates this:

-- under linux --

# ./sdphost -u 0x1fc9,0x0130 -- write-file 0x20000000 non_existing_file
Error: cannot open input data file 'non_existing_file'.
# echo $?
0   ==> this is not expected!
# ./sdphost -u 0x1234,0x1234 -- write-file 0x20000000 non_existing_file
Error: UsbHidPeripheral() cannot open USB HID device (vid=0x1234, pid=0x1234, sn=).
# echo $?
1   ==> this is correct

-- under windows --
> sdphost.exe -u 0x1fc9,0x0130 -- write-file 0x20000000 non_existing_file
Error: cannot open input data file 'non_existing_file'.
> echo %ERRORLEVEL%
0   ==> this is not expected!
> sdphost.exe -u 0x1234,0x1234 -- write-file 0x20000000 non_existing_file
Error: UsbHidPeripheral() cannot open USB HID device (vid=0x1234, pid=0x1234, sn=).
> echo %ERRORLEVEL%
1   ==> this is correct

This is a bug:  all tools should return a non zero failure code if anything failed. Only when nothing went wrong at all and thus it was a complete success zero should be returned.

Such bugs can cost you hours/days of debug work when suddenly some script start to fail....

0 Kudos
2 Replies

584 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Luc Perneel

Thanks for your feedback, this is correct, sdphost return 0 with the failure states, I will share your comments with the application team.


Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
-------------------------------------------------------------------------------

0 Kudos

584 Views
luc_perneel
Contributor I

Ok thanks!

0 Kudos