sdphost does not return failure state on all failures

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

sdphost does not return failure state on all failures

1,484 次查看
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 项奖励
回复
2 回复数

1,345 次查看
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 项奖励
回复

1,345 次查看
luc_perneel
Contributor I

Ok thanks!

0 项奖励
回复