From 82021648a3d0a8d4ff21b6d73d7914e91945ca7f Mon Sep 17 00:00:00 2001 From: Orsiris de Jong Date: Mon, 17 Oct 2022 19:19:28 +0200 Subject: [PATCH] Don't bother to check SIM security status on successful unlock --- adapters/GammuAdapter.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/adapters/GammuAdapter.php b/adapters/GammuAdapter.php index fb32676..7bc2de7 100644 --- a/adapters/GammuAdapter.php +++ b/adapters/GammuAdapter.php @@ -337,7 +337,9 @@ namespace adapters; { return true; } - + + // The command returns 123 on failed execution (even if SIM is already unlocked), and returns 0 if unlock was successful + // We can directly return true if command was succesful $command_parts = [ 'gammu', '--config', @@ -348,8 +350,13 @@ namespace adapters; ]; $result = $this->exec_command($command_parts); + if (0 === $result['return']) + { + return true; + } //Check security status + // The command returns 0 regardless of the SIM security state $command_parts = [ 'gammu', '--config',