Closed ArneRossius closed 1 year ago
pymcuprog returns 0 when an error occurs during programming (e.g. when target disconnected from programmer), but return value should be nonzero for error.
Examples:
No error (return value is 0 -- correct):
$ pymcuprog -t uart -u /dev/ttyUSB1 -d attiny214 ping; echo $? Connecting to SerialUPDI Pinging device... Ping response: 1E9120 Done. 0
Target disconnected (return value is still 0 -- wrong):
$ pymcuprog -t uart -u /dev/ttyUSB1 -d attiny214 ping; echo $? Connecting to SerialUPDI pymcuprog.pymcuprog - ERROR - Operation failed with PymcuprogError: UPDI initialisation failed 0
Wrong parameters (return value is 2 -- correct, it's nonzero):
$ pymcuprog foobar; echo $? usage: pymcuprog [-h] [-d DEVICE] [-p PACKPATH] [-t TOOL] [-s SERIALNUMBER] [-m MEMORY] [-o OFFSET] [-b BYTES] [-l LITERAL [LITERAL ...]] [-f FILENAME] [-c CLK] [-u UART] [-i INTERFACE] [-v {debug,info,warning,error,critical}] [-V] [-R] [--erase] [--verify] [-x] [-H {tool-toggle-power,user-toggle-power,simple-unsafe-pulse}] [-U] [-C] {ping,erase,read,write,verify,getvoltage,getsupplyvoltage,reboot-debugger,setsupplyvoltage,getusbvoltage,reset} pymcuprog: error: argument action: invalid choice: 'foobar' (choose from 'ping', 'erase', 'read', 'write', 'verify', 'getvoltage', 'getsupplyvoltage', 'reboot-debugger', 'setsupplyvoltage', 'getusbvoltage', 'reset') 2
Logged internally as DSG-5157. (Thanks for the detailed report)
Fixed in 3.14
pymcuprog returns 0 when an error occurs during programming (e.g. when target disconnected from programmer), but return value should be nonzero for error.
Examples:
No error (return value is 0 -- correct):
Target disconnected (return value is still 0 -- wrong):
Wrong parameters (return value is 2 -- correct, it's nonzero):