validate response on custom gp commands

This commit is contained in:
Andrea Franz 2019-04-26 16:32:34 +02:00
parent 439156bddb
commit 0be16bb97d
No known key found for this signature in database
GPG Key ID: 4F0D2F2D9DE7F29D
2 changed files with 7 additions and 2 deletions

View File

@ -1 +1 @@
0.0.11
0.0.12

View File

@ -204,12 +204,17 @@ func (s *Shell) commandGPSendAPDU(args ...string) error {
}
logger.Info(fmt.Sprintf("send apdu %x", rawCmd))
_, err = channel.Send(cmd)
resp, err := channel.Send(cmd)
if err != nil {
logger.Error("send apdu failed", "error", err)
return err
}
if resp.Sw != apdu.SwOK {
logger.Error("unexpected response", "sw", fmt.Sprintf("%x", resp.Sw))
return err
}
return nil
}