validate response on custom gp commands
This commit is contained in:
parent
439156bddb
commit
0be16bb97d
7
shell.go
7
shell.go
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue