Skip to content

Commit 0a53d05

Browse files
stig-bjorlykkejukkar
authored andcommitted
lib: modem_key_mgmt: Handle generic CME errors
Handle generic CME errors from all AT%CMNG commands. For reference, see 3GPP 27.007 Ch. 9.1. Signed-off-by: Stig Bjørlykke <[email protected]>
1 parent 7eb5555 commit 0a53d05

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

include/modem/modem_key_mgmt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ int modem_key_mgmt_clear(nrf_sec_tag_t sec_tag);
111111
* @retval -ENOENT No credential associated with the given
112112
* @p sec_tag and @p cred_type.
113113
* @retval -EACCES Access to credential not allowed.
114+
* @retval -E2BIG Memory failure.
114115
*/
115116
int modem_key_mgmt_read(nrf_sec_tag_t sec_tag,
116117
enum modem_key_mgmt_cred_type cred_type,

lib/modem_key_mgmt/modem_key_mgmt.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,18 @@ static int translate_error(int err)
6666

6767
/* In case of CME error translate to an errno value */
6868
switch (nrf_modem_at_err(err)) {
69+
case 0: /* phone failure. invalid command, parameter, or other unexpected error */
70+
LOG_WRN("Phone failure");
71+
return -EIO;
72+
case 23: /* memory failure. unexpected error in memory handling */
73+
LOG_WRN("Memory failure");
74+
return -E2BIG;
75+
case 50: /* incorrect parameters in a command */
76+
LOG_WRN("Incorrect parameters in command");
77+
return -EINVAL;
78+
case 60: /* system error */
79+
LOG_WRN("System error");
80+
return -ENOEXEC;
6981
case 513: /* not found */
7082
LOG_WRN("Key not found");
7183
return -ENOENT;

0 commit comments

Comments
 (0)