diff --git a/drivers/at/at.c b/drivers/at/at.c index ac682b0eb1..09ac4eae5a 100644 --- a/drivers/at/at.c +++ b/drivers/at/at.c @@ -208,10 +208,10 @@ ssize_t at_send_cmd_get_lines(at_dev_t *dev, const char *command, return -1; } else if (strncmp(pos, "+CME ERROR:", 11) == 0) { - return -1; + return -2; } else if (strncmp(pos, "+CMS ERROR:", 11) == 0) { - return -1; + return -2; } else { pos += res; diff --git a/drivers/include/at.h b/drivers/include/at.h index 8e26bd5381..056d589017 100644 --- a/drivers/include/at.h +++ b/drivers/include/at.h @@ -183,8 +183,9 @@ ssize_t at_send_cmd_get_resp(at_dev_t *dev, const char *command, char *resp_buf, * This function sends the supplied @p command, then returns all response * lines until the device sends "OK". * - * If a line starts with "ERROR" or "+CME ERROR:", or the buffer is full, the - * function returns -1. + * If a line starts with "ERROR" or the buffer is full, the function returns -1. + * If a line starts with "+CME ERROR" or +CMS ERROR", the function returns -2. + * In this case resp_buf contains the error string. * * @param[in] dev device to operate on * @param[in] command command to send @@ -194,7 +195,8 @@ ssize_t at_send_cmd_get_resp(at_dev_t *dev, const char *command, char *resp_buf, * @param[in] timeout timeout (in usec) * * @returns length of response on success - * @returns <0 on error + * @returns -1 on error + * @returns -2 on CMS or CME error */ ssize_t at_send_cmd_get_lines(at_dev_t *dev, const char *command, char *resp_buf, size_t len, bool keep_eol, uint32_t timeout);