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....
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!
-------------------------------------------------------------------------------
Ok thanks!